Commit 6ebe8d5a authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shlwapi: Use E_NOT_SUFFICIENT_BUFFER definition.

parent 730e744e
...@@ -453,7 +453,7 @@ exit: ...@@ -453,7 +453,7 @@ exit:
* Success: S_OK. langbuf is set to the language string found. * Success: S_OK. langbuf is set to the language string found.
* Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer * Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer
* does not contain the setting. * does not contain the setting.
* HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), If the buffer is not big enough * E_NOT_SUFFICIENT_BUFFER, If the buffer is not big enough
*/ */
HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen) HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen)
{ {
...@@ -506,7 +506,7 @@ HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen) ...@@ -506,7 +506,7 @@ HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen)
} }
*buflen = 0; *buflen = 0;
return __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); return E_NOT_SUFFICIENT_BUFFER;
} }
/************************************************************************* /*************************************************************************
......
...@@ -290,14 +290,14 @@ static void test_GetAcceptLanguagesA(void) ...@@ -290,14 +290,14 @@ static void test_GetAcceptLanguagesA(void)
When the buffer is large enough, the default language is returned When the buffer is large enough, the default language is returned
When the buffer is too small for that fallback, win7_32 and w2k8_64 When the buffer is too small for that fallback, win7_32 and w2k8_64
fail with HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), win8 fails fail with E_NOT_SUFFICIENT_BUFFER, win8 fails with HRESULT_FROM_WIN32(ERROR_MORE_DATA),
with HRESULT_FROM_WIN32(ERROR_MORE_DATA), other versions succeed and other versions succeed and return a partial result while older os succeed
return a partial result while older os succeed and overflow the buffer */ and overflow the buffer */
ok(((hr == E_INVALIDARG) && (len == 0)) || ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) || (((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((hr == S_OK) && !memcmp(buffer, language, len)) || ((hr == S_OK) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize)), ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize)),
"==_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer); "==_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
...@@ -309,7 +309,7 @@ static void test_GetAcceptLanguagesA(void) ...@@ -309,7 +309,7 @@ static void test_GetAcceptLanguagesA(void)
ok(((hr == E_INVALIDARG) && (len == 0)) || ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) || (((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((hr == S_OK) && !memcmp(buffer, language, len)) || ((hr == S_OK) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize - 1)), ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize - 1)),
"-1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer); "-1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
} }
...@@ -321,7 +321,7 @@ static void test_GetAcceptLanguagesA(void) ...@@ -321,7 +321,7 @@ static void test_GetAcceptLanguagesA(void)
ok(((hr == E_INVALIDARG) && (len == 0)) || ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) || (((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((hr == S_OK) && !memcmp(buffer, language, len)) || ((hr == S_OK) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == 1)), ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == 1)),
"=1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer); "=1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
...@@ -353,7 +353,7 @@ static void test_GetAcceptLanguagesA(void) ...@@ -353,7 +353,7 @@ static void test_GetAcceptLanguagesA(void)
buffer[maxlen] = 0; buffer[maxlen] = 0;
hr = pGetAcceptLanguagesA( buffer, &len); hr = pGetAcceptLanguagesA( buffer, &len);
ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) || ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len), ((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len),
"=2: got 0x%x with %d and %s\n", hr, len, buffer); "=2: got 0x%x with %d and %s\n", hr, len, buffer);
...@@ -362,11 +362,11 @@ static void test_GetAcceptLanguagesA(void) ...@@ -362,11 +362,11 @@ static void test_GetAcceptLanguagesA(void)
buffer[maxlen] = 0; buffer[maxlen] = 0;
hr = pGetAcceptLanguagesA( buffer, &len); hr = pGetAcceptLanguagesA( buffer, &len);
/* When the buffer is too small, win7_32 and w2k8_64 and above fail with /* When the buffer is too small, win7_32 and w2k8_64 and above fail with
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), win8 ERROR_CANNOT_COPY, E_NOT_SUFFICIENT_BUFFER, win8 ERROR_CANNOT_COPY,
other versions succeed and return a partial 0 terminated result while other versions other versions succeed and return a partial 0 terminated result while other versions
fail with E_INVALIDARG and return a partial unterminated result */ fail with E_INVALIDARG and return a partial unterminated result */
ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) || ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len), ((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len),
"=1: got 0x%x with %d and %s\n", hr, len, buffer); "=1: got 0x%x with %d and %s\n", hr, len, buffer);
......
...@@ -1058,7 +1058,7 @@ if (0) ...@@ -1058,7 +1058,7 @@ if (0)
memset(wbuf, 0xbf, sizeof(wbuf)); memset(wbuf, 0xbf, sizeof(wbuf));
strret.uType = STRRET_WSTR; strret.uType = STRRET_WSTR;
U(strret).pOleStr = StrDupW(wstr1); U(strret).pOleStr = StrDupW(wstr1);
expect_eq2(pStrRetToBufW(&strret, NULL, wbuf, 10), S_OK, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) /* Vista */, HRESULT, "%x"); expect_eq2(pStrRetToBufW(&strret, NULL, wbuf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%x");
expect_eq(wbuf[9], 0, WCHAR, "%x"); expect_eq(wbuf[9], 0, WCHAR, "%x");
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x"); expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
} }
...@@ -1070,7 +1070,7 @@ if (0) ...@@ -1070,7 +1070,7 @@ if (0)
memset(buf, 0xbf, sizeof(buf)); memset(buf, 0xbf, sizeof(buf));
strret.uType = STRRET_CSTR; strret.uType = STRRET_CSTR;
StrCpyNA(U(strret).cStr, str1, MAX_PATH); StrCpyNA(U(strret).cStr, str1, MAX_PATH);
expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) /* Vista */, HRESULT, "%x"); expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%x");
expect_eq(buf[9], 0, CHAR, "%x"); expect_eq(buf[9], 0, CHAR, "%x");
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x"); expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment