1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-22 18:28:52 -05:00

Squash MSVC linker warnings on dll import/export. Make some casts explict to avoid compiler warnings.

This commit is contained in:
Gordon McCann 2022-02-12 19:50:48 -05:00
parent e049927049
commit 7d9eb141af
9 changed files with 29 additions and 20 deletions

View File

@ -47,7 +47,7 @@ namespace Navigator {
static Application* s_instance; static Application* s_instance;
}; };
NAV_API Application* CreateApplication(); Application* CreateApplication();
} }
#endif #endif

View File

@ -73,7 +73,7 @@ namespace Navigator {
//Only in ImPlot/ImGui context!!!! //Only in ImPlot/ImGui context!!!!
void Cut2D::Draw() const void Cut2D::Draw() const
{ {
ImPlot::PlotLine(m_params.name.c_str(), m_xpoints.data(), m_ypoints.data(), m_xpoints.size()); ImPlot::PlotLine(m_params.name.c_str(), m_xpoints.data(), m_ypoints.data(), (int)m_xpoints.size());
} }
/* CutMap */ /* CutMap */

View File

@ -7,7 +7,7 @@ namespace Navigator {
std::string ConvertFileSystemSizeToString(std::uintmax_t value) std::string ConvertFileSystemSizeToString(std::uintmax_t value)
{ {
int i = 0; int i = 0;
double mantissa = value; double mantissa = (double)value;
for (; mantissa >= 1024.0; ++i) for (; mantissa >= 1024.0; ++i)
mantissa /= 1024.0; mantissa /= 1024.0;
mantissa = std::ceil(mantissa * 10.0) / 10.0; mantissa = std::ceil(mantissa * 10.0) / 10.0;

View File

@ -26,12 +26,8 @@ namespace Navigator {
bool SpectrumPanel::OnImGuiRender(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList, const std::vector<std::string>& paramList) bool SpectrumPanel::OnImGuiRender(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList, const std::vector<std::string>& paramList)
{ {
//HistogramMap& histMap = HistogramMap::GetInstance();
//ParameterMap& paramMap = ParameterMap::GetInstance();
//CutMap& cutMap = CutMap::GetInstance();
static bool acceptCutFlag = false; static bool acceptCutFlag = false;
bool result = false; bool result = false;
//static std::string selectedRegion = "";
if (ImGui::Begin("Active View")) if (ImGui::Begin("Active View"))
{ {
if (histoList.size() > 0) if (histoList.size() > 0)
@ -66,7 +62,7 @@ namespace Navigator {
{ {
m_newCutX.push_back(ImPlot::GetPlotMousePos().x); m_newCutX.push_back(ImPlot::GetPlotMousePos().x);
} }
ImPlot::PlotVLines(m_newCutParams.name.c_str(), m_newCutX.data(), m_newCutX.size()); ImPlot::PlotVLines(m_newCutParams.name.c_str(), m_newCutX.data(), int(m_newCutX.size()));
} }
else if(m_cutModeFlag) else if(m_cutModeFlag)
@ -83,7 +79,7 @@ namespace Navigator {
m_newCutX.push_back(point.x); m_newCutX.push_back(point.x);
m_newCutY.push_back(point.y); m_newCutY.push_back(point.y);
} }
ImPlot::PlotLine(m_newCutParams.name.c_str(), m_newCutX.data(), m_newCutY.data(), m_newCutX.size()); ImPlot::PlotLine(m_newCutParams.name.c_str(), m_newCutX.data(), m_newCutY.data(), int(m_newCutX.size()));
} }
if (ImPlot::IsPlotSelected()) { if (ImPlot::IsPlotSelected()) {
@ -99,7 +95,7 @@ namespace Navigator {
auto& region = m_integralRegions[i]; auto& region = m_integralRegions[i];
if (m_zoomedGram.name == region.histogram_name) if (m_zoomedGram.name == region.histogram_name)
{ {
ImPlot::DragRect(i, &region.region.X.Min, &region.region.Y.Min, &region.region.X.Max, &region.region.Y.Max, ImVec4(1, 0, 1, 1)); ImPlot::DragRect(int(i), &region.region.X.Min, &region.region.Y.Min, &region.region.X.Max, &region.region.Y.Max, ImVec4(1, 0, 1, 1));
StatResults results = HistogramMap::GetInstance().AnalyzeHistogramRegion(m_zoomedGram.name, region.region); StatResults results = HistogramMap::GetInstance().AnalyzeHistogramRegion(m_zoomedGram.name, region.region);
ImPlot::PlotText(GenerateStatString(region.name, results, m_zoomedGram.y_par != "None").c_str(), (region.region.X.Max + region.region.X.Min) * 0.5, ImPlot::PlotText(GenerateStatString(region.name, results, m_zoomedGram.y_par != "None").c_str(), (region.region.X.Max + region.region.X.Min) * 0.5,
(region.region.Y.Min + region.region.Y.Max) * 0.5); (region.region.Y.Min + region.region.Y.Max) * 0.5);
@ -196,7 +192,7 @@ namespace Navigator {
auto& region = m_integralRegions[i]; auto& region = m_integralRegions[i];
if (spec.name == region.histogram_name) if (spec.name == region.histogram_name)
{ {
ImPlot::DragRect(i, &region.region.X.Min, &region.region.Y.Min, &region.region.X.Max, &region.region.Y.Max, ImVec4(1, 0, 1, 1)); ImPlot::DragRect(int(i), &region.region.X.Min, &region.region.Y.Min, &region.region.X.Max, &region.region.Y.Max, ImVec4(1, 0, 1, 1));
} }
} }
ImPlot::EndPlot(); ImPlot::EndPlot();

View File

@ -18,13 +18,13 @@ namespace Navigator {
class NAV_API WindowResizeEvent : public Event class NAV_API WindowResizeEvent : public Event
{ {
public: public:
WindowResizeEvent(float x, float y) : WindowResizeEvent(int x, int y) :
m_xSize(x), m_ySize(y) m_xSize(x), m_ySize(y)
{ {
} }
inline float GetXSize() { return m_xSize; } inline int GetXSize() { return m_xSize; }
inline float GetYSize() { return m_ySize; } inline int GetYSize() { return m_ySize; }
std::string ToString() const override std::string ToString() const override
{ {
std::stringstream ss; std::stringstream ss;
@ -36,7 +36,7 @@ namespace Navigator {
EVENT_TYPE_SETUP(WindowResize) EVENT_TYPE_SETUP(WindowResize)
private: private:
float m_xSize, m_ySize; int m_xSize, m_ySize;
}; };
class NAV_API AppUpdateEvent : public Event class NAV_API AppUpdateEvent : public Event

View File

@ -102,7 +102,7 @@ namespace Navigator {
if (results.integral == 0) if (results.integral == 0)
return results; return results;
results.cent_x /= double(results.integral); results.cent_x /= results.integral;
for (int i = bin_min; i <= bin_max; i++) for (int i = bin_min; i <= bin_max; i++)
results.sigma_x += m_binCounts[i] * ((m_params.min_x + m_binWidth * i) - results.cent_x) * ((m_params.min_x + m_binWidth * i) - results.cent_x); results.sigma_x += m_binCounts[i] * ((m_params.min_x + m_binWidth * i) - results.cent_x) * ((m_params.min_x + m_binWidth * i) - results.cent_x);
results.sigma_x = std::sqrt(results.sigma_x / (results.integral - 1)); results.sigma_x = std::sqrt(results.sigma_x / (results.integral - 1));
@ -208,12 +208,12 @@ namespace Navigator {
if (y_min <= m_params.min_y) if (y_min <= m_params.min_y)
ybin_max = m_params.nbins_y - 1; ybin_max = m_params.nbins_y - 1;
else else
ybin_max = int((m_params.max_y - y_min)) / m_binWidthY; ybin_max = int((m_params.max_y - y_min) / m_binWidthY);
if (y_max >= m_params.max_y) if (y_max >= m_params.max_y)
ybin_min = 0; ybin_min = 0;
else else
ybin_min = int((m_params.max_y - y_max)) / m_binWidthY; ybin_min = int((m_params.max_y - y_max) / m_binWidthY);
for (int y = ybin_min; y <= ybin_max; y++) for (int y = ybin_min; y <= ybin_max; y++)
{ {

View File

@ -7,7 +7,7 @@ namespace Navigator {
struct NAV_API StatResults struct NAV_API StatResults
{ {
int integral = 0.0; double integral = 0.0;
double cent_x = 0.0; double cent_x = 0.0;
double cent_y = 0.0; double cent_y = 0.0;
double sigma_x = 0.0; double sigma_x = 0.0;

View File

@ -8,6 +8,19 @@
#else #else
#define NAV_API __declspec(dllimport) #define NAV_API __declspec(dllimport)
#endif #endif
#ifdef _MSC_VER
#pragma warning (disable: 4127) // condition expression is constant
#pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when NAV_API is set to__declspec(dllexport)
#pragma warning (disable: 4091) // '__declspec(dllimport)': ignored on left of class 'xxx' when no variable is declared
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
#pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types
#endif
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
#pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
#endif
#else #else
#define NAV_API #define NAV_API
#endif #endif

View File

@ -49,7 +49,7 @@ namespace Navigator {
m_file->open(m_filename, std::ios::binary | std::ios::in); m_file->open(m_filename, std::ios::binary | std::ios::in);
m_file->seekg(0, std::ios_base::end); m_file->seekg(0, std::ios_base::end);
m_size = m_file->tellg(); m_size = (unsigned int)m_file->tellg();
m_nHits = m_size/24; m_nHits = m_size/24;
if(m_size == 0) if(m_size == 0)
{ {