Skip to content

Update fitscore to use _strtoui64 on windows#142

Open
cruzzil wants to merge 2 commits into
heasarc:developfrom
cruzzil:windows_fix_fitscore
Open

Update fitscore to use _strtoui64 on windows#142
cruzzil wants to merge 2 commits into
heasarc:developfrom
cruzzil:windows_fix_fitscore

Conversation

@cruzzil

@cruzzil cruzzil commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

_strtoui64 was available since MSVC 6.0 and looks like it is the logical choice. Shout if you think this is wrong.

Comment thread fitscore.c Outdated
Comment thread fitscore.c Outdated
if (*loc == '+') loc++; /* skip plus sign */
while (isdigit(*loc)) loc++; /* skip digits */

/* Microsoft Visual C++ does not have the strtoull function, but it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why did you change "strtoll" to "strtoull" in the comment here?

Comment thread fitscore.c Outdated
provides _strtoui64, the unsigned 64-bit string conversion. This
correctly handles values above LLONG_MAX (unlike _atoi64) and sets
errno to ERANGE on overflow. */
*ival = _strtoui64(cval, &loc, 10);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't ⁠_strtoi64⁠ be the more appropriate function? Google says it was introduced all the way back in Microsoft Visual C++ 4.2 (released in 1996), and ffc2jj purports to "convert null-terminated formatted string to an [sic] long long integer value." So I think we want a long long, not an unsigned long long.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good spot, i pasted it in the wrong place. I've added a commit which fixes the call and also updates the following function which was the one I was trying to do!

@esabol esabol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, latest commit looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants