Skip to content

Commit

Permalink
Fix warnings and build on some compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Jan 17, 2024
1 parent b723936 commit 8857bc7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/bit7z/bitoutputarchive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using DeletedItems = std::set< uint32_t >;
* Note: given an InputIndex i:
* if i < mInputArchiveItemsCount, the item is old (old item in the input archive);
* if i >= mInputArchiveItemsCount, the item is new (added by the user); */
enum class InputIndex : std::uint32_t {};
enum class InputIndex : std::uint32_t {}; // NOLINT(*-enum-size)

class UpdateCallback;

Expand Down
2 changes: 1 addition & 1 deletion src/internal/cfixedbufferoutstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "bittypes.hpp"
#include "internal/util.hpp"

#include <algorithm> //for std::copy_n
#include <algorithm> // for std::copy_n
#include <cstdint>
#include <cstddef>

Expand Down
5 changes: 3 additions & 2 deletions src/internal/windows.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ constexpr auto WIN32_MASK = 0x0000FFFF;

/* Note: p7zip uses FACILITY_WIN32, 7-zip version of HRESULT_FROM_WIN32 uses FACILITY_ERRNO. */
inline constexpr auto HRESULT_FROM_WIN32( unsigned int x ) -> HRESULT {
auto res = static_cast< HRESULT >( x );
return ( res > 0 ) ? static_cast< HRESULT >( ( x & WIN32_MASK ) | ( FACILITY_WIN32 << 16u ) | 0x80000000 ) : res;
return ( static_cast< HRESULT >( x ) > 0 ) ?
static_cast< HRESULT >( ( x & WIN32_MASK ) | ( FACILITY_WIN32 << 16u ) | 0x80000000 ) :
static_cast< HRESULT >( x );
}

constexpr auto ERROR_NEGATIVE_SEEK = 0x100131;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test_bitoutputarchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TEST_CASE( "BitOutputArchive: Compressing a commented file should preserve the c
REQUIRE_NOTHROW( writer.addFile( path_to_tstring( commentedFile ) ) );

TempTestDirectory testOutDir{ "test_bitinputarchive" };
INFO( "Output directory: " << testOutDir );
INFO( "Output directory: " << testOutDir )

const auto* const outputArchive = BIT7Z_STRING( "commented.7z" );
REQUIRE_NOTHROW( writer.compressTo( outputArchive ) );
Expand Down
2 changes: 2 additions & 0 deletions tests/src/test_dateutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <internal/dateutil.hpp>

#include <ctime> // For std::time_t (on MSVC 2015).

using namespace bit7z;

/* Note: std::time_t is usually a UNIX timestamp, so we are using only dates after the UNIX epoch datetime.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/utils/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ auto get_file_comment( const fs::path& filePath ) -> std::wstring {
CCoInitialize init;
CMyComPtr< IPropertyStore > propertyStore{};
SHGetPropertyStoreFromParsingName( filePath.c_str(), nullptr, GPS_READWRITE, IID_PPV_ARGS( &propertyStore ) );
return get_property_as_string( propertyStore, PKEY_Comment );
return propertyStore != nullptr ? get_property_as_string( propertyStore, PKEY_Comment ) : L"";
}
#endif

Expand Down

0 comments on commit 8857bc7

Please sign in to comment.