mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-29 22:30:04 +00:00
Fixing warnings in wxdata
This commit is contained in:
parent
05d795d18f
commit
3339a40780
17 changed files with 36 additions and 43 deletions
|
|
@ -3,7 +3,9 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#pragma warning(push, 0)
|
||||
#include <spdlog/logger.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace scwx
|
|||
namespace util
|
||||
{
|
||||
|
||||
std::chrono::system_clock::time_point TimePoint(uint16_t modifiedJulianDate,
|
||||
std::chrono::system_clock::time_point TimePoint(uint32_t modifiedJulianDate,
|
||||
uint32_t milliseconds);
|
||||
|
||||
std::string TimeString(std::chrono::system_clock::time_point time,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo)
|
|||
};
|
||||
|
||||
bool dataValid = true;
|
||||
LocationFormat format;
|
||||
LocationFormat format {};
|
||||
|
||||
std::vector<std::string> tokenList;
|
||||
|
||||
|
|
|
|||
|
|
@ -306,17 +306,17 @@ ParseColor(const std::vector<std::string>& tokenList,
|
|||
template<typename T>
|
||||
T RoundChannel(double value)
|
||||
{
|
||||
return std::clamp<int>(std::lround(value),
|
||||
std::numeric_limits<T>::min(),
|
||||
std::numeric_limits<T>::max());
|
||||
return static_cast<T>(std::clamp<int>(std::lround(value),
|
||||
std::numeric_limits<T>::min(),
|
||||
std::numeric_limits<T>::max()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T StringToDecimal(const std::string& str)
|
||||
{
|
||||
return std::clamp<int>(std::stoi(str),
|
||||
std::numeric_limits<T>::min(),
|
||||
std::numeric_limits<T>::max());
|
||||
return static_cast<T>(std::clamp<int>(std::stoi(str),
|
||||
std::numeric_limits<T>::min(),
|
||||
std::numeric_limits<T>::max()));
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ static const std::unordered_map<Level3ProductCategory, std::string>
|
|||
{Level3ProductCategory::SpecificDifferentialPhase, "N0K"},
|
||||
{Level3ProductCategory::CorrelationCoefficient, "N0C"}};
|
||||
|
||||
static const std::unordered_map<int16_t, std::string> level3Palette_ {
|
||||
static const std::unordered_map<int, std::string> level3Palette_ {
|
||||
{19, "BR"}, {20, "BR"}, {27, "BV"}, {30, "SW"},
|
||||
{31, "STPIN"}, {32, "BR"}, {37, "BR"}, {38, "BR"},
|
||||
{41, "ET"}, {50, "BR"}, {51, "BV"}, {56, "SRV"},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace scwx
|
|||
namespace util
|
||||
{
|
||||
|
||||
std::chrono::system_clock::time_point TimePoint(uint16_t modifiedJulianDate,
|
||||
std::chrono::system_clock::time_point TimePoint(uint32_t modifiedJulianDate,
|
||||
uint32_t milliseconds)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
|
|
|
|||
|
|
@ -112,9 +112,9 @@ std::shared_ptr<const rda::VolumeCoveragePatternData> Ar2vFile::vcp_data() const
|
|||
}
|
||||
|
||||
std::tuple<std::shared_ptr<rda::ElevationScan>, float, std::vector<float>>
|
||||
Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
|
||||
float elevation,
|
||||
std::chrono::system_clock::time_point time) const
|
||||
Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
|
||||
float elevation,
|
||||
std::chrono::system_clock::time_point /*time*/) const
|
||||
{
|
||||
logger_->debug("GetElevationScan: {} degrees", elevation);
|
||||
|
||||
|
|
@ -148,10 +148,10 @@ Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
|
|||
elevationCuts.push_back(scan.first / scaleFactor);
|
||||
}
|
||||
|
||||
uint16_t lowerDelta = std::abs(static_cast<int32_t>(codedElevation) -
|
||||
static_cast<int32_t>(lowerBound));
|
||||
uint16_t upperDelta = std::abs(static_cast<int32_t>(codedElevation) -
|
||||
static_cast<int32_t>(upperBound));
|
||||
int32_t lowerDelta = std::abs(static_cast<int32_t>(codedElevation) -
|
||||
static_cast<int32_t>(lowerBound));
|
||||
int32_t upperDelta = std::abs(static_cast<int32_t>(codedElevation) -
|
||||
static_cast<int32_t>(upperBound));
|
||||
|
||||
if (lowerDelta < upperDelta)
|
||||
{
|
||||
|
|
@ -278,8 +278,8 @@ size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is)
|
|||
}
|
||||
catch (const boost::iostreams::bzip2_error& ex)
|
||||
{
|
||||
int error = ex.error();
|
||||
logger_->warn("Error decompressing record {}", numRecords);
|
||||
logger_->warn(
|
||||
"Error decompressing record {}: {}", numRecords, ex.what());
|
||||
|
||||
is.seekg(startPosition + std::streampos(recordSize),
|
||||
std::ios_base::beg);
|
||||
|
|
|
|||
|
|
@ -139,8 +139,6 @@ bool Level3FileImpl::DecompressFile(std::istream& is, std::stringstream& ss)
|
|||
}
|
||||
catch (const boost::iostreams::zlib_error& ex)
|
||||
{
|
||||
int error = ex.error();
|
||||
|
||||
logger_->warn("Error decompressing data: {}", ex.what());
|
||||
|
||||
dataValid = false;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ typedef std::function<std::shared_ptr<Level2Message>(Level2MessageHeader&&,
|
|||
std::istream&)>
|
||||
CreateLevel2MessageFunction;
|
||||
|
||||
static const std::unordered_map<uint8_t, CreateLevel2MessageFunction> create_ {
|
||||
static const std::unordered_map<unsigned int, CreateLevel2MessageFunction> create_ {
|
||||
{2, RdaStatusData::Create},
|
||||
{3, PerformanceMaintenanceData::Create},
|
||||
{5, VolumeCoveragePatternData::Create},
|
||||
|
|
|
|||
|
|
@ -120,8 +120,6 @@ bool DigitalPrecipitationDataArrayPacket::Parse(std::istream& is)
|
|||
|
||||
for (uint16_t r = 0; r < p->numberOfRows_; r++)
|
||||
{
|
||||
size_t rowBytesRead = 0;
|
||||
|
||||
auto& row = p->row_[r];
|
||||
|
||||
is.read(reinterpret_cast<char*>(&row.numberOfBytes_), 2);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ bool GraphicProductMessage::Parse(std::istream& is)
|
|||
}
|
||||
catch (const boost::iostreams::bzip2_error& ex)
|
||||
{
|
||||
int error = ex.error();
|
||||
logger_->warn("Error decompressing data: {}", ex.what());
|
||||
|
||||
dataValid = false;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ typedef std::function<std::shared_ptr<Level3Message>(Level3MessageHeader&&,
|
|||
std::istream&)>
|
||||
CreateLevel3MessageFunction;
|
||||
|
||||
static const std::unordered_map<int16_t, CreateLevel3MessageFunction> //
|
||||
static const std::unordered_map<int, CreateLevel3MessageFunction> //
|
||||
create_ {{2, GeneralStatusMessage::Create},
|
||||
{19, GraphicProductMessage::Create},
|
||||
{20, GraphicProductMessage::Create},
|
||||
|
|
@ -140,7 +140,6 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is)
|
|||
if (messageValid)
|
||||
{
|
||||
int16_t messageCode = header.message_code();
|
||||
size_t dataSize = header.length_of_message() - Level3MessageHeader::SIZE;
|
||||
|
||||
logger_->debug("Found Message {}", messageCode);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ static const auto logger_ = util::Logger::Create(logPrefix_);
|
|||
typedef std::function<std::shared_ptr<Packet>(std::istream&)>
|
||||
CreateMessageFunction;
|
||||
|
||||
static const std::unordered_map<uint16_t, CreateMessageFunction> create_ {
|
||||
static const std::unordered_map<unsigned int, CreateMessageFunction> create_ {
|
||||
{1, TextAndSpecialSymbolPacket::Create},
|
||||
{2, TextAndSpecialSymbolPacket::Create},
|
||||
{3, MesocycloneSymbolPacket::Create},
|
||||
|
|
|
|||
|
|
@ -117,8 +117,6 @@ bool PrecipitationRateDataArrayPacket::Parse(std::istream& is)
|
|||
|
||||
for (uint16_t r = 0; r < p->numberOfRows_; r++)
|
||||
{
|
||||
size_t rowBytesRead = 0;
|
||||
|
||||
auto& row = p->row_[r];
|
||||
|
||||
is.read(reinterpret_cast<char*>(&row.numberOfBytes_), 2);
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ static const std::string logPrefix_ =
|
|||
"scwx::wsr88d::rpg::product_description_block";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::set<int16_t> compressedProducts_ = {
|
||||
static const std::set<int> compressedProducts_ = {
|
||||
32, 94, 99, 134, 135, 138, 149, 152, 153, 154, 155,
|
||||
159, 161, 163, 165, 167, 168, 170, 172, 173, 174, 175,
|
||||
176, 177, 178, 179, 180, 182, 186, 193, 195, 202};
|
||||
|
||||
static const std::unordered_map<int16_t, uint16_t> rangeMap_ {
|
||||
static const std::unordered_map<int, unsigned int> rangeMap_ {
|
||||
{19, 230}, {20, 460}, {27, 230}, {30, 230}, {31, 230}, {32, 230},
|
||||
{37, 230}, {38, 460}, {41, 230}, {50, 230}, {51, 230}, {56, 230},
|
||||
{57, 230}, {58, 460}, {59, 230}, {61, 230}, {62, 460}, {65, 230},
|
||||
|
|
@ -38,7 +38,7 @@ static const std::unordered_map<int16_t, uint16_t> rangeMap_ {
|
|||
{176, 230}, {177, 230}, {178, 300}, {179, 300}, {180, 89}, {181, 89},
|
||||
{182, 89}, {184, 89}, {186, 412}, {193, 460}, {195, 460}, {196, 50}};
|
||||
|
||||
static const std::unordered_map<int16_t, uint16_t> xResolutionMap_ {
|
||||
static const std::unordered_map<int, unsigned int> xResolutionMap_ {
|
||||
{19, 1000}, {20, 2000}, {27, 1000}, {30, 1000}, {31, 2000}, {32, 1000},
|
||||
{33, 1000}, {34, 1000}, {37, 1000}, {38, 4000}, {41, 4000}, {50, 1000},
|
||||
{51, 1000}, {56, 1000}, {57, 4000}, {65, 4000}, {66, 4000}, {67, 4000},
|
||||
|
|
@ -52,7 +52,7 @@ static const std::unordered_map<int16_t, uint16_t> xResolutionMap_ {
|
|||
{178, 1000}, {179, 1000}, {180, 150}, {181, 150}, {182, 150}, {184, 150},
|
||||
{186, 300}, {193, 250}, {195, 1000}};
|
||||
|
||||
static const std::unordered_map<int16_t, uint16_t> yResolutionMap_ {{37, 1000},
|
||||
static const std::unordered_map<int, unsigned int> yResolutionMap_ {{37, 1000},
|
||||
{38, 4000},
|
||||
{41, 4000},
|
||||
{50, 500},
|
||||
|
|
@ -255,7 +255,7 @@ uint16_t ProductDescriptionBlock::range_raw() const
|
|||
auto it = rangeMap_.find(p->productCode_);
|
||||
if (it != rangeMap_.cend())
|
||||
{
|
||||
range = it->second;
|
||||
range = static_cast<uint16_t>(it->second);
|
||||
}
|
||||
|
||||
return range;
|
||||
|
|
@ -273,7 +273,7 @@ uint16_t ProductDescriptionBlock::x_resolution_raw() const
|
|||
auto it = xResolutionMap_.find(p->productCode_);
|
||||
if (it != xResolutionMap_.cend())
|
||||
{
|
||||
xResolution = it->second;
|
||||
xResolution = static_cast<uint16_t>(it->second);
|
||||
}
|
||||
|
||||
return xResolution;
|
||||
|
|
@ -291,7 +291,7 @@ uint16_t ProductDescriptionBlock::y_resolution_raw() const
|
|||
auto it = yResolutionMap_.find(p->productCode_);
|
||||
if (it != yResolutionMap_.cend())
|
||||
{
|
||||
yResolution = it->second;
|
||||
yResolution = static_cast<uint16_t>(it->second);
|
||||
}
|
||||
|
||||
return yResolution;
|
||||
|
|
|
|||
|
|
@ -184,8 +184,6 @@ bool RasterDataPacket::Parse(std::istream& is)
|
|||
|
||||
for (uint16_t r = 0; r < p->numberOfRows_; r++)
|
||||
{
|
||||
size_t rowBytesRead = 0;
|
||||
|
||||
auto& row = p->row_[r];
|
||||
|
||||
is.read(reinterpret_cast<char*>(&row.numberOfBytes_), 2);
|
||||
|
|
@ -219,7 +217,7 @@ bool RasterDataPacket::Parse(std::istream& is)
|
|||
uint16_t binCount =
|
||||
std::accumulate(row.data_.cbegin(),
|
||||
row.data_.cend(),
|
||||
0,
|
||||
static_cast<uint16_t>(0u),
|
||||
[](const uint16_t& a, const uint8_t& b) -> uint16_t
|
||||
{ return a + (b >> 4); });
|
||||
|
||||
|
|
|
|||
|
|
@ -207,9 +207,10 @@ target_include_directories(wxdata PRIVATE ${Boost_INCLUDE_DIR}
|
|||
${scwx-data_SOURCE_DIR}/source)
|
||||
target_include_directories(wxdata INTERFACE ${scwx-data_SOURCE_DIR}/include)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(wxdata PRIVATE /W3)
|
||||
endif()
|
||||
target_compile_options(wxdata PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
|
||||
)
|
||||
|
||||
target_link_libraries(wxdata PUBLIC AWS::s3
|
||||
spdlog::spdlog)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue