comparison src/com/tmate/hgkit/ll/HgDirstate.java @ 11:d46773d89a19

Boundary error in dirstate entry, explicit encoding to face troubles (if any) asap.
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 25 Dec 2010 22:19:31 +0100
parents 382cfe9463db
children 181fccc176ef
comparison
equal deleted inserted replaced
10:382cfe9463db 11:d46773d89a19
60 String fn1 = null, fn2 = null; 60 String fn1 = null, fn2 = null;
61 byte[] name = new byte[nameLen]; 61 byte[] name = new byte[nameLen];
62 da.readBytes(name, 0, nameLen); 62 da.readBytes(name, 0, nameLen);
63 for (int i = 0; i < nameLen; i++) { 63 for (int i = 0; i < nameLen; i++) {
64 if (name[i] == 0) { 64 if (name[i] == 0) {
65 fn1 = new String(name, 0, i); 65 fn1 = new String(name, 0, i, "UTF-8"); // XXX unclear from documentation what encoding is used there
66 fn2 = new String(name, i+1, nameLen); 66 fn2 = new String(name, i+1, nameLen - i - 1, "UTF-8"); // need to check with different system codepages
67 break; 67 break;
68 } 68 }
69 } 69 }
70 if (fn1 == null) { 70 if (fn1 == null) {
71 fn1 = new String(name); 71 fn1 = new String(name);