mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 05:45:00 +02:00
Fix crash on opening file with wild card characters
And redefining Sci_PositionCR to 64 bits on x64 build for managing 2GB+ files. (ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/11047#issuecomment-1021540298) Fix #11098
This commit is contained in:
parent
44004d41d4
commit
db3308329b
@ -643,16 +643,22 @@ void FileManager::closeBuffer(BufferID id, ScintillaEditView * identifier)
|
||||
BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding, const TCHAR* backupFileName, FILETIME fileNameTimestamp)
|
||||
{
|
||||
//Get file size
|
||||
int64_t fileSize = -1;
|
||||
const TCHAR* pPath = filename;
|
||||
if (!::PathFileExists(pPath))
|
||||
{
|
||||
pPath = backupFileName;
|
||||
FILE* fp = generic_fopen(pPath, TEXT("rb"));
|
||||
if (!fp)
|
||||
return BUFFER_INVALID;
|
||||
|
||||
_fseeki64(fp, 0, SEEK_END);
|
||||
int64_t fileSize = _ftelli64(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
if (pPath)
|
||||
{
|
||||
FILE* fp = generic_fopen(pPath, TEXT("rb"));
|
||||
if (fp)
|
||||
{
|
||||
_fseeki64(fp, 0, SEEK_END);
|
||||
fileSize = _ftelli64(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
// * the auto-completion feature will be disabled for large files
|
||||
// * the session snapshotsand periodic backups feature will be disabled for large files
|
||||
|
@ -20,7 +20,7 @@ typedef size_t Sci_PositionU;
|
||||
|
||||
|
||||
// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
|
||||
typedef long Sci_PositionCR;
|
||||
typedef intptr_t Sci_PositionCR;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SCI_METHOD __stdcall
|
||||
|
Loading…
x
Reference in New Issue
Block a user