Module: wine Branch: master Commit: 4b88fd842a58998d234ab7daa3ad77d5cbe23654 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4b88fd842a58998d234ab7daa3...
Author: Eric Pouech eric.pouech@wanadoo.fr Date: Wed Nov 8 21:46:59 2006 +0100
mscms: GetColorDirectory: fixed incorrect A -> W conversions.
---
dlls/mscms/profile.c | 27 ++++++++++++++------------- dlls/mscms/tests/profile.c | 10 ++-------- 2 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c index 0b1b437..0ada3e8 100644 --- a/dlls/mscms/profile.c +++ b/dlls/mscms/profile.c @@ -91,14 +91,13 @@ BOOL WINAPI GetColorDirectoryA( PCSTR ma
if (bufferW) { - ret = GetColorDirectoryW( NULL, bufferW, &sizeW ); - *size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL ); - - if (ret) + if ((ret = GetColorDirectoryW( NULL, bufferW, &sizeW ))) { - len = WideCharToMultiByte( CP_ACP, 0, bufferW, *size, buffer, *size, NULL, NULL ); + *size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL ); + len = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, *size, NULL, NULL ); if (!len) ret = FALSE; } + else *size = sizeW / sizeof(WCHAR);
HeapFree( GetProcessHeap(), 0, bufferW ); } @@ -132,13 +131,14 @@ BOOL WINAPI GetColorDirectoryW( PCWSTR m
len = lstrlenW( colordir ) * sizeof(WCHAR);
- if (len <= *size && buffer) + if (buffer && len <= *size) { lstrcpyW( buffer, colordir ); *size = len; return TRUE; }
+ SetLastError( ERROR_MORE_DATA ); *size = len; return FALSE; } @@ -389,14 +389,13 @@ BOOL WINAPI GetStandardColorSpaceProfile
if (profileW) { - ret = GetStandardColorSpaceProfileW( NULL, id, profileW, &sizeW ); - *size = WideCharToMultiByte( CP_ACP, 0, profileW, -1, NULL, 0, NULL, NULL ); - - if (ret) + if ((ret = GetStandardColorSpaceProfileW( NULL, id, profileW, &sizeW ))) { - len = WideCharToMultiByte( CP_ACP, 0, profileW, *size, profile, *size, NULL, NULL ); + *size = WideCharToMultiByte( CP_ACP, 0, profileW, -1, NULL, 0, NULL, NULL ); + len = WideCharToMultiByte( CP_ACP, 0, profileW, -1, profile, *size, NULL, NULL ); if (!len) ret = FALSE; } + else *size = sizeW / sizeof(WCHAR);
HeapFree( GetProcessHeap(), 0, profileW ); } @@ -451,20 +450,22 @@ BOOL WINAPI GetStandardColorSpaceProfile
switch (id) { - case 0x52474220: /* 'RGB ' */ + case SPACE_RGB: /* 'RGB ' */ lstrcatW( rgbprofile, rgbprofilefile ); len = lstrlenW( rgbprofile ) * sizeof(WCHAR);
if (*size < len || !profile) { *size = len; - return TRUE; + SetLastError( ERROR_MORE_DATA ); + return FALSE; }
lstrcpyW( profile, rgbprofile ); break;
default: + SetLastError( ERROR_FILE_NOT_FOUND ); return FALSE; } return TRUE; diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index fda6723..3cf1073 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -597,7 +597,6 @@ static void test_GetStandardColorSpacePr
SetLastError(0xfaceabee); /* 2nd param, */ ret = pGetStandardColorSpaceProfileA(NULL, (DWORD)-1, newprofile, &sizeP); - todo_wine ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* 4th param, */ @@ -612,17 +611,14 @@ static void test_GetStandardColorSpacePr
SetLastError(0xfaceabee); /* dereferenced 4th param, */ ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, newprofile, &zero); - todo_wine ok( !ret && (GetLastError() == ERROR_MORE_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER), "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() ); } else { SetLastError(0xfaceabee); /* 3rd param, */ ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, NULL, &sizeP); - todo_wine ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* dereferenced 4th param. */ ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, newprofile, &sizeP); - todo_wine ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() ); }
@@ -642,7 +638,7 @@ static void test_GetStandardColorSpacePr
SetLastError(0xfaceabee); /* maybe 2nd param. */ ret = pGetStandardColorSpaceProfileA(NULL, 0, newprofile, &sizeP); - if (!ret) todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() ); + if (!ret) ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() ); else ok( !lstrcmpiA( newprofile, emptyA ) && GetLastError() == 0xfaceabee, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
/* Functional checks */ @@ -689,7 +685,6 @@ static void test_GetStandardColorSpacePr
SetLastError(0xfaceabee); /* 2nd param, */ ret = pGetStandardColorSpaceProfileW(NULL, (DWORD)-1, newprofile, &sizeP); - todo_wine ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* 3th param, */ @@ -702,7 +697,6 @@ static void test_GetStandardColorSpacePr
SetLastError(0xfaceabee); /* dereferenced 4th param. */ ret = pGetStandardColorSpaceProfileW(NULL, SPACE_RGB, newprofile, &zero); - todo_wine ok( !ret && (GetLastError() == ERROR_MORE_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER), "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
/* Several invalid parameter checks: */ @@ -721,7 +715,7 @@ static void test_GetStandardColorSpacePr
SetLastError(0xfaceabee); /* maybe 2nd param. */ ret = pGetStandardColorSpaceProfileW(NULL, 0, newprofile, &sizeP); - if (!ret) todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() ); + if (!ret) ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() ); else ok( !lstrcmpiW( newprofile, emptyW ) && GetLastError() == 0xfaceabee, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
/* Functional checks */