[1.7][BUG] winsup/cygwin/strfuncs.cc

IWAMURO Motonori deenheart@gmail.com
Wed Jun 3 18:12:00 GMT 2009


Hi.

I found a trivial bug.

*pmbs is unsigned char.
'\x80' is -128 because it is char literal (not unsigned char).
-> "*pmbs > '\x80'" is always true.

# Is not "> 0x80" but ">= 0x80" correct?

--- winsup/cygwin/strfuncs.cc	31 May 2009 03:59:38 -0000	1.30
+++ winsup/cygwin/strfuncs.cc	3 Jun 2009 17:59:23 -0000
@@ -572,7 +572,7 @@
 	      --len;
 	    }
 	}
-      else if ((bytes = f_mbtowc (_REENT, ptr, (const char *) pmbs,
nms, charset, &ps)) < 0 && *pmbs > '\x80')
+      else if ((bytes = f_mbtowc (_REENT, ptr, (const char *) pmbs,
nms, charset, &ps)) < 0 && *pmbs > 0x80)
 	{
 	  /* This should probably be handled in f_mbtowc which can operate
 	     on sequences rather than individual characters.
-- 
IWAMURO Motnori <http://vmi.jp/>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list