[PATCH 3/3] msvcrt: Fix calloc() prototype

Nikolay Sivov nsivov at codeweavers.com
Sun Apr 24 13:51:26 CDT 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/msvcrt/exit.c       | 2 +-
 dlls/msvcrt/file.c       | 4 ++--
 dlls/msvcrt/heap.c       | 4 ++--
 dlls/msvcrt/tests/file.c | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 6d8802c..d1314b5 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -280,7 +280,7 @@ MSVCRT__onexit_t CDECL MSVCRT__onexit(MSVCRT__onexit_t func)
   {
     MSVCRT__onexit_t *newtable;
     TRACE("expanding table\n");
-    newtable = MSVCRT_calloc(sizeof(void *),MSVCRT_atexit_table_size + 32);
+    newtable = MSVCRT_calloc(MSVCRT_atexit_table_size + 32, sizeof(void *));
     if (!newtable)
     {
       TRACE("failed!\n");
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 71e578d..c4f89b1 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -512,7 +512,7 @@ unsigned msvcrt_create_io_inherit_block(WORD *size, BYTE **block)
   last_fd++;
 
   *size = sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * last_fd;
-  *block = MSVCRT_calloc(*size, 1);
+  *block = MSVCRT_calloc(1, *size);
   if (!*block)
   {
     *size = 0;
@@ -660,7 +660,7 @@ static BOOL msvcrt_alloc_buffer(MSVCRT_FILE* file)
             && MSVCRT__isatty(file->_file))
         return FALSE;
 
-    file->_base = MSVCRT_calloc(MSVCRT_INTERNAL_BUFSIZ,1);
+    file->_base = MSVCRT_calloc(1, MSVCRT_INTERNAL_BUFSIZ);
     if(file->_base) {
         file->_bufsiz = MSVCRT_INTERNAL_BUFSIZ;
         file->_flag |= MSVCRT__IOMYBUF;
diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index a908846..52a5287 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -392,9 +392,9 @@ size_t CDECL _aligned_msize(void *p, MSVCRT_size_t alignment, MSVCRT_size_t offs
 /*********************************************************************
  *		calloc (MSVCRT.@)
  */
-void* CDECL MSVCRT_calloc(MSVCRT_size_t size, MSVCRT_size_t count)
+void* CDECL MSVCRT_calloc(MSVCRT_size_t count, MSVCRT_size_t size)
 {
-  return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, size*count);
+  return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, count*size);
 }
 
 /*********************************************************************
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c
index dbb6cef..42ec34b 100644
--- a/dlls/msvcrt/tests/file.c
+++ b/dlls/msvcrt/tests/file.c
@@ -2262,8 +2262,8 @@ static void test_write_flush_size(FILE *file, int bufsize)
     fpos_t pos, pos2;
 
     fd = fileno(file);
-    inbuffer = calloc(bufsize + 1, 1);
-    outbuffer = calloc(bufsize + 1, 1);
+    inbuffer = calloc(1, bufsize + 1);
+    outbuffer = calloc(1, bufsize + 1);
     _snprintf(outbuffer, bufsize + 1, "0,1,2,3,4,5,6,7,8,9");
 
     for (size = bufsize + 1; size >= bufsize - 1; size--) {
-- 
2.8.0.rc3




More information about the wine-patches mailing list