From 62901e6ea07df194ab7f1407783a17d639a58ef1 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Wed, 7 Mar 2012 10:10:18 +0100 Subject: [PATCH] msvcp90: Fix build with MSVC. --- dlls/msvcp90/memory.c | 6 +++--- dlls/msvcp90/string.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/msvcp90/memory.c b/dlls/msvcp90/memory.c index 4ecc37961b8..c5cae500196 100644 --- a/dlls/msvcp90/memory.c +++ b/dlls/msvcp90/memory.c @@ -80,7 +80,7 @@ void __thiscall MSVCP_allocator_char_deallocate(void *this, char *ptr, MSVCP_siz DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_allocate, 8) char* __thiscall MSVCP_allocator_char_allocate(void *this, MSVCP_size_t count) { - return MSVCRT_operator_new(sizeof(char[count])); + return MSVCRT_operator_new(count); } /* ?allocate@?$allocator@D@std@@QAEPADIPBX@Z */ @@ -177,7 +177,7 @@ wchar_t* __thiscall MSVCP_allocator_wchar_allocate(void *this, MSVCP_size_t coun return NULL; } - return MSVCRT_operator_new(sizeof(wchar_t[count])); + return MSVCRT_operator_new(count * sizeof(wchar_t)); } /* ?allocate@?$allocator@_W@std@@QAEPA_WIPBX@Z */ @@ -276,7 +276,7 @@ unsigned short* __thiscall MSVCP_allocator_short_allocate( return NULL; } - return MSVCRT_operator_new(sizeof(unsigned short[count])); + return MSVCRT_operator_new(count * sizeof(unsigned short)); } /* ?allocate@?$allocator@G@std@@QAEPAGIPBX@Z */ diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c index 8a6bf64aba9..e40469944da 100644 --- a/dlls/msvcp90/string.c +++ b/dlls/msvcp90/string.c @@ -215,7 +215,7 @@ MSVCP_bool CDECL MSVCP_char_traits_wchar_lt(const wchar_t *ch1, int CDECL MSVCP_char_traits_wchar_compare(const wchar_t *s1, const wchar_t *s2, MSVCP_size_t count) { - int ret = memcmp(s1, s2, sizeof(wchar_t[count])); + int ret = memcmp(s1, s2, count * sizeof(wchar_t)); return (ret>0 ? 1 : (ret<0 ? -1 : 0)); } @@ -238,7 +238,7 @@ wchar_t* CDECL MSVCP_char_traits_wchar__Copy_s(wchar_t *dest, return dest; } - return memcpy(dest, src, sizeof(wchar_t[count])); + return memcpy(dest, src, count * sizeof(wchar_t)); } /* ?copy@?$char_traits@_W@std@@SAPA_WPA_WPB_WI@Z */ @@ -275,7 +275,7 @@ wchar_t* CDECL MSVCP_char_traits_wchar__Move_s(wchar_t *dest, return dest; } - return memmove(dest, src, sizeof(WCHAR[count])); + return memmove(dest, src, count * sizeof(WCHAR)); } /* ?move@?$char_traits@_W@std@@SAPA_WPA_WPB_WI@Z */ @@ -395,7 +395,7 @@ unsigned short * CDECL MSVCP_char_traits_short__Copy_s(unsigned short *dest, return dest; } - return memcpy(dest, src, sizeof(unsigned short[count])); + return memcpy(dest, src, count * sizeof(unsigned short)); } /* ?copy@?$char_traits@G@std@@SAPAGPAGPBGI@Z */ @@ -430,7 +430,7 @@ unsigned short* CDECL MSVCP_char_traits_short__Move_s(unsigned short *dest, return dest; } - return memmove(dest, src, sizeof(unsigned short[count])); + return memmove(dest, src, count * sizeof(unsigned short)); } /* ?move@?$char_traits@G@std@@SAPAGPAGPBGI@Z */