From 24503eba59e2a1bd5788ade6e5368553e9ff84ec Mon Sep 17 00:00:00 2001 From: tomascz Date: Fri, 16 Feb 2024 09:48:07 +0100 Subject: [PATCH] [#78] Filenames must internally be represented in Unicode (Part 16: Cumulative fixes) --- Main/src/Dos_PathString.cpp | 2 +- Main/src/KryoFluxStreams.cpp | 2 +- Main/src/SpectrumBase.cpp | 6 +++--- Main/src/Utils.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Main/src/Dos_PathString.cpp b/Main/src/Dos_PathString.cpp index 487e90b3..d241c413 100644 --- a/Main/src/Dos_PathString.cpp +++ b/Main/src/Dos_PathString.cpp @@ -306,7 +306,7 @@ *u++=c; else if (*term=='%') // the "%%" sequence to express the '%' character *u++=c, term++; - else if (_stscanf(term,_T("%02x"),&tmp)) // a valid "%NN" escape sequence + else if (_stscanf(term,_T("%02x"),&tmp)>0) // a valid "%NN" escape sequence *u++=tmp, term+=2; else // an invalid "%NN" escape sequence break; diff --git a/Main/src/KryoFluxStreams.cpp b/Main/src/KryoFluxStreams.cpp index ce473d9c..21cb5236 100644 --- a/Main/src/KryoFluxStreams.cpp +++ b/Main/src/KryoFluxStreams.cpp @@ -55,7 +55,7 @@ && ( _stscanf( trackIdentifier, TRACK_NAME_PATTERN, &cyl, &head )==2 && cyl0 // ... or at least partially specified? ) && '0'<=head && head<='1' diff --git a/Main/src/SpectrumBase.cpp b/Main/src/SpectrumBase.cpp index 7d9ccb05..78fb64c7 100644 --- a/Main/src/SpectrumBase.cpp +++ b/Main/src/SpectrumBase.cpp @@ -172,9 +172,9 @@ int CSpectrumBase::__importFileInformation__(LPCTSTR buf,TUniFileType &rUniFileType){ // returns the number of characters recognized as import information normalized form (supplied by ExportFileInformation) rUniFileType=TUniFileType::UNKNOWN; // initialization - if (buf){ // Null if File has no import information + if (buf && *buf){ // Null if File has no import information int n=0; - if (const int i=_stscanf( buf, INFO_UNI _T("%n"), &rUniFileType, &n )) + if (_stscanf( buf, INFO_UNI _T("%n"), &rUniFileType, &n )>0) return n; } return 0; @@ -196,7 +196,7 @@ rDataFlag=TZxRom::TStdBlockFlag::DATA; // assumption (block featuring Header has been saved using standard routine in ROM) if (const int N=__importFileInformation__( buf, rUniFileType, rParams, rFileLength )){ // Null if File has no import information int n=0,tmp=rDataFlag; - if (_stscanf( buf+N, INFO_FLAG _T("%n"), &tmp, &n )){ + if (_stscanf( buf+N, INFO_FLAG _T("%n"), &tmp, &n )>0){ rDataFlag=tmp; return N+n; } diff --git a/Main/src/Utils.cpp b/Main/src/Utils.cpp index 75db69cd..5d6274e5 100644 --- a/Main/src/Utils.cpp +++ b/Main/src/Utils.cpp @@ -1720,7 +1720,7 @@ namespace Utils{ } range={}; for( const TCHAR *p=buf; p