shlwapi: Use E_NOT_SUFFICIENT_BUFFER definition.

This commit is contained in:
Nikolay Sivov 2014-10-08 08:36:01 +04:00 committed by Alexandre Julliard
parent 730e744e3b
commit 6ebe8d5a2a
3 changed files with 13 additions and 13 deletions

View File

@ -453,7 +453,7 @@ exit:
* Success: S_OK. langbuf is set to the language string found.
* Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer
* 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)
{
@ -506,7 +506,7 @@ HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen)
}
*buflen = 0;
return __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
return E_NOT_SUFFICIENT_BUFFER;
}
/*************************************************************************

View File

@ -290,14 +290,14 @@ static void test_GetAcceptLanguagesA(void)
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
fail with HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), win8 fails
with HRESULT_FROM_WIN32(ERROR_MORE_DATA), other versions succeed and
return a partial result while older os succeed and overflow the buffer */
fail with E_NOT_SUFFICIENT_BUFFER, win8 fails with HRESULT_FROM_WIN32(ERROR_MORE_DATA),
other versions succeed and return a partial result while older os succeed
and overflow the buffer */
ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((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)),
"==_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
@ -309,7 +309,7 @@ static void test_GetAcceptLanguagesA(void)
ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((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)),
"-1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
}
@ -321,7 +321,7 @@ static void test_GetAcceptLanguagesA(void)
ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((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)),
"=1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
@ -353,7 +353,7 @@ static void test_GetAcceptLanguagesA(void)
buffer[maxlen] = 0;
hr = pGetAcceptLanguagesA( buffer, &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),
"=2: got 0x%x with %d and %s\n", hr, len, buffer);
@ -362,11 +362,11 @@ static void test_GetAcceptLanguagesA(void)
buffer[maxlen] = 0;
hr = pGetAcceptLanguagesA( buffer, &len);
/* 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
fail with E_INVALIDARG and return a partial unterminated result */
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),
"=1: got 0x%x with %d and %s\n", hr, len, buffer);

View File

@ -1058,7 +1058,7 @@ if (0)
memset(wbuf, 0xbf, sizeof(wbuf));
strret.uType = STRRET_WSTR;
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[10], (WCHAR)0xbfbf, WCHAR, "%x");
}
@ -1070,7 +1070,7 @@ if (0)
memset(buf, 0xbf, sizeof(buf));
strret.uType = STRRET_CSTR;
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[10], (CHAR)0xbf, CHAR, "%x");
}