From e837f99afbbe458e261a80eacc8a34d4edc0cb9e Mon Sep 17 00:00:00 2001 From: Andrew Woloszyn Date: Fri, 10 Jul 2015 16:11:00 -0400 Subject: [PATCH] Removed the single usage of exceptions in all of glslang. --- StandAlone/spirv-remap.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/StandAlone/spirv-remap.cpp b/StandAlone/spirv-remap.cpp index 301256fc..2091feb1 100644 --- a/StandAlone/spirv-remap.cpp +++ b/StandAlone/spirv-remap.cpp @@ -213,10 +213,15 @@ namespace { verbosity = 1; if (a < argc) { - try { - verbosity = std::stoi(argv[a]); + char* end_ptr = 0; + int verb = ::strtol(argv[a], &end_ptr, 10); + // If we have not read to the end of the string or + // the string contained no elements, then we do not want to + // store the value. + if (*end_ptr == '\0' && end_ptr != argv[a]) { + verbosity = verb; ++a; - } catch (const std::invalid_argument&) { } // ok to have no numeric value + } } } else if (arg == "--version" || arg == "-V") {