Skip to content

Commit

Permalink
[#78] Filenames must internally be represented in Unicode (Part 16: C…
Browse files Browse the repository at this point in the history
…umulative fixes)
  • Loading branch information
tomas-nestorovic committed Feb 16, 2024
1 parent f358c97 commit 24503eb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Main/src/Dos_PathString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Main/src/KryoFluxStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
&&
( _stscanf( trackIdentifier, TRACK_NAME_PATTERN, &cyl, &head )==2 && cyl<FDD_CYLINDERS_MAX // is the Track name fully ...
||
_stscanf( trackIdentifier+=2, TRACK_NAME_PATTERN_EXT, &head ) // ... or at least partially specified?
_stscanf( trackIdentifier+=2, TRACK_NAME_PATTERN_EXT, &head )>0 // ... or at least partially specified?
)
&&
'0'<=head && head<='1'
Expand Down
6 changes: 3 additions & 3 deletions Main/src/SpectrumBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Main/src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ namespace Utils{
} range={};
for( const TCHAR *p=buf; p<pEnd; p++ ){
int i,n;
if (!_stscanf( p, _T("%d%n"), &i, &n ))
if (_stscanf( p, _T("%d%n"), &i, &n )<=0)
return false; // invalid or no number
if (!limits.Contains(i))
return false; // out of Limits
Expand Down

0 comments on commit 24503eb

Please sign in to comment.