Alexandre Julliard : msvcrt: Fix incorrect uses of msvcrt_set_errno.

Alexandre Julliard julliard at winehq.org
Wed Feb 27 08:03:21 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Feb 27 12:24:09 2008 +0100

msvcrt: Fix incorrect uses of msvcrt_set_errno.

---

 dlls/msvcrt/heap.c |   12 ++++++------
 dlls/msvcrt/mbcs.c |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index 2f7fb9f..227bc91 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -280,7 +280,7 @@ void* CDECL MSVCRT_malloc(MSVCRT_size_t size)
 {
   void *ret = HeapAlloc(GetProcessHeap(),0,size);
   if (!ret)
-    msvcrt_set_errno(MSVCRT_ENOMEM);
+      *MSVCRT__errno() = MSVCRT_ENOMEM;
   return ret;
 }
 
@@ -348,14 +348,14 @@ void * CDECL _aligned_offset_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment,
     /* alignment must be a power of 2 */
     if ((alignment & (alignment - 1)) != 0)
     {
-        msvcrt_set_errno(EINVAL);
+        *MSVCRT__errno() = MSVCRT_EINVAL;
         return NULL;
     }
 
     /* offset must be less than size */
     if (offset >= size)
     {
-        msvcrt_set_errno(EINVAL);
+        *MSVCRT__errno() = MSVCRT_EINVAL;
         return NULL;
     }
 
@@ -405,14 +405,14 @@ void * CDECL _aligned_offset_realloc(void *memblock, MSVCRT_size_t size,
     /* alignment must be a power of 2 */
     if ((alignment & (alignment - 1)) != 0)
     {
-        msvcrt_set_errno(EINVAL);
+        *MSVCRT__errno() = MSVCRT_EINVAL;
         return NULL;
     }
 
     /* offset must be less than size */
     if (offset >= size)
     {
-        msvcrt_set_errno(EINVAL);
+        *MSVCRT__errno() = MSVCRT_EINVAL;
         return NULL;
     }
 
@@ -430,7 +430,7 @@ void * CDECL _aligned_offset_realloc(void *memblock, MSVCRT_size_t size,
     saved = SAVED_PTR(memblock);
     if (memblock != ALIGN_PTR(*saved, alignment, offset))
     {
-        msvcrt_set_errno(EINVAL);
+        *MSVCRT__errno() = MSVCRT_EINVAL;
         return NULL;
     }
 
diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 14a962a..392f450 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -191,7 +191,7 @@ int CDECL _setmbcp(int cp)
   if (!GetCPInfo(newcp, &cpi))
   {
     WARN("Codepage %d not found\n", newcp);
-    msvcrt_set_errno(MSVCRT_EINVAL);
+    *MSVCRT__errno() = MSVCRT_EINVAL;
     return -1;
   }
 




More information about the wine-cvs mailing list