From 053b55d410790c341fab186c7d7d88ac7601b3b2 Mon Sep 17 00:00:00 2001 From: Oz Date: Sun, 29 Oct 2023 11:27:16 +0100 Subject: [PATCH] [Test] Fix code formatting and strings/comments grammar --- include/bit7z/bitwindows.hpp | 2 +- src/bitinputarchive.cpp | 2 +- src/bitpropvariant.cpp | 18 +++++++++--------- src/internal/hresultcategory.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/bit7z/bitwindows.hpp b/include/bit7z/bitwindows.hpp index 0b897c0b..e02ad361 100644 --- a/include/bit7z/bitwindows.hpp +++ b/include/bit7z/bitwindows.hpp @@ -22,7 +22,7 @@ * the two different declarations would conflict, making the compilation fail. * * To avoid all these issues, we define the required Win32 API structs, constants, and type aliases, - * with the same definitions in the MyWindows.h header. + * with the same definitions as in the MyWindows.h header. * We will use only this header and avoid including "MyWindows.h" or similar headers (e.g., StdAfx.h). */ #include #include diff --git a/src/bitinputarchive.cpp b/src/bitinputarchive.cpp index 3e219f14..19f3ab82 100644 --- a/src/bitinputarchive.cpp +++ b/src/bitinputarchive.cpp @@ -165,7 +165,7 @@ auto BitInputArchive::archiveProperty( BitProperty property ) const -> BitPropVa auto BitInputArchive::itemProperty( uint32_t index, BitProperty property ) const -> BitPropVariant { BitPropVariant itemProperty; - const HRESULT res = mInArchive->GetProperty( index, static_cast( property ), &itemProperty ); + const HRESULT res = mInArchive->GetProperty( index, static_cast< PROPID >( property ), &itemProperty ); if ( res != S_OK ) { throw BitException( "Could not retrieve property for item at the index " + std::to_string( index ), make_hresult_code( res ) ); diff --git a/src/bitpropvariant.cpp b/src/bitpropvariant.cpp index 44d0762f..15bdd127 100644 --- a/src/bitpropvariant.cpp +++ b/src/bitpropvariant.cpp @@ -261,7 +261,7 @@ auto BitPropVariant::getNativeString() const -> native_string { if ( vt != VT_BSTR ) { throw BitException( "BitPropVariant is not a string", make_error_code( BitError::RequestedWrongVariantType ) ); } - //Note: a nullptr BSTR is semantically equivalent to an empty string! + // Note: a nullptr BSTR is semantically equivalent to an empty string. return bstrVal == nullptr ? native_string{} : native_string{ bstrVal, ::SysStringLen( bstrVal ) }; #else return getString(); @@ -273,7 +273,7 @@ auto BitPropVariant::getUInt8() const -> uint8_t { case VT_UI1: return bVal; default: // not an 8-bits unsigned integer. - throw BitException( "BitPropVariant is not an 8-bits unsigned integer", + throw BitException( "BitPropVariant is not an 8-bit unsigned integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } @@ -285,7 +285,7 @@ auto BitPropVariant::getUInt16() const -> uint16_t { case VT_UI2: return uiVal; default: // not a 16-bits unsigned integer. - throw BitException( "BitPropVariant is not a 16-bits unsigned integer", + throw BitException( "BitPropVariant is not a 16-bit unsigned integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } @@ -301,7 +301,7 @@ auto BitPropVariant::getUInt32() const -> uint32_t { case VT_UI4: return ulVal; default: // not a 32-bits unsigned integer. - throw BitException( "BitPropVariant is not a 32-bits unsigned integer", + throw BitException( "BitPropVariant is not a 32-bit unsigned integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } @@ -319,7 +319,7 @@ auto BitPropVariant::getUInt64() const -> uint64_t { case VT_UI8: return uhVal.QuadPart; default: // not a 64-bits unsigned integer. - throw BitException( "BitPropVariant is not a 64-bits unsigned integer", + throw BitException( "BitPropVariant is not a 64-bit unsigned integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } @@ -329,7 +329,7 @@ auto BitPropVariant::getInt8() const -> int8_t { case VT_I1: return static_cast< int8_t >( cVal ); default: // not an 8-bits integer. - throw BitException( "BitPropVariant is not an 8-bits integer", + throw BitException( "BitPropVariant is not an 8-bit integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } @@ -341,7 +341,7 @@ auto BitPropVariant::getInt16() const -> int16_t { case VT_I2: return iVal; default: // not a 16-bits integer. - throw BitException( "BitPropVariant is not a 16-bits integer", + throw BitException( "BitPropVariant is not a 16-bit integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } @@ -357,7 +357,7 @@ auto BitPropVariant::getInt32() const -> int32_t { case VT_I4: return lVal; default: // not a 32-bits integer. - throw BitException( "BitPropVariant is not a 32-bits integer", + throw BitException( "BitPropVariant is not a 32-bit integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } @@ -375,7 +375,7 @@ auto BitPropVariant::getInt64() const -> int64_t { case VT_I8: return hVal.QuadPart; default: // not a 64-bits integer. - throw BitException( "BitPropVariant is not a 64-bits integer", + throw BitException( "BitPropVariant is not a 64-bit integer", make_error_code( BitError::RequestedWrongVariantType ) ); } } diff --git a/src/internal/hresultcategory.cpp b/src/internal/hresultcategory.cpp index 57a37603..da669003 100644 --- a/src/internal/hresultcategory.cpp +++ b/src/internal/hresultcategory.cpp @@ -42,7 +42,7 @@ auto HRESULTCategory::message( int errorValue ) const -> std::string { } /* Note: strings obtained using FormatMessageA have a trailing space, and a \r\n pair of char. * Using the flag FORMAT_MESSAGE_MAX_WIDTH_MASK removes the ending \r\n but leaves the trailing space. - * For this reason, we create the resulting std::string by considering msgSize - 1 as string size! */ + * For this reason, we create the resulting std::string by considering msgSize - 1 as string size. */ std::string errorMessage( messageBuffer, msgSize - 1 ); LocalFree( messageBuffer ); return errorMessage;