Fix a couple of bugs spotted by valgrind.
This commit is contained in:
parent
2e0b5336f6
commit
e0cffe355f
|
@ -708,7 +708,7 @@ GetDateTimeFormatA_InvalidParameter:
|
||||||
if (lpStr)
|
if (lpStr)
|
||||||
{
|
{
|
||||||
if (szOut[0])
|
if (szOut[0])
|
||||||
WideCharToMultiByte(cp, 0, szOut, -1, lpStr, cchOut, 0, 0);
|
WideCharToMultiByte(cp, 0, szOut, iRet ? -1 : cchOut, lpStr, cchOut, 0, 0);
|
||||||
else if (cchOut && iRet)
|
else if (cchOut && iRet)
|
||||||
*lpStr = '\0';
|
*lpStr = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1361,9 +1361,9 @@ INT WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer,
|
||||||
retW = GetPrivateProfileSectionW(sectionW.Buffer, bufferW, len, filenameW.Buffer);
|
retW = GetPrivateProfileSectionW(sectionW.Buffer, bufferW, len, filenameW.Buffer);
|
||||||
if (len > 2)
|
if (len > 2)
|
||||||
{
|
{
|
||||||
ret = WideCharToMultiByte(CP_ACP, 0, bufferW, retW + 2, buffer, len, NULL, NULL);
|
ret = WideCharToMultiByte(CP_ACP, 0, bufferW, retW + 1, buffer, len, NULL, NULL);
|
||||||
if (ret > 2)
|
if (ret > 2)
|
||||||
ret -= 2;
|
ret -= 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
@ -266,12 +266,12 @@ static void test_RtlGetFullPathName_U(void)
|
||||||
pRtlMultiByteToUnicodeN(pathbufW , sizeof(pathbufW), NULL, test->path, strlen(test->path)+1 );
|
pRtlMultiByteToUnicodeN(pathbufW , sizeof(pathbufW), NULL, test->path, strlen(test->path)+1 );
|
||||||
ret = pRtlGetFullPathName_U( pathbufW,MAX_PATH, rbufferW, &file_part);
|
ret = pRtlGetFullPathName_U( pathbufW,MAX_PATH, rbufferW, &file_part);
|
||||||
ok( ret == len, "Wrong result %ld/%d for \"%s\"\n", ret, len, test->path );
|
ok( ret == len, "Wrong result %ld/%d for \"%s\"\n", ret, len, test->path );
|
||||||
ok(pRtlUnicodeToMultiByteN(rbufferA,MAX_PATH,&reslen,rbufferW,MAX_PATH) == STATUS_SUCCESS,
|
ok(pRtlUnicodeToMultiByteN(rbufferA,MAX_PATH,&reslen,rbufferW,(lstrlenW(rbufferW) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
|
||||||
"RtlUnicodeToMultiByteN failed\n");
|
"RtlUnicodeToMultiByteN failed\n");
|
||||||
ok(lstrcmpiA(rbufferA,test->rname) == 0, "Got \"%s\" expected \"%s\"\n",rbufferA,test->rname);
|
ok(lstrcmpiA(rbufferA,test->rname) == 0, "Got \"%s\" expected \"%s\"\n",rbufferA,test->rname);
|
||||||
if (file_part)
|
if (file_part)
|
||||||
{
|
{
|
||||||
ok(pRtlUnicodeToMultiByteN(rfileA,MAX_PATH,&reslen,file_part,MAX_PATH) == STATUS_SUCCESS,
|
ok(pRtlUnicodeToMultiByteN(rfileA,MAX_PATH,&reslen,file_part,(lstrlenW(file_part) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
|
||||||
"RtlUnicodeToMultiByteN failed\n");
|
"RtlUnicodeToMultiByteN failed\n");
|
||||||
ok(test->rfile && !lstrcmpiA(rfileA,test->rfile), "Got \"%s\" expected \"%s\"\n",rfileA,test->rfile);
|
ok(test->rfile && !lstrcmpiA(rfileA,test->rfile), "Got \"%s\" expected \"%s\"\n",rfileA,test->rfile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,6 @@ static void test_NtCreateKey(void)
|
||||||
{
|
{
|
||||||
/*Create WineTest*/
|
/*Create WineTest*/
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
UNICODE_STRING ValName;
|
|
||||||
HKEY key;
|
HKEY key;
|
||||||
ACCESS_MASK am = GENERIC_ALL;
|
ACCESS_MASK am = GENERIC_ALL;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
@ -303,7 +302,6 @@ static void test_NtCreateKey(void)
|
||||||
status = pNtCreateKey(&key, am, &attr, 0, 0, 0, 0);
|
status = pNtCreateKey(&key, am, &attr, 0, 0, 0, 0);
|
||||||
ok(status == STATUS_SUCCESS, "NtCreateKey Failed: 0x%08lx\n", status);
|
ok(status == STATUS_SUCCESS, "NtCreateKey Failed: 0x%08lx\n", status);
|
||||||
|
|
||||||
pRtlFreeUnicodeString(&ValName);
|
|
||||||
pNtClose(&key);
|
pNtClose(&key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ static const char *default_dbgstr_an( const char *str, int n )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dst++ = '"';
|
*dst++ = '"';
|
||||||
if (*str)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
|
@ -352,7 +352,7 @@ static const char *default_dbgstr_wn( const WCHAR *str, int n )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dst++ = '"';
|
*dst++ = '"';
|
||||||
if (*str)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
|
|
Loading…
Reference in New Issue