Michael Stefaniuc : msvc90: Use the ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Fri Aug 17 12:33:09 CDT 2018


Module: wine
Branch: master
Commit: 93b680510ab7c2e7fee12010a52e49043d5ab94c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=93b680510ab7c2e7fee12010a52e49043d5ab94c

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Thu Aug 16 20:19:28 2018 +0200

msvc90: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcp90/ios.c    | 8 ++++----
 dlls/msvcp90/locale.c | 4 ++--
 dlls/msvcp90/misc.c   | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 61acf19..bf7eea2 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -3237,10 +3237,10 @@ FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot)
 
     TRACE("(%s %d %d)\n", debugstr_w(name), mode, prot);
 
-    for(mode_idx=0; mode_idx<sizeof(str_mode)/sizeof(str_mode[0]); mode_idx++)
+    for(mode_idx=0; mode_idx<ARRAY_SIZE(str_mode); mode_idx++)
         if(str_mode[mode_idx].mode == real_mode)
             break;
-    if(mode_idx == sizeof(str_mode)/sizeof(str_mode[0]))
+    if(mode_idx == ARRAY_SIZE(str_mode))
         return NULL;
 
     if((mode & OPENMODE__Nocreate) && !(f = _wfopen(name, rW)))
@@ -3469,7 +3469,7 @@ int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
         return c;
 
     buf_next = buf;
-    for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
+    for(i=0; i < ARRAY_SIZE(buf); i++) {
         buf[i] = c;
 
         switch(codecvt_char_in(this->cvt, &this->state, buf_next,
@@ -4112,7 +4112,7 @@ unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
         return fgetwc(this->file);
 
     buf_next = buf;
-    for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
+    for(i=0; i < ARRAY_SIZE(buf); i++) {
         if((c = fgetc(this->file)) == EOF)
             return WEOF;
         buf[i] = c;
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index 5398fcf..83fa3de 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -786,11 +786,11 @@ int __cdecl _Getdateorder(void)
 
 #if _MSVCP_VER < 110
     if(!GetLocaleInfoW(___lc_handle_func()[LC_TIME], LOCALE_ILDATE,
-                date_fmt, sizeof(date_fmt)/sizeof(*date_fmt)))
+                date_fmt, ARRAY_SIZE(date_fmt)))
         return DATEORDER_no_order;
 #else
     if(!GetLocaleInfoEx(___lc_locale_name_func()[LC_TIME], LOCALE_ILDATE,
-                date_fmt, sizeof(date_fmt)/sizeof(*date_fmt)))
+                date_fmt, ARRAY_SIZE(date_fmt)))
         return DATEORDER_no_order;
 #endif
 
diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c
index 58e546c..0d1a74e 100644
--- a/dlls/msvcp90/misc.c
+++ b/dlls/msvcp90/misc.c
@@ -1781,7 +1781,7 @@ typedef struct __Concurrent_vector_base_v4
     void **segment;
 } _Concurrent_vector_base_v4;
 
-#define STORAGE_SIZE (sizeof(this->storage) / sizeof(this->storage[0]))
+#define STORAGE_SIZE ARRAY_SIZE(this->storage)
 #define SEGMENT_SIZE (sizeof(void*) * 8)
 
 typedef struct compact_block




More information about the wine-cvs mailing list