git: 9front

Download patch

ref: c79f966b290d86c31bf0df0043bcd9e66b10e909
parent: ff9057bc5b7bcb0367ed851e9f8bf010f0569278
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Thu Oct 27 23:44:58 EDT 2011

hgfs: fix sign bug in path mangeling

--- a/sys/src/cmd/hgfs/tree.c
+++ b/sys/src/cmd/hgfs/tree.c
@@ -26,7 +26,7 @@
 	for(i=0; i<nelem(frogs); i++){
 		l = strlen(frogs[i]);
 		if((strncmp(frogs[i], p, l) == 0) && (p[l] == 0 || p[l] == '.'))
-			return seprint(s, e, "%.2s~%.2x%s", p, p[2], p+3);
+			return seprint(s, e, "%.2s~%.2x%s", p, (uchar)p[2], p+3);
 	}
 	for(; s+4 < e && *p; p++){
 		if(*p == '_'){
@@ -35,9 +35,9 @@
 		} else if(*p >= 'A' && *p <= 'Z'){
 			*s++ = '_';
 			*s++ = 'a' + (*p - 'A');
-		} else if(*p >= 126 || strchr("\\:*?\"<>|", *p)){
+		} else if((uchar)*p >= 126 || strchr("\\:*?\"<>|", *p)){
 			*s++ = '~';
-			s = seprint(s, e, "%.2x", *p);
+			s = seprint(s, e, "%.2x", (uchar)*p);
 		} else
 			*s++ = *p;
 	}
--