mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-15 11:13:29 +00:00
[OS/2] Bug 395576: extension of downloaded files are upper-cased sometimes, r=mkaply
This commit is contained in:
parent
9fd0466271
commit
55274c8da2
@ -2164,20 +2164,17 @@ nsLocalFile::IsExecutable(PRBool *_retval)
|
||||
if (pathEnd == leaf)
|
||||
return NS_OK;
|
||||
|
||||
// get the extension, including the dot
|
||||
char* ext = (char*) _mbsrchr((const unsigned char*)leaf, '.');
|
||||
if (!ext)
|
||||
return NS_OK;
|
||||
// get the extension, including the dot, max. of 4 chars for comparison
|
||||
// (copy the extension so that the original filename stays untouched)
|
||||
char ext[5];
|
||||
strncpy(ext, (char*) _mbsrchr((const unsigned char*)leaf, '.'), 4);
|
||||
ext[4] = '\0'; // ensure trailing nullbyte
|
||||
|
||||
// upper-case the extension, then see if it claims to be an executable
|
||||
#ifdef MOZ_OS2_HIGH_MEMORY
|
||||
// WinUpper() cannot be used because it crashes with high memory.
|
||||
// strupr() does not take into account non-ASCII characters but this is
|
||||
// irrelevant for the possible extensions below
|
||||
strupr(ext);
|
||||
#else
|
||||
WinUpper(0, 0, 0, ext);
|
||||
#endif
|
||||
if (strcmp(ext, ".EXE") == 0 ||
|
||||
strcmp(ext, ".CMD") == 0 ||
|
||||
strcmp(ext, ".COM") == 0 ||
|
||||
|
Loading…
Reference in New Issue
Block a user