[PATCH 3/3] kernel32/tests: Add a test for opening short paths of differing case.
wine-devel at kievinfo.com
Wed Oct 27 22:21:28 CDT 2010
On 10/27/2010 07:46 PM, Charles Davis wrote:
> + sprintf(buf,"%s\\%s\\%s",tmpdir,dirname,filename);
Could you please put some spaces after each coma everywhere in your patch?
Please use snprintf().
> + GetShortPathNameA(buf,shortbuf,MAX_PATH);
Use sizeof(buf) instead of MAX_PATH to guarantee that's what it means.
> + hndl = CreateFileA(shortbuf,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
> + ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n");
It's nice to know LastError and the full filename if it fails.
> + for(i=0;i<MAX_PATH&& shortbuf[i];i++)
You getting past the filename size in the buffer.
> + shortbuf[i]=(rand() % 2) ? tolower(shortbuf[i]) : toupper(shortbuf[i]);
Please don't use any sort of random stuff in tests. They should always be
the same every time on every platform.
> + /* Now try it on mixed case short names */
What's the point of the test anyway? You know that Wine already handles all
files as case-insensitive. Short file name isn't any different.
More information about the wine-devel