Skip to content

chore: fix compilation warnings#148

Merged
dilawar merged 7 commits intossandrews:masterfrom
dilawar:chore/remove-compilation-warnings
Nov 18, 2025
Merged

chore: fix compilation warnings#148
dilawar merged 7 commits intossandrews:masterfrom
dilawar:chore/remove-compilation-warnings

Conversation

@dilawar
Copy link
Collaborator

@dilawar dilawar commented Nov 18, 2025

Removes various compilation warnings.

TODO:

  • Fix windows build

@dilawar dilawar changed the title chore: compilation warnings chore: fix compilation warnings Nov 18, 2025
@dilawar dilawar requested a review from ssandrews November 18, 2025 12:49
simptr sim;
int i,er,pflag,wflag,tflag,Vflag,oflag;
char root[STRCHARLONG],fname[STRCHARLONG],flags[STRCHARLONG],*cptr,logfile[STRCHARLONG];
char root[STRCHARLONG],fname[STRCHARLONG],flags[STRCHARLONG+100],*cptr,logfile[STRCHARLONG];
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocate a bit more to avoid potential overflow.

#define CHECKM(A,...) if(!(A) || strmatherror(ErrorMath,1)) {ErrorType=2;snprintf(strcat(ErrorString,ErrorMath),STRCHARLONG,__VA_ARGS__); goto failure;} else (void)0
#define CHECKBUG(A,...) if(!(A)) {ErrorType=4;snprintf(ErrorString,STRCHARLONG,__VA_ARGS__); goto failure;} else (void)0
// snprintf may truncate output. We abort in case of output truncation.
#define CHECKS(A,...) if(!(A)) {ErrorType=2;snprintf(ErrorString,STRCHARLONG,__VA_ARGS__) < 0 ? abort() : (void)0; goto failure;} else (void)0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snprintf can potentially truncate, hence the check. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 has some relevant discussion.

filtype->shiny=0;
filtype->drawforcescale=0;
filtype->drawforcecolor[0]=filtype->drawforcecolor[0]=filtype->drawforcecolor[0]=0;
filtype->drawforcecolor[0]=filtype->drawforcecolor[1]=filtype->drawforcecolor[2]=0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was a mistake in original code.

@dilawar dilawar marked this pull request as draft November 18, 2025 12:54
@dilawar dilawar removed the request for review from ssandrews November 18, 2025 12:54
On Windows, c++17 causing conflict with std::byte
@dilawar dilawar marked this pull request as ready for review November 18, 2025 13:42
@dilawar dilawar requested a review from ssandrews November 18, 2025 13:42
@dilawar dilawar self-assigned this Nov 18, 2025
@dilawar dilawar added the chore label Nov 18, 2025
@dilawar dilawar merged commit fa17279 into ssandrews:master Nov 18, 2025
13 checks passed
@dilawar dilawar deleted the chore/remove-compilation-warnings branch November 18, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant