diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index f31ba60630d..96f67e064a0 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -1109,7 +1109,11 @@ MSVCRT_long CDECL MSVCRT__atol_l(const char *str, MSVCRT__locale_t locale) */ MSVCRT_long CDECL MSVCRT_atol(const char *str) { +#if _MSVCR_VER == 0 + return MSVCRT_atoi(str); +#else return MSVCRT__atol_l(str, NULL); +#endif } #if _MSVCR_VER>=120 diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index eb8e3041073..ff3a87d69dc 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -3047,6 +3047,23 @@ static void test_atoi(void) ok(r == 0, "atoi(4294967296) = %d\n", r); } +static void test_atol(void) +{ + int r; + + r = atol("0"); + ok(r == 0, "atol(0) = %d\n", r); + + r = atol("-1"); + ok(r == -1, "atol(-1) = %d\n", r); + + r = atol("1"); + ok(r == 1, "atol(1) = %d\n", r); + + r = atol("4294967296"); + ok(r == 0, "atol(4294967296) = %d\n", r); +} + static void test_atof(void) { double d; @@ -3831,6 +3848,7 @@ START_TEST(string) test__stricmp(); test__wcstoi64(); test_atoi(); + test_atol(); test_atof(); test_strncpy(); test_strxfrm();