Skip to content

Commit

Permalink
latest from CODA-OSS
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Nov 15, 2023
1 parent d1e1405 commit 93670e7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
7 changes: 5 additions & 2 deletions externals/coda-oss/modules/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ set(TARGET_LANGUAGE c++)
if (MSVC)
# By default, there is a /W3 on the command-line from somewhere (?); adding
# /Wn results in a compiler warning.
#add_compile_options(/W4) # /Wall
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # /Wall
#
# https://github.com/microsoft/STL/wiki/Changelog#vs-2022-179-preview-1
# > *Note*: `/Wall` is not intended for regular production use, as it contains a large number of
# > extremely noisy and low-value warnings. In general, the STL does not attempt to be `/Wall` clean.
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # add_compile_options(/W4)

elseif (UNIX)
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
Expand Down
4 changes: 2 additions & 2 deletions externals/coda-oss/modules/c++/coda-oss.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1</PreprocessorDefinitions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
Expand Down Expand Up @@ -593,7 +593,6 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
Expand All @@ -609,6 +608,7 @@
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 2 additions & 1 deletion externals/coda-oss/modules/c++/str/include/str/Convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ std::string toString_(const T& value)
return buf.str();
}
template <typename T>
inline auto toString(const T& value)
inline std::string toString(const T& value)
{
return toString_(value);
}
Expand Down Expand Up @@ -105,6 +105,7 @@ inline auto toString(long double value)
{
return toString_(value);
}

inline std::string toString(uint8_t value)
{
return toString(gsl::narrow<unsigned int>(value));
Expand Down
21 changes: 7 additions & 14 deletions externals/coda-oss/modules/c++/str/source/Convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,25 @@ template<> std::string str::toType<std::string>(const std::string& s)

template<> bool str::toType<bool>(const std::string& s)
{
std::string ss = s;
str::lower(ss);

if (ss == "true")
if (eq(s, "true")) // case-insensitive compare
{
return true;
}
else if (ss == "false")
if (eq(s, "false")) // case-insensitive compare
{
return false;
}
else if (str::isNumeric(ss))

// no need for lower(), digits don't have case
if (str::isNumeric(s))
{
int value(0);
std::stringstream buf(ss);
std::stringstream buf(s);
buf >> value;
return (value != 0);
}
else
{
throw except::BadCastException(except::Context(__FILE__, __LINE__,
std::string(""), std::string(""),
std::string("Invalid bool: '") + s + std::string("'")));
}

return false;
throw except::BadCastException(except::Context(__FILE__, __LINE__, "", "", "Invalid bool: '" + s + "'"));
}

long long str::strtoll(const char *str, char **endptr, int base)
Expand Down

0 comments on commit 93670e7

Please sign in to comment.