Optiroc / SuperFamiconv

Flexible and composable tile graphics converter supporting Super Nintendo, Game Boy, Game Boy Color, Game Boy Advance, Mega Drive, PC Engine and WonderSwan formats.
MIT License
143 stars 20 forks source link

`-T` (at least) supports only base 10 & silently rejects malformed numbers #19

Open ISSOtm opened 4 years ago

ISSOtm commented 4 years ago

superfamiconv map -T 0x80 apparently treats the argument as 0, silently discarding the x80 part. I didn't check with other options.

C stdlib has strtoul which handles this correctly with a base of 0, and error checking is possible by checking the returned pointer. (Example.) I don't know if there's a C++ way of doing that, though.

Rangi42 commented 2 years ago

strtoul works fine in C++ too. It also offers std::stoi but that throws an exception on failure.