[OS/2] Bug 395576: extension of downloaded files are upper-cased sometimes, r=mkaply

This commit is contained in:
mozilla@weilbacher.org 2007-09-16 13:46:35 -07:00
parent 9fd0466271
commit 55274c8da2

View File

@ -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 ||