Commit ecd35a02 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

kernel32: Cast-qual warnings fix.

parent 8125231e
...@@ -1073,7 +1073,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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);
......
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