Commit e725ea308468ab50751ba7f930842a4c061226e9
1 parent
d47101a1
Use unsigned type for integer digit
Fixes #109. Although we always used numbers in the ASCII range, it was in a `size_t`, leading to a warning about possible loss of data on some compilers.
Showing
2 changed files
with
5 additions
and
1 deletions
CHANGELOG.md
| @@ -9,6 +9,10 @@ options. The project adheres to semantic versioning. | @@ -9,6 +9,10 @@ options. The project adheres to semantic versioning. | ||
| 9 | 9 | ||
| 10 | * Allow integers to have leading zeroes. | 10 | * Allow integers to have leading zeroes. |
| 11 | 11 | ||
| 12 | +### Bug Fixes | ||
| 13 | + | ||
| 14 | +* Fix a warning about possible loss of data. | ||
| 15 | + | ||
| 12 | ## 2.1.1 | 16 | ## 2.1.1 |
| 13 | 17 | ||
| 14 | ### Bug Fixes | 18 | ### Bug Fixes |
include/cxxopts.hpp
| @@ -547,7 +547,7 @@ namespace cxxopts | @@ -547,7 +547,7 @@ namespace cxxopts | ||
| 547 | 547 | ||
| 548 | for (auto iter = value_match.first; iter != value_match.second; ++iter) | 548 | for (auto iter = value_match.first; iter != value_match.second; ++iter) |
| 549 | { | 549 | { |
| 550 | - size_t digit = 0; | 550 | + US digit = 0; |
| 551 | 551 | ||
| 552 | if (*iter >= '0' && *iter <= '9') | 552 | if (*iter >= '0' && *iter <= '9') |
| 553 | { | 553 | { |