From b70b97e6175d08f868094a81e5ca09f6b67f6aec Mon Sep 17 00:00:00 2001
From: James David Berry <jberry@apache.org>
Date: Sun, 19 May 2002 22:57:56 +0000
Subject: [PATCH] Fix bugs in upperCase and lowerCase for Macintosh. May fix
 bug #9237.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173662 13f79535-47bb-0310-9956-ffa450edef68
---
 .../MacOSUnicodeConverter.cpp                 | 21 +++++++------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
index 06ed803c2..40e052004 100644
--- a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
+++ b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
@@ -468,20 +468,16 @@ void MacOSUnicodeConverter::upperCase(XMLCh* const toUpperCase) const
 #if defined(XML_METROWERKS)
 	// Use this if there's a reasonable c library available.
 	// Metrowerks does this reasonably
-	wchar_t * p = (wchar_t*) toUpperCase;
 	wchar_t c;
-	
-	while ((c = *p) != 0)
+	for (XMLCh* p = (XMLCh*)toUpperCase; ((c = *p) != 0); )
 		*p++ = std::towupper(c);
 #elif defined(XML_MACOSX) || true
 	// This might work, assuming we're on an ascii compiler.
 	// We'll use this under ProjectBuilder for now.
 	// Note that this only handles the ascii portion of the
 	// string, leaving all other characters in original case.
-	wchar_t * p = (wchar_t*)toUpperCase;
-	wchar_t c;
-	
-	while ((c = *p) != 0)
+	XMLCh c;
+	for (XMLCh* p = (XMLCh*)toUpperCase; ((c = *p) != 0); )
 	{
 		if (c >= 'a' && c <= 'z')
 			c += 'A' - 'a';
@@ -492,26 +488,23 @@ void MacOSUnicodeConverter::upperCase(XMLCh* const toUpperCase) const
 #endif
 }
 
+
 void MacOSUnicodeConverter::lowerCase(XMLCh* const toLowerCase) const
 {
 	//	ะตะตะต TODO: Support CFString for this conversion
 #if defined(XML_METROWERKS)
 	// Use this if there's a reasonable c library available.
 	// Metrowerks does this reasonably
-	wchar_t * p = (wchar_t*) toLowerCase;
 	wchar_t c;
-	
-	while ((c = *p) != 0)
+	for (XMLCh* p = (XMLCh*)toLowerCase; ((c = *p) != 0); )
 		*p++ = std::towlower(c);
 #elif defined(XML_MACOSX) || true
 	// This might work, assuming we're on an ascii compiler.
 	// We'll use this under ProjectBuilder for now.
 	// Note that this only handles the ascii portion of the
 	// string, leaving all other characters in original case.
-	wchar_t * p = (wchar_t*)toLowerCase;
-	wchar_t c;
-	
-	while ((c = *p) != 0)
+	XMLCh c;
+	for (XMLCh* p = (XMLCh*)toLowerCase; ((c = *p) != 0); )
 	{
 		if (c >= 'A' && c <= 'Z')
 			c += 'a' - 'A';
-- 
GitLab