[PATCH] msvc90: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Thu Aug 16 13:19:28 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani 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 61acf19fa3..bf7eea2e6f 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 5398fcf345..83fa3de706 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 58e546cdf3..0d1a74e250 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
-- 
2.14.4




More information about the wine-devel mailing list