X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Thu, 4 Jun 2009 03:11:29 +0900 Message-ID: <3f0ad08d0906031111q9c857ddu48869fdade0c71da@mail.gmail.com> Subject: [1.7][BUG] winsup/cygwin/strfuncs.cc From: IWAMURO Motonori To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 -- 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/