mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-24 06:14:47 +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)
|
BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding, const TCHAR* backupFileName, FILETIME fileNameTimestamp)
|
||||||
{
|
{
|
||||||
//Get file size
|
//Get file size
|
||||||
|
int64_t fileSize = -1;
|
||||||
const TCHAR* pPath = filename;
|
const TCHAR* pPath = filename;
|
||||||
if (!::PathFileExists(pPath))
|
if (!::PathFileExists(pPath))
|
||||||
|
{
|
||||||
pPath = backupFileName;
|
pPath = backupFileName;
|
||||||
FILE* fp = generic_fopen(pPath, TEXT("rb"));
|
}
|
||||||
if (!fp)
|
if (pPath)
|
||||||
return BUFFER_INVALID;
|
{
|
||||||
|
FILE* fp = generic_fopen(pPath, TEXT("rb"));
|
||||||
_fseeki64(fp, 0, SEEK_END);
|
if (fp)
|
||||||
int64_t fileSize = _ftelli64(fp);
|
{
|
||||||
fclose(fp);
|
_fseeki64(fp, 0, SEEK_END);
|
||||||
|
fileSize = _ftelli64(fp);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// * the auto-completion feature will be disabled for large files
|
// * the auto-completion feature will be disabled for large files
|
||||||
// * the session snapshotsand periodic backups 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
|
// 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
|
#ifdef _WIN32
|
||||||
#define SCI_METHOD __stdcall
|
#define SCI_METHOD __stdcall
|
||||||
|
Loading…
x
Reference in New Issue
Block a user