Skip to content

update sprintf to convert int/float if wrong type passed#991

Merged
thefallentree merged 1 commit intofluffos:masterfrom
michaelprograms:sprintf
Aug 18, 2023
Merged

update sprintf to convert int/float if wrong type passed#991
thefallentree merged 1 commit intofluffos:masterfrom
michaelprograms:sprintf

Conversation

@michaelprograms
Copy link
Copy Markdown
Contributor

@michaelprograms michaelprograms commented Jul 15, 2023

Changes:

  • convert a T_REAL to a T_NUMBER for %d flag
  • convert a T_NUMBER to a T_REAL for %f flag
  • expand testing in testsuite/single/tests/efuns/sprintf.c
  • remove RETURN_ERROR_MESSAGES check which does not appear to exist anywhere else in the code base

The following conditions will no longer error:

sprintf("%f", UNDEFINED)    // 0.000000
sprintf("%f", 0)            // 0.000000
sprintf("%d", 123.0)        // 123
sprintf("%d", 123.123)      // 123
sprintf("%f", 123)          // 123.000000

@thefallentree thefallentree merged commit 2b4b060 into fluffos:master Aug 18, 2023
@michaelprograms michaelprograms deleted the sprintf branch August 28, 2023 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants