Skip to content

Commit 317c4a1

Browse files
committed
c++: atoi() -> std::stoi() (throws if string cant' be converted)
1 parent 934f0f2 commit 317c4a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

example/ZXingReader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ static bool ParseOptions(int argc, char* argv[], ReaderOptions& options, CLI& cl
144144
} else if (is("-channels")) {
145145
if (++i == argc)
146146
return false;
147-
cli.forceChannels = atoi(argv[i]);
147+
cli.forceChannels = std::stoi(argv[i]);
148148
} else if (is("-rotate")) {
149149
if (++i == argc)
150150
return false;
151-
cli.rotate = atoi(argv[i]);
151+
cli.rotate = std::stoi(argv[i]);
152152
} else if (is("-help") || is("--help")) {
153153
PrintUsage(argv[0]);
154154
exit(0);

test/blackbox/TestReaderMain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using namespace ZXing::Test;
2121
int getEnv(const char* name, int fallback = 0)
2222
{
2323
auto var = getenv(name);
24-
return var ? atoi(var) : fallback;
24+
return var ? std::stoi(var) : fallback;
2525
}
2626

2727
int main(int argc, char** argv)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy