kernel32: Cast-qual warnings fix.

This commit is contained in:
Andrew Talbot 2006-10-31 22:11:08 +00:00 committed by Alexandre Julliard
parent 8125231e49
commit ecd35a0267

View File

@ -1073,7 +1073,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
BOOL win32 ) BOOL win32 )
{ {
int ret; int ret;
LPCWSTR pDefVal = NULL; LPWSTR defval_tmp = NULL;
TRACE("%s,%s,%s,%p,%u,%s\n", debugstr_w(section), debugstr_w(entry), TRACE("%s,%s,%s,%p,%u,%s\n", debugstr_w(section), debugstr_w(entry),
debugstr_w(def_val), buffer, len, debugstr_w(filename)); debugstr_w(def_val), buffer, len, debugstr_w(filename));
@ -1092,16 +1092,13 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
if (*p == ' ') /* ouch, contained trailing ' ' */ if (*p == ' ') /* ouch, contained trailing ' ' */
{ {
int len = (int)(p - def_val); int len = (int)(p - def_val);
LPWSTR p;
p = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); defval_tmp = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
memcpy(p, def_val, len * sizeof(WCHAR)); memcpy(defval_tmp, def_val, len * sizeof(WCHAR));
p[len] = '\0'; defval_tmp[len] = '\0';
pDefVal = p; def_val = defval_tmp;
} }
} }
if (!pDefVal)
pDefVal = def_val;
RtlEnterCriticalSection( &PROFILE_CritSect ); RtlEnterCriticalSection( &PROFILE_CritSect );
@ -1110,9 +1107,9 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
ret = PROFILE_GetSectionNames(buffer, len); ret = PROFILE_GetSectionNames(buffer, len);
else else
/* PROFILE_GetString can handle the 'entry == NULL' case */ /* PROFILE_GetString can handle the 'entry == NULL' case */
ret = PROFILE_GetString( section, entry, pDefVal, buffer, len, win32 ); ret = PROFILE_GetString( section, entry, def_val, buffer, len, win32 );
} else if (buffer && pDefVal) { } else if (buffer && def_val) {
lstrcpynW( buffer, pDefVal, len ); lstrcpynW( buffer, def_val, len );
ret = strlenW( buffer ); ret = strlenW( buffer );
} }
else else
@ -1120,8 +1117,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
RtlLeaveCriticalSection( &PROFILE_CritSect ); RtlLeaveCriticalSection( &PROFILE_CritSect );
if (pDefVal != def_val) /* allocated */ HeapFree(GetProcessHeap(), 0, defval_tmp);
HeapFree(GetProcessHeap(), 0, (void*)pDefVal);
TRACE("returning %s, %d\n", debugstr_w(buffer), ret); TRACE("returning %s, %d\n", debugstr_w(buffer), ret);