diff --git a/src/libraries/Native/Unix/Common/pal_atomic.h b/src/libraries/Native/Unix/Common/pal_atomic.h index 719902c5ddf0b..a2ebcf62612dc 100644 --- a/src/libraries/Native/Unix/Common/pal_atomic.h +++ b/src/libraries/Native/Unix/Common/pal_atomic.h @@ -9,11 +9,11 @@ #include "windows.h" #endif -static int pal_atomic_cas_ptr(void* volatile* dest, void* exchange, void* comperand) +static int pal_atomic_cas_ptr(void* volatile* dest, void* exchange, void* comparand) { #if defined(TARGET_UNIX) - return __atomic_compare_exchange_n(dest, exchange, comperand, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); + return __atomic_compare_exchange_n(dest, exchange, comparand, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); #elif defined(TARGET_WINDOWS) - return InterlockedCompareExchangePointer(dest, exchange, comperand) == comperand; + return InterlockedCompareExchangePointer(dest, exchange, comparand) == comparand; #endif } diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c index f0381ff46ff41..b687ac9071f12 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c @@ -12,13 +12,13 @@ #if defined(TARGET_UNIX) #include -#define STRING_COPY(destination, numberOfElements, source, count) \ - strncpy(destination, source, count); \ - destination[count - 1] = 0; +#define STRING_COPY(destination, numberOfElements, source) \ + strncpy(destination, source, numberOfElements); \ + destination[numberOfElements - 1] = 0; #elif defined(TARGET_WINDOWS) #define strcasecmp _stricmp -#define STRING_COPY(destination, numberOfElements, source, count) strncpy_s(destination, numberOfElements, source, _TRUNCATE); +#define STRING_COPY(destination, numberOfElements, source) strncpy_s(destination, numberOfElements, source, _TRUNCATE); #endif #define GREGORIAN_NAME "gregorian" @@ -316,7 +316,7 @@ static int32_t EnumSymbols(const char* locale, return FALSE; char localeWithCalendarName[ULOC_FULLNAME_CAPACITY]; - STRING_COPY(localeWithCalendarName, strlen(locale), locale, ULOC_FULLNAME_CAPACITY); + STRING_COPY(localeWithCalendarName, sizeof(localeWithCalendarName), locale); uloc_setKeywordValue("calendar", GetCalendarName(calendarId), localeWithCalendarName, ULOC_FULLNAME_CAPACITY, &err); @@ -423,7 +423,7 @@ static int32_t EnumAbbrevEraNames(const char* locale, char* localeNamePtr = localeNameBuf; char* parentNamePtr = parentNameBuf; - STRING_COPY(localeNamePtr, strlen(locale), locale, ULOC_FULLNAME_CAPACITY); + STRING_COPY(localeNamePtr, sizeof(localeNameBuf), locale); while (TRUE) {