Commit 8a46494e authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Don't use an invalid file handle. In this case invalid file handle

means that the file hasn't yet been created. - Only call GetFileTime when we are being logged for a tiny performance improvement. - Reindent to 4 spaces.
parent fbcc21be
...@@ -774,26 +774,35 @@ static BOOL PROFILE_Open( LPCWSTR filename ) ...@@ -774,26 +774,35 @@ static BOOL PROFILE_Open( LPCWSTR filename )
for(i=0;i<N_CACHED_PROFILES;i++) for(i=0;i<N_CACHED_PROFILES;i++)
{ {
if ((MRUProfile[i]->filename && !strcmpiW( buffer, MRUProfile[i]->filename ))) if ((MRUProfile[i]->filename && !strcmpiW( buffer, MRUProfile[i]->filename )))
{ {
TRACE("MRU Filename: %s, new filename: %s\n", debugstr_w(MRUProfile[i]->filename), debugstr_w(buffer)); TRACE("MRU Filename: %s, new filename: %s\n", debugstr_w(MRUProfile[i]->filename), debugstr_w(buffer));
if(i) if(i)
{ {
PROFILE_FlushFile(); PROFILE_FlushFile();
tempProfile=MRUProfile[i]; tempProfile=MRUProfile[i];
for(j=i;j>0;j--) for(j=i;j>0;j--)
MRUProfile[j]=MRUProfile[j-1]; MRUProfile[j]=MRUProfile[j-1];
CurProfile=tempProfile; CurProfile=tempProfile;
} }
GetFileTime(hFile, NULL, NULL, &LastWriteTime);
if(memcmp(&CurProfile->LastWriteTime, &LastWriteTime, sizeof(FILETIME))) if (hFile != INVALID_HANDLE_VALUE)
TRACE("(%s): already opened (mru=%d)\n", {
debugstr_w(buffer), i ); if (TRACE_ON(profile))
else {
TRACE("(%s): already opened, needs refreshing (mru=%d)\n", GetFileTime(hFile, NULL, NULL, &LastWriteTime);
debugstr_w(buffer), i ); if (memcmp(&CurProfile->LastWriteTime, &LastWriteTime, sizeof(FILETIME)))
CloseHandle(hFile); TRACE("(%s): already opened (mru=%d)\n",
return TRUE; debugstr_w(buffer), i);
else
TRACE("(%s): already opened, needs refreshing (mru=%d)\n",
debugstr_w(buffer), i);
}
CloseHandle(hFile);
}
else TRACE("(%s): already opened, not yet created (mru=%d)\n",
debugstr_w(buffer), i);
return TRUE;
} }
} }
......
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