Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Oct 11, 2023
2 parents a90f5f7 + 485805a commit 850b01c
Show file tree
Hide file tree
Showing 22 changed files with 833 additions and 993 deletions.
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ environment:
CXX: /usr/bin/clang++

matrix:
fast_finish: true

exclude:
# Excluding GCC and Clang on Windows images, and MSVC on Ubuntu image.
# Also, we compile MinGW binaries only on Visual Studio 2022 image.
Expand Down
2 changes: 1 addition & 1 deletion include/bit7z/bitarchivereader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class BitArchiveReader final : public BitAbstractArchiveOpener, public BitInputA
static auto isOpenEncryptedError( std::error_code error ) -> bool;
};

using BitArchiveInfo BIT7Z_MAYBE_UNUSED BIT7Z_DEPRECATED_MSG("Since v4.0; please use BitArchiveReader.") = BitArchiveReader;
BIT7Z_DEPRECATED_TYPEDEF( BitArchiveInfo, BitArchiveReader, "Since v4.0; please use BitArchiveReader." );

} // namespace bit7z

Expand Down
10 changes: 10 additions & 0 deletions include/bit7z/bitdefines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,14 @@
# endif
#endif

#ifndef BIT7Z_DEPRECATED_TYPEDEF
# if defined( __GNUC__ ) && !defined( __clang__ ) && __GNUC__ < 7
# define BIT7Z_DEPRECATED_TYPEDEF( alias_name, alias_value, msg ) \
using alias_name BIT7Z_MAYBE_UNUSED __attribute__(( __deprecated__( msg ) )) = alias_value
# else
# define BIT7Z_DEPRECATED_TYPEDEF( alias_name, alias_value, msg ) \
using alias_name BIT7Z_MAYBE_UNUSED BIT7Z_DEPRECATED_MSG( msg ) = alias_value
# endif
#endif

#endif //BITDEFINES_HPP
2 changes: 1 addition & 1 deletion include/bit7z/bitinputarchive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class BitInputArchive {
friend class BitInputArchive;
};

using const_iterator BIT7Z_MAYBE_UNUSED BIT7Z_DEPRECATED_MSG("Use ConstIterator") = ConstIterator;
BIT7Z_DEPRECATED_TYPEDEF( const_iterator, ConstIterator, "Use ConstIterator" );

/**
* @return an iterator to the first element of the archive; if the archive is empty,
Expand Down
1 change: 1 addition & 0 deletions include/bit7z/bittypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct StringTraits< wchar_t > {

/**
* Native string type of the system.
* @note On Windows, it is an alias of `std::wstring`.
*/
#ifdef _WIN32
using native_string = std::wstring;
Expand Down
2 changes: 1 addition & 1 deletion src/internal/cmultivolumeoutstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CMultiVolumeOutStream final : public IOutStream, public CMyUnknownImp {
// Total size of the output archive (sum of the volumes' sizes).
uint64_t mFullSize;

vector <CMyComPtr< CVolumeOutStream >> mVolumes;
vector< CMyComPtr< CVolumeOutStream > > mVolumes;

public:
CMultiVolumeOutStream( uint64_t volSize, fs::path archiveName );
Expand Down
13 changes: 7 additions & 6 deletions src/internal/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#ifdef _WIN32
#ifdef BIT7Z_USE_SYSTEM_CODEPAGE
#define CODEPAGE CP_ACP
#define CODEPAGE_FLAGS 0
#define CODEPAGE_WC_FLAGS WC_NO_BEST_FIT_CHARS
#else
#define CODEPAGE CP_UTF8
#define CODEPAGE_FLAGS WC_NO_BEST_FIT_CHARS
#define CODEPAGE_WC_FLAGS 0
#endif
#else
#ifndef BIT7Z_USE_STANDARD_FILESYSTEM
Expand All @@ -46,7 +46,7 @@ auto narrow( const wchar_t* wideString, size_t size ) -> std::string {
}
#ifdef _WIN32
const int narrowStringSize = WideCharToMultiByte( CODEPAGE,
CODEPAGE_FLAGS,
CODEPAGE_WC_FLAGS,
wideString,
static_cast< int >( size ),
nullptr,
Expand All @@ -59,7 +59,7 @@ auto narrow( const wchar_t* wideString, size_t size ) -> std::string {

std::string result( narrowStringSize, 0 );
WideCharToMultiByte( CODEPAGE,
CODEPAGE_FLAGS,
CODEPAGE_WC_FLAGS,
wideString,
-1,
&result[ 0 ], // NOLINT(readability-container-data-pointer)
Expand All @@ -79,10 +79,11 @@ auto narrow( const wchar_t* wideString, size_t size ) -> std::string {

auto widen( const std::string& narrowString ) -> std::wstring {
#ifdef _WIN32
const int narrowStringSize = static_cast< int >( narrowString.size() );
const int wideStringSize = MultiByteToWideChar( CODEPAGE,
0,
narrowString.c_str(),
static_cast< int >( narrowString.size() ),
narrowStringSize,
nullptr,
0 );
if ( wideStringSize == 0 ) {
Expand All @@ -93,7 +94,7 @@ auto widen( const std::string& narrowString ) -> std::wstring {
MultiByteToWideChar( CODEPAGE,
0,
narrowString.c_str(),
static_cast< int >( narrowString.size() ),
narrowStringSize,
&result[ 0 ], // NOLINT(readability-container-data-pointer)
wideStringSize );
return result;
Expand Down
13 changes: 8 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ set( SOURCE_FILES
# public API test sources
set( PUBLIC_API_SOURCE_FILES
src/test_bit7zlibrary.cpp
src/test_bitarchiveeditor.cpp
src/test_bitarchivereader.cpp
src/test_bitarchivewriter.cpp
src/test_biterror.cpp
src/test_bitexception.cpp
src/test_bitfilecompressor.cpp
src/test_bitpropvariant.cpp )
src/test_bitfileextractor.cpp
src/test_bitmemcompressor.cpp
src/test_bitmemextractor.cpp
src/test_bitpropvariant.cpp
src/test_bitstreamcompressor.cpp
src/test_bitstreamextractor.cpp )

# internal API sources
set( INTERNAL_API_SOURCE_FILES
Expand Down Expand Up @@ -122,10 +129,6 @@ endif()
if( MSVC )
target_compile_options( ${TESTS_TARGET} PRIVATE /utf-8 )
target_compile_options( ${TESTS_TARGET_PUBLIC} PRIVATE /utf-8 )

# Needed by MSVC for defining the S_XXXX macros (used in BitArchiveReader tests)
target_compile_definitions( ${TESTS_TARGET} PRIVATE _CRT_INTERNAL_NONSTDC_NAMES=1 )
target_compile_definitions( ${TESTS_TARGET_PUBLIC} PRIVATE _CRT_INTERNAL_NONSTDC_NAMES=1 )
endif()

if( WIN32 )
Expand Down
19 changes: 19 additions & 0 deletions tests/src/test_bitarchiveeditor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/*
* bit7z - A C++ static library to interface with the 7-zip shared libraries.
* Copyright (c) 2014-2023 Riccardo Ostani - All Rights Reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

#include <catch2/catch.hpp>

#include <bit7z/bitarchiveeditor.hpp>

TEST_CASE( "BitArchiveEditor: TODO", "[bitarchiveeditor]" ) {

}
Loading

0 comments on commit 850b01c

Please sign in to comment.