From 1868a10f8b06631362618bfc85ca8646da4b4b71 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 29 Aug 2017 12:27:59 -0400 Subject: Replace all atoi calls with QUtil::string_to_int The latter catches underflow/overflow. --- libtests/dct_compress.cc | 4 ++-- libtests/png_filter.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'libtests') diff --git a/libtests/dct_compress.cc b/libtests/dct_compress.cc index e2ed7adf..65539582 100644 --- a/libtests/dct_compress.cc +++ b/libtests/dct_compress.cc @@ -42,8 +42,8 @@ int main(int argc, char* argv[]) char* infilename = argv[1]; char* outfilename = argv[2]; - unsigned int width = atoi(argv[3]); - unsigned int height = atoi(argv[4]); + int width = QUtil::string_to_int(argv[3]); + int height = QUtil::string_to_int(argv[4]); char* colorspace = argv[5]; J_COLOR_SPACE cs = ((strcmp(colorspace, "rgb") == 0) ? JCS_RGB : diff --git a/libtests/png_filter.cc b/libtests/png_filter.cc index c3d4f646..2caf99fb 100644 --- a/libtests/png_filter.cc +++ b/libtests/png_filter.cc @@ -61,7 +61,7 @@ int main(int argc, char* argv[]) } bool encode = (strcmp(argv[1], "encode") == 0); char* filename = argv[2]; - int columns = atoi(argv[3]); + int columns = QUtil::string_to_int(argv[3]); try { -- cgit v1.2.3-54-g00ecf