rest of 1061091, clean up define a bit

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton 2004-11-05 16:06:54 +00:00
parent ba0052f3f5
commit 59059feb40

View File

@ -1,11 +1,12 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: string.cpp // Name: string.cpp
// Purpose: wxString class // Purpose: wxString class
// Author: Vadim Zeitlin // Author: Vadim Zeitlin, Ryan Norton
// Modified by: // Modified by:
// Created: 29/01/98 // Created: 29/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// (c) 2004 Ryan Norton <wxprojects@comcast.net>
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -1322,7 +1323,7 @@ static inline int wxDoCmpNoCase(const wxChar* s1, size_t l1,
if(wxTolower(s1[i]) != wxTolower(s2[i])) if(wxTolower(s1[i]) != wxTolower(s2[i]))
break; break;
} }
return i == l1 ? 0 : s1[i] < s2[i] ? -1 : 1; return i == l1 ? 0 : wxTolower(s1[i]) < wxTolower(s2[i]) ? -1 : 1;
} }
else if( l1 < l2 ) else if( l1 < l2 )
{ {
@ -1331,7 +1332,7 @@ static inline int wxDoCmpNoCase(const wxChar* s1, size_t l1,
if(wxTolower(s1[i]) != wxTolower(s2[i])) if(wxTolower(s1[i]) != wxTolower(s2[i]))
break; break;
} }
return i == l1 ? -1 : s1[i] < s2[i] ? -1 : 1; return i == l1 ? -1 : wxTolower(s1[i]) < wxTolower(s2[i]) ? -1 : 1;
} }
else if( l1 > l2 ) else if( l1 > l2 )
{ {
@ -1407,14 +1408,13 @@ const wxCharBuffer wxString::ToAscii() const
// this will allocate enough space for the terminating NUL too // this will allocate enough space for the terminating NUL too
wxCharBuffer buffer(length()); wxCharBuffer buffer(length());
#define LOCAL_DEST_TYPE signed char
LOCAL_DEST_TYPE *dest = (LOCAL_DEST_TYPE *)buffer.data(); wxInt8 *dest = buffer.data();
const wchar_t *pwc = c_str(); const wchar_t *pwc = c_str();
for ( ;; ) for ( ;; )
{ {
*dest++ = (LOCAL_DEST_TYPE)(*pwc > SCHAR_MAX ? wxT('_') : *pwc); *dest++ = (wxInt8)(*pwc > SCHAR_MAX ? wxT('_') : *pwc);
// the output string can't have embedded NULs anyhow, so we can safely // the output string can't have embedded NULs anyhow, so we can safely
// stop at first of them even if we do have any // stop at first of them even if we do have any
@ -1422,8 +1422,6 @@ const wxCharBuffer wxString::ToAscii() const
break; break;
} }
#undef LOCAL_DEST_TYPE
return buffer; return buffer;
} }