Skip to content

fix(Unzip): Fixed thrown exception if file doesn't exist - #1325

Merged
BotellaA merged 2 commits into
nextfrom
fix/unzip_file_error_msg
Aug 28, 2026
Merged

fix(Unzip): Fixed thrown exception if file doesn't exist#1325
BotellaA merged 2 commits into
nextfrom
fix/unzip_file_error_msg

Conversation

@MelchiorSchuh

Copy link
Copy Markdown
Member

No description provided.

@github-actions

Copy link
Copy Markdown
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v21.1.8) reports: 23 concern(s)
  • src/geode/basic/zip_file.cpp:30:10: error: [clang-diagnostic-error]

    'mz.h' file not found

       30 | #include <mz.h>
          |          ^~~~~~
  • src/geode/basic/zip_file.cpp:42:9: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'create_directory' of similar type ('std::string_view') are easily swapped by mistake

       42 |         std::string_view file, std::string_view temp_filename )
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode/OpenGeode/src/geode/basic/zip_file.cpp:42:26: note: the first parameter in the range is 'file'
       42 |         std::string_view file, std::string_view temp_filename )
          |                          ^~~~
    /__w/OpenGeode/OpenGeode/src/geode/basic/zip_file.cpp:42:49: note: the last parameter in the range is 'temp_filename'
       42 |         std::string_view file, std::string_view temp_filename )
          |                                                 ^~~~~~~~~~~~~
  • src/geode/basic/zip_file.cpp:54:20: warning: [cppcoreguidelines-special-member-functions]

    class 'Impl' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator

       54 |     class ZipFile::Impl
          |                    ^
  • src/geode/basic/zip_file.cpp:60:13: warning: [cppcoreguidelines-prefer-member-initializer]

    'writer_' should be initialized in a member initializer of the constructor

       57 |         Impl( std::string_view file, std::string_view archive_temp_filename )
          |                                                                              
          |                                                                               : writer_(mz_zip_writer_create())
       58 |         {
       59 |             directory_ = create_directory( file, archive_temp_filename );
       60 |             writer_ = mz_zip_writer_create();
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • src/geode/basic/zip_file.cpp:75:17: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void *' -> 'bool'

       75 |             if( writer_ )
          |                 ^
          |                         != nullptr
  • src/geode/basic/zip_file.cpp:106:9: warning: [modernize-use-nodiscard]

    function 'directory' should be marked [[nodiscard]]

      106 |         std::string directory() const
          |         ^
          |         [[nodiscard]] 
  • src/geode/basic/zip_file.cpp:140:22: warning: [cppcoreguidelines-special-member-functions]

    class 'Impl' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator

      140 |     class UnzipFile::Impl
          |                      ^
  • src/geode/basic/zip_file.cpp:143:9: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: zip_data_

      143 |         Impl( std::string_view file, std::string_view unarchive_temp_filename )
          |         ^
  • src/geode/basic/zip_file.cpp:170:17: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void *' -> 'bool'

      170 |             if( reader_ )
          |                 ^
          |                         != nullptr
  • src/geode/basic/zip_file.cpp:176:17: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void *' -> 'bool'

      176 |             if( memory_stream_ )
          |                 ^
          |                                != nullptr
  • src/geode/basic/zip_file.cpp:187:41: warning: [bugprone-implicit-widening-of-multiplication-result]

    performing an implicit widening conversion to type 'const size_t' (aka 'const unsigned long') of a multiplication performed in type 'int'

      187 |             constexpr size_t BUF_SIZE = 1024 * 1024; // 1 MB
          |                                         ^
    /__w/OpenGeode/OpenGeode/src/geode/basic/zip_file.cpp:187:41: note: make conversion explicit to silence this warning
       24 |             constexpr size_t BUF_SIZE = 1024 * 1024; // 1 MB
          |                                         ^~~~~~~~~~~
          |                                         static_cast<const size_t>( )
    /__w/OpenGeode/OpenGeode/src/geode/basic/zip_file.cpp:187:41: note: perform multiplication in a wider type
      187 |             constexpr size_t BUF_SIZE = 1024 * 1024; // 1 MB
          |                                         ^~~~
          |                                         static_cast<long>( )
  • src/geode/basic/zip_file.cpp:202:22: warning: [readability-implicit-bool-conversion]

    implicit conversion 'FILE *' (aka '_IO_FILE *') -> 'bool'

      202 |                 if( !file )
          |                     ~^
          |                           == nullptr
  • src/geode/basic/zip_file.cpp:219:17: warning: [cert-err33-c]

    the value returned by this function should not be disregarded; neglecting it may lead to errors

      219 |                 fclose( file );
          |                 ^~~~~~~~~~~~~~
    /__w/OpenGeode/OpenGeode/src/geode/basic/zip_file.cpp:219:17: note: cast the expression to void to silence this warning
  • src/geode/basic/zip_file.cpp:219:17: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      219 |                 fclose( file );
          |                 ^~~~~~~~~~~~~~
  • src/geode/basic/zip_file.cpp:224:9: warning: [modernize-use-nodiscard]

    function 'directory' should be marked [[nodiscard]]

      224 |         std::string directory() const
          |         ^
          |         [[nodiscard]] 
  • src/geode/mesh/core/grid.cpp:43:18: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

       43 |         return ( ( vertex_id / ( 1 << axis_id ) ) & 1 ) == 0;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
  • src/geode/mesh/core/grid.cpp:43:34: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

       43 |         return ( ( vertex_id / ( 1 << axis_id ) ) & 1 ) == 0;
          |                                  ^ ~~
  • src/geode/mesh/core/grid.cpp:65:9: warning: [modernize-use-nodiscard]

    function 'cell_length_in_direction' should be marked [[nodiscard]]

       65 |         double cell_length_in_direction( index_t direction ) const
          |         ^
          |         [[nodiscard]] 
  • src/geode/mesh/core/grid.cpp:70:9: warning: [modernize-use-nodiscard]

    function 'cell_size' should be marked [[nodiscard]]

       70 |         double cell_size() const
          |         ^
          |         [[nodiscard]] 
  • src/geode/mesh/core/grid.cpp:193:36: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

      193 |                 result += diff * ( 1 << d );
          |                                    ^ ~~
  • src/geode/mesh/core/grid.cpp:274:60: warning: [cppcoreguidelines-avoid-magic-numbers]

    1. is a magic number; consider replacing it with a named constant
      274 |             return ( point( cell_id ) + point( other ) ) / 2.;
          |                                                            ^
  • src/geode/mesh/core/grid.cpp:277:27: warning: [readability-function-cognitive-complexity]

    function 'cells' has cognitive complexity of 19 (threshold 10)

      277 |         CellsAroundVertex cells( const Grid< dimension >& grid,
          |                           ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:284:13: note: +1, including nesting penalty of 0, nesting level increased to 1
      284 |             for( const auto d : LRange{ dimension } )
          |             ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:287:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      287 |                 if( value < -GLOBAL_EPSILON
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:288:21: note: +1
      288 |                     || value
          |                     ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:294:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      294 |                 if( floating_floor < 0 )
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:298:22: note: +1, nesting level increased to 2
      298 |                 else if( floating_floor > grid.nb_cells_in_direction( d ) - 1 )
          |                      ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:307:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      307 |                 if( remainder < GLOBAL_EPSILON )
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:309:48: note: +3, including nesting penalty of 2, nesting level increased to 3
      309 |                     min[d] = integer_floor > 0 ? integer_floor - 1 : 0;
          |                                                ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:311:22: note: +1, nesting level increased to 2
      311 |                 else if( remainder > 1 - GLOBAL_EPSILON )
          |                      ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:319:13: note: +1, including nesting penalty of 0, nesting level increased to 1
      319 |             for( const auto d : LRange{ dimension } )
          |             ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:321:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      321 |                 if( max[d] != min[d] )
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:323:21: note: +3, including nesting penalty of 2, nesting level increased to 3
      323 |                     for( const auto& cell_indices : cells_around_point )
          |                     ^
  • src/geode/mesh/core/grid.cpp:333:27: warning: [readability-function-cognitive-complexity]

    function 'cells_around' has cognitive complexity of 11 (threshold 10)

      333 |         CellsAroundVertex cells_around(
          |                           ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:338:13: note: +1, including nesting penalty of 0, nesting level increased to 1
      338 |             for( const auto d : LRange{ dimension } )
          |             ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:340:49: note: +2, including nesting penalty of 1, nesting level increased to 2
      340 |                 min[d] = vertex_indices[d] == 0 ? 0 : vertex_indices[d] - 1;
          |                                                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:342:30: note: +2, including nesting penalty of 1, nesting level increased to 2
      342 |                              ? vertex_indices[d] - 1
          |                              ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:347:13: note: +1, including nesting penalty of 0, nesting level increased to 1
      347 |             for( const auto d : LRange{ dimension } )
          |             ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:349:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      349 |                 if( max[d] != min[d] )
          |                 ^
    /__w/OpenGeode/OpenGeode/src/geode/mesh/core/grid.cpp:351:21: note: +3, including nesting penalty of 2, nesting level increased to 3
      351 |                     for( const auto& cell_indices : cells_around_vertex )
          |                     ^

Have any feedback or feature suggestions? Share it here.

@BotellaA
BotellaA merged commit 7b85992 into next Aug 28, 2026
20 checks passed
@BotellaA
BotellaA deleted the fix/unzip_file_error_msg branch August 28, 2026 13:13
@BotellaA

Copy link
Copy Markdown
Member

🎉 This PR is included in version 18.1.1-rc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@BotellaA

Copy link
Copy Markdown
Member

🎉 This PR is included in version 18.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants