Alexandre Julliard : Avoid importing _strlwr/_strupr from ntdll.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 24 06:45:25 CST 2006


Module: wine
Branch: refs/heads/master
Commit: b7b7f2b67951e42f24a8e04095901c81fe129e11
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=b7b7f2b67951e42f24a8e04095901c81fe129e11

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jan 24 12:24:05 2006 +0100

Avoid importing _strlwr/_strupr from ntdll.

---

 dlls/msvcrt/mbcs.c         |   22 ++++++----------------
 dlls/msvcrt/msvcrt.h       |    7 -------
 dlls/user/combo.c          |   11 ++++++-----
 dlls/winedos/int21.c       |    5 ++++-
 include/winternl.h         |    3 ---
 programs/winedbg/winedbg.c |    1 -
 6 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 59bb182..fe03eb6 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -109,16 +109,6 @@ static inline unsigned char *u__strnset(
   return (unsigned char*) _strnset( (char*)s, c, len );
 }
 
-static inline unsigned char *u__strlwr( unsigned char *s )
-{
-  return (unsigned char*) _strlwr( (char*)s );
-}
-
-static inline unsigned char *u__strupr( unsigned char *s )
-{
-  return (unsigned char*) _strupr( (char*)s );
-}
-
 static inline size_t u_strcspn( const unsigned char *s, const unsigned char *rej )
 {
   return strcspn( (const char *)s, (const char*)rej );
@@ -1122,12 +1112,12 @@ unsigned char* _mbsncat(unsigned char* d
  */
 unsigned char* _mbslwr(unsigned char* s)
 {
+  unsigned char *ret = s;
   if (!s)
     return NULL;
   if (MSVCRT___mb_cur_max > 1)
   {
     unsigned int c;
-    unsigned char* p=s;
     while (*s)
     {
       c = _mbctolower(_mbsnextc(s));
@@ -1139,9 +1129,9 @@ unsigned char* _mbslwr(unsigned char* s)
       }
       *s++=c;
     }
-    return p;
   }
-  return u__strlwr(s);
+  else for ( ; *s; s++) *s = tolower(*s);
+  return ret;
 }
 
 
@@ -1150,12 +1140,12 @@ unsigned char* _mbslwr(unsigned char* s)
  */
 unsigned char* _mbsupr(unsigned char* s)
 {
+  unsigned char *ret = s;
   if (!s)
     return NULL;
   if (MSVCRT___mb_cur_max > 1)
   {
     unsigned int c;
-    unsigned char* p=s;
     while (*s)
     {
       c = _mbctoupper(_mbsnextc(s));
@@ -1167,9 +1157,9 @@ unsigned char* _mbsupr(unsigned char* s)
       }
       *s++=c;
     }
-    return p;
   }
-  return u__strupr(s);
+  else for ( ; *s; s++) *s = toupper(*s);
+  return ret;
 }
 
 
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 3e00480..b565bed 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -641,11 +641,4 @@ int           _dup2(int, int);
 int           _pipe(int *, unsigned int, int);
 #endif
 
-/*  FIXME: Functions that we forward to. They shouldn't be defined
- *  here, but for now they're not declared in the standard headers. 
- */
-void           _splitpath(const char*,char*,char*,char*,char*);
-char*          _strlwr(char*);
-char*          _strupr(char*);
-
 #endif /* __WINE_MSVCRT_H */
diff --git a/dlls/user/combo.c b/dlls/user/combo.c
index 12d3121..55f04f9 100644
--- a/dlls/user/combo.c
+++ b/dlls/user/combo.c
@@ -2088,17 +2088,17 @@ static LRESULT ComboWndProc_common( HWND
                 else /* unlike the unicode version, the ansi version does not overwrite
                         the string if converting case */
                 {
-                    char *string = NULL;
+                    char *p, *string = NULL;
                     LRESULT ret;
                     if( lphc->dwStyle & CBS_LOWERCASE )
                     {
                         string = strdupA((LPSTR)lParam);
-                        _strlwr(string);
+                        for (p = string; *p; p++) *p = tolower(*p);
                     }
                     else if( lphc->dwStyle & CBS_UPPERCASE )
                     {
                         string = strdupA((LPSTR)lParam);
-                        _strupr(string);
+                        for (p = string; *p; p++) *p = toupper(*p);
                     }
                     ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ? (LPARAM)string : lParam);
                     HeapFree(GetProcessHeap(), 0, string);
@@ -2119,10 +2119,11 @@ static LRESULT ComboWndProc_common( HWND
                 }
                 else
                 {
+                    char *p;
                     if( lphc->dwStyle & CBS_LOWERCASE )
-                        _strlwr((LPSTR)lParam);
+                        for (p = (LPSTR)lParam; *p; p++) *p = tolower(*p);
                     else if( lphc->dwStyle & CBS_UPPERCASE )
-                        _strupr((LPSTR)lParam);
+                        for (p = (LPSTR)lParam; *p; p++) *p = toupper(*p);
                     return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
                 }
 	case CB_DELETESTRING16:
diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c
index 85edf2a..3c52be8 100644
--- a/dlls/winedos/int21.c
+++ b/dlls/winedos/int21.c
@@ -1989,7 +1989,10 @@ static void INT21_ExtendedCountryInforma
     case 0x22: /* CAPITALIZE ASCIIZ STRING */
     case 0xa2: /* CAPITALIZE ASCIIZ FILENAME */
         TRACE("Convert ASCIIZ string to uppercase\n");
-        _strupr( (LPSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx) );
+        {
+            char *p = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Edx );
+            for ( ; *p; p++) *p = toupper(*p);
+        }
         break;
 
     case 0x23: /* DETERMINE IF CHARACTER REPRESENTS YES/NO RESPONSE */
diff --git a/include/winternl.h b/include/winternl.h
index a5a2e83..abe1745 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1685,9 +1685,6 @@ typedef enum _SYSDBG_COMMAND {
  * Function declarations
  */
 
-extern LPSTR _strlwr(LPSTR str); /* FIXME: Doesn't belong here */
-extern LPSTR _strupr(LPSTR str); /* FIXME: Doesn't belong here */
-
 #if defined(__i386__) && defined(__GNUC__)
 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 87f9a02..ab6e5e3 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -955,7 +955,6 @@ static unsigned dbg_handle_debug_event(D
                    buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll,
                    de->u.LoadDll.dwDebugInfoFileOffset,
                    de->u.LoadDll.nDebugInfoSize);
-        _strupr(buffer);
         SymLoadModule(dbg_curr_process->handle, de->u.LoadDll.hFile, buffer, NULL,
                       (unsigned long)de->u.LoadDll.lpBaseOfDll, 0);
         break_set_xpoints(FALSE);




More information about the wine-cvs mailing list