From 111f4594151db331e85d39538cadf1b75a13cd5a Mon Sep 17 00:00:00 2001 From: Beats Date: Fri, 8 Sep 2023 19:41:54 -0300 Subject: [PATCH] fix: warnings deprecated (#47) --- .github/workflows/analysis-sonarcloud.yml | 2 ++ .github/workflows/build-ubuntu.yml | 2 ++ .github/workflows/build-windows-cmake.yml | 2 ++ .github/workflows/build-windows-solution.yml | 4 +++ source/common_windows.cpp | 14 +++++------ source/filehandle.cpp | 26 +++++++++++--------- 6 files changed, 32 insertions(+), 18 deletions(-) diff --git a/.github/workflows/analysis-sonarcloud.yml b/.github/workflows/analysis-sonarcloud.yml index f333b1cb..4b37386d 100644 --- a/.github/workflows/analysis-sonarcloud.yml +++ b/.github/workflows/analysis-sonarcloud.yml @@ -6,6 +6,7 @@ on: types: [opened, synchronize, reopened] paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' @@ -13,6 +14,7 @@ on: push: paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index c63e2088..924114f8 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -7,6 +7,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' @@ -14,6 +15,7 @@ on: push: paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' diff --git a/.github/workflows/build-windows-cmake.yml b/.github/workflows/build-windows-cmake.yml index 1d4cd334..76441bff 100644 --- a/.github/workflows/build-windows-cmake.yml +++ b/.github/workflows/build-windows-cmake.yml @@ -7,6 +7,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' @@ -14,6 +15,7 @@ on: push: paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' diff --git a/.github/workflows/build-windows-solution.yml b/.github/workflows/build-windows-solution.yml index a5602c2e..b5c716cf 100644 --- a/.github/workflows/build-windows-solution.yml +++ b/.github/workflows/build-windows-solution.yml @@ -7,17 +7,21 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' - 'vcpkg.json' + - 'vcproj/**' push: paths: - 'src/**' + - 'source/**' - 'cmake/**' - 'CMakeLists.txt' - 'CMakePresets.json' - 'vcpkg.json' + - 'vcproj/**' branches: - main diff --git a/source/common_windows.cpp b/source/common_windows.cpp index 39423b9c..d36406bd 100644 --- a/source/common_windows.cpp +++ b/source/common_windows.cpp @@ -134,7 +134,7 @@ MapPropertiesWindow::MapPropertiesWindow(wxWindow* parent, MapTab* view, Editor& spawn_filename_ctrl = newd wxTextCtrl(this, wxID_ANY, wxstr(map.getSpawnFilename())), 1, wxEXPAND ); - + grid_sizer->Add( newd wxStaticText(this, wxID_ANY, "External npc file") ); @@ -626,24 +626,24 @@ void ExportMiniMapWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) for(int floor = 0; floor < MAP_LAYERS; ++floor) { g_gui.SetLoadScale(int(floor*(100.f/16.f)), int((floor+1)*(100.f/16.f))); FileName file(file_name_text_field->GetValue() + "_" + i2ws(floor) + ".bmp"); - file.Normalize(wxPATH_NORM_ALL, directory.GetFullPath()); - editor.exportMiniMap(file, floor, true); + file.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_TILDE | wxPATH_NORM_DOTS, directory.GetFullPath()); + editor.exportMiniMap(file, floor, true); } break; } case 1: { // Ground floor FileName file(file_name_text_field->GetValue() + "_" + i2ws(GROUND_LAYER) + ".bmp"); - file.Normalize(wxPATH_NORM_ALL, directory.GetFullPath()); - editor.exportMiniMap(file, GROUND_LAYER, true); + file.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_TILDE | wxPATH_NORM_DOTS, directory.GetFullPath()); + editor.exportMiniMap(file, GROUND_LAYER, true); break; } case 2: { // Specific floors int floor = floor_number->GetValue(); FileName file(file_name_text_field->GetValue() + "_" + i2ws(floor) + ".bmp"); - file.Normalize(wxPATH_NORM_ALL, directory.GetFullPath()); - editor.exportMiniMap(file, floor, true); + file.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_TILDE | wxPATH_NORM_DOTS, directory.GetFullPath()); + editor.exportMiniMap(file, floor, true); break; } diff --git a/source/filehandle.cpp b/source/filehandle.cpp index 8252208c..743bd3a5 100644 --- a/source/filehandle.cpp +++ b/source/filehandle.cpp @@ -294,17 +294,21 @@ bool DiskNodeFileReadHandle::renewCache() BinaryNode* DiskNodeFileReadHandle::getRootNode() { - assert(root_node == nullptr); // You should never do this twice - uint8_t first; - fread(&first, 1, 1, file); - if(first == NODE_START) { - root_node = getNode(nullptr); - root_node->load(); - return root_node; - } else { - error_code = FILE_SYNTAX_ERROR; - return nullptr; - } + assert(root_node == nullptr); // You should never do this twice + uint8_t first; + size_t numRead = fread(&first, 1, 1, file); + if(numRead != 1) { + error_code = FILE_READ_ERROR; + return nullptr; + } + if(first == NODE_START) { + root_node = getNode(nullptr); + root_node->load(); + return root_node; + } else { + error_code = FILE_SYNTAX_ERROR; + return nullptr; + } } //=============================================================================