diff --git a/Project/MSVC2022/Library/ZenLib.vcxproj b/Project/MSVC2022/Library/ZenLib.vcxproj index c798854..fdca87a 100644 --- a/Project/MSVC2022/Library/ZenLib.vcxproj +++ b/Project/MSVC2022/Library/ZenLib.vcxproj @@ -160,6 +160,8 @@ ZenLib/PreComp.h true Disabled + stdcpp20 + Level3 @@ -170,6 +172,8 @@ ZenLib/PreComp.h true Disabled + stdcpp20 + Level3 @@ -180,6 +184,8 @@ ZenLib/PreComp.h true Disabled + stdcpp20 + Level3 @@ -190,6 +196,8 @@ ZenLib/PreComp.h true Disabled + stdcpp20 + Level3 @@ -200,7 +208,8 @@ Use ZenLib/PreComp.h Disabled - stdcpplatest + stdcpp20 + Level3 @@ -213,6 +222,8 @@ None NoExtensions Guard + stdcpp20 + Level3 @@ -224,6 +235,8 @@ ZenLib/PreComp.h None Guard + stdcpp20 + Level3 @@ -237,6 +250,8 @@ Guard true true + stdcpp20 + Level3 @@ -250,6 +265,8 @@ Guard true true + stdcpp20 + Level3 @@ -262,6 +279,8 @@ OldStyle Guard true + stdcpp20 + Level3 diff --git a/Source/ZenLib/BitStream.h b/Source/ZenLib/BitStream.h index f00e04a..e23b848 100644 --- a/Source/ZenLib/BitStream.h +++ b/Source/ZenLib/BitStream.h @@ -30,16 +30,32 @@ namespace ZenLib class BitStream { public: - BitStream () {Buffer=NULL; - Buffer_Size=Buffer_Size_Init=Buffer_Size_BeforeLastCall=0; - LastByte_Size=0; - BufferUnderRun=true; - BookMark=false;} - BitStream (const int8u* Buffer_, size_t Size_) {Buffer=Buffer_; - Buffer_Size=Buffer_Size_Init=Buffer_Size_BeforeLastCall=Size_*8; //Size is in bits - LastByte_Size=0; - BufferUnderRun=Buffer_Size?false:true; - BookMark=false;} + BitStream () { Buffer = NULL; + Buffer_Size = 0; + Buffer_Size_Init = 0; + Buffer_Size_BeforeLastCall = 0; + LastByte = 0; + LastByte_Size = 0; + BufferUnderRun = true; + BookMark = false; + Buffer_BookMark = 0; + Buffer_Size_BookMark = 0; + LastByte_BookMark = 0; + LastByte_Size_BookMark = 0; + BufferUnderRun_BookMark = false; } + BitStream (const int8u* Buffer_, size_t Size_) { Buffer = Buffer_; + Buffer_Size = Size_ * 8; //Size is in bits + Buffer_Size_Init = Size_ * 8; //Size is in bits + Buffer_Size_BeforeLastCall = Size_ * 8; //Size is in bits + LastByte = 0; + LastByte_Size = 0; + BufferUnderRun = (Buffer_Size ? false : true); + BookMark = false; + Buffer_BookMark = 0; + Buffer_Size_BookMark = 0; + LastByte_BookMark = 0; + LastByte_Size_BookMark = 0; + BufferUnderRun_BookMark = false; } virtual ~BitStream () {}; virtual void Attach(const int8u* Buffer_, size_t Size_) @@ -98,14 +114,17 @@ class BitStream ToReturn |= ((size_t)*Buffer) << NewBits; Buffer++; Buffer_Size-=8; + [[fallthrough]]; case 2 : NewBits-=8; ToReturn |= ((size_t)*Buffer) << NewBits; Buffer++; Buffer_Size-=8; + [[fallthrough]]; case 1 : NewBits-=8; ToReturn |= ((size_t)*Buffer) << NewBits; Buffer++; Buffer_Size-=8; + [[fallthrough]]; case 0 : LastByte=*Buffer; Buffer++; @@ -191,12 +210,15 @@ class BitStream case 3 : NewBits-=8; Buffer++; Buffer_Size-=8; + [[fallthrough]]; case 2 : NewBits-=8; Buffer++; Buffer_Size-=8; + [[fallthrough]]; case 1 : NewBits-=8; Buffer++; Buffer_Size-=8; + [[fallthrough]]; case 0 : LastByte=*Buffer; Buffer++; diff --git a/Source/ZenLib/BitStream_Fast.h b/Source/ZenLib/BitStream_Fast.h index bbf6f39..9706333 100644 --- a/Source/ZenLib/BitStream_Fast.h +++ b/Source/ZenLib/BitStream_Fast.h @@ -30,12 +30,16 @@ namespace ZenLib class BitStream_Fast { public: - BitStream_Fast () {Buffer=NULL; - Buffer_Size=Buffer_Size_Init=0; - BufferUnderRun=false;} - BitStream_Fast (const int8u* Buffer_, size_t Size_) {Buffer=Buffer_; - Buffer_Size=Buffer_Size_Init=Size_*8; //Size is in bits - BufferUnderRun=false;} + BitStream_Fast () { Buffer = NULL; + Buffer_Size = 0; + Buffer_Size_Init = 0; + LastByte = 0; + BufferUnderRun = false; } + BitStream_Fast (const int8u* Buffer_, size_t Size_) { Buffer = Buffer_; + Buffer_Size = Size_ * 8; //Size is in bits + Buffer_Size_Init = Size_ * 8; //Size is in bits + LastByte = 0; + BufferUnderRun = false; } ~BitStream_Fast () {} void Attach(const int8u* Buffer_, size_t Size_) @@ -182,11 +186,12 @@ class BitStream_Fast { case 3 : NewBits-=8; ToReturn|=*(Buffer++)<>((Buffer_Size-HowMany)%8))&Mask[NewBits]; diff --git a/Source/ZenLib/BitStream_LE.h b/Source/ZenLib/BitStream_LE.h index 1a5d63c..20147c0 100644 --- a/Source/ZenLib/BitStream_LE.h +++ b/Source/ZenLib/BitStream_LE.h @@ -26,16 +26,17 @@ namespace ZenLib class BitStream_LE : public BitStream { public: - BitStream_LE () :BitStream() - { - endbyte=0; - endbit=0; - buffer=NULL; - ptr=NULL; - storage=0; + BitStream_LE() : BitStream(), + endbyte(0), + endbit(0), + buffer(NULL), + ptr(NULL), + ptr_BeforeLastCall(NULL), + storage(0) { }; - BitStream_LE (const int8u* Buffer_, size_t Size_) :BitStream(Buffer_, Size_) { + BitStream_LE (const int8u* Buffer_, size_t Size_) : BitStream(Buffer_, Size_), + ptr_BeforeLastCall(NULL) { Attach(Buffer_, Size_); }; diff --git a/Source/ZenLib/Dir.cpp b/Source/ZenLib/Dir.cpp index 8091311..032a9df 100644 --- a/Source/ZenLib/Dir.cpp +++ b/Source/ZenLib/Dir.cpp @@ -530,13 +530,13 @@ class GetAllFileNames_Private Dir::dirlist_t Options; HANDLE hFind; #ifdef UNICODE - WIN32_FIND_DATAW FindFileDataW; + WIN32_FIND_DATAW FindFileDataW{}; #else - WIN32_FIND_DATA FindFileData; + WIN32_FIND_DATA FindFileData{}; #endif //UNICODE GetAllFileNames_Private() - : hFind(INVALID_HANDLE_VALUE) + : Options(), hFind(INVALID_HANDLE_VALUE) { } }; diff --git a/Source/ZenLib/Format/Http/Http_Cookies.cpp b/Source/ZenLib/Format/Http/Http_Cookies.cpp index eb41690..207f8ee 100644 --- a/Source/ZenLib/Format/Http/Http_Cookies.cpp +++ b/Source/ZenLib/Format/Http/Http_Cookies.cpp @@ -100,8 +100,9 @@ void Cookies::Create_Lines(std::ostream& Out) struct tm *Gmt=gmtime(&Cookie->second.Expires); #endif - if (strftime(Temp, 200, "%a, %d-%b-%Y %H:%M:%S GMT", Gmt)) - Out << "; expires=" << Temp; + if (Gmt) + if (strftime(Temp, 200, "%a, %d-%b-%Y %H:%M:%S GMT", Gmt)) + Out << "; expires=" << Temp; } if (!Cookie->second.Path.empty()) { diff --git a/Source/ZenLib/InfoMap.cpp b/Source/ZenLib/InfoMap.cpp index 2741bbb..d091b2f 100644 --- a/Source/ZenLib/InfoMap.cpp +++ b/Source/ZenLib/InfoMap.cpp @@ -38,14 +38,14 @@ const Ztring InfoMap_EmptyZtring_Const; //Use it when we can't return a referenc //--------------------------------------------------------------------------- // Constructors InfoMap::InfoMap() -: std::multimap () +: std::multimap (), Max() { Separator[0]=EOL; Separator[1]=__T(";"); } InfoMap::InfoMap(const Ztring &Source) -: std::multimap () +: std::multimap (), Max() { Separator[0]=EOL; Separator[1]=__T(";"); @@ -53,7 +53,7 @@ InfoMap::InfoMap(const Ztring &Source) } InfoMap::InfoMap(const Char *Source) -: std::multimap () +: std::multimap (), Max() { Separator[0]=EOL; Separator[1]=__T(";"); @@ -62,7 +62,7 @@ InfoMap::InfoMap(const Char *Source) #ifdef _UNICODE InfoMap::InfoMap (const char* S) -: std::multimap () +: std::multimap (), Max() { Separator[0]=EOL; Separator[1]=__T(";"); diff --git a/Source/ZenLib/Thread.cpp b/Source/ZenLib/Thread.cpp index f8dde1b..fd18303 100644 --- a/Source/ZenLib/Thread.cpp +++ b/Source/ZenLib/Thread.cpp @@ -304,6 +304,7 @@ Thread::returnvalue Thread::ForceTerminate() CriticalSectionLocker CSL(C); //Terminating (not clean) + #pragma warning ( suppress : 6258 ) //C6258: Using TerminateThread does not allow proper thread clean up. TerminateThread((HANDLE)ThreadPointer, 1); ThreadPointer=NULL; diff --git a/Source/ZenLib/Translation.cpp b/Source/ZenLib/Translation.cpp index a58a012..af628cd 100644 --- a/Source/ZenLib/Translation.cpp +++ b/Source/ZenLib/Translation.cpp @@ -34,7 +34,7 @@ namespace ZenLib //--------------------------------------------------------------------------- // Constructors Translation::Translation() -: std::map () +: std::map (), Max() { Separator[0]=EOL; Separator[1]=__T(";"); diff --git a/Source/ZenLib/Ztring.cpp b/Source/ZenLib/Ztring.cpp index 027a29c..1f00638 100644 --- a/Source/ZenLib/Ztring.cpp +++ b/Source/ZenLib/Ztring.cpp @@ -1654,23 +1654,23 @@ std::string Ztring::To_UTF8 () const case 6: utf8chars[5] = 0x80 | (wc & 0x3f); wc = (wc >> 6) | 0x4000000; - /* fallthrough */ + [[fallthrough]]; case 5: utf8chars[4] = 0x80 | (wc & 0x3f); wc = (wc >> 6) | 0x200000; - /* fallthrough */ + [[fallthrough]]; case 4: utf8chars[3] = 0x80 | (wc & 0x3f); wc = (wc >> 6) | 0x10000; - /* fallthrough */ + [[fallthrough]]; case 3: utf8chars[2] = 0x80 | (wc & 0x3f); wc = (wc >> 6) | 0x800; - /* fallthrough */ + [[fallthrough]]; case 2: utf8chars[1] = 0x80 | (wc & 0x3f); wc = (wc >> 6) | 0xc0; - /* fallthrough */ + [[fallthrough]]; case 1: utf8chars[0] = (char) wc; } @@ -1867,7 +1867,7 @@ int8s Ztring::To_int8s (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=Error) + if (Options&Ztring_Rounded && find(__T('.'))!=Error) { float80 F=To_float80(); F-=I; @@ -1905,7 +1905,7 @@ int8u Ztring::To_int8u (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=std::string::npos) + if (Options&Ztring_Rounded && find(__T('.'))!=std::string::npos) { float32 F=To_float32(); F-=I; @@ -1943,7 +1943,7 @@ int16s Ztring::To_int16s (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=Error) + if (Options&Ztring_Rounded && find(__T('.'))!=Error) { float80 F=To_float80(); F-=I; @@ -1981,7 +1981,7 @@ int16u Ztring::To_int16u (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=std::string::npos) + if (Options&Ztring_Rounded && find(__T('.'))!=std::string::npos) { float32 F=To_float32(); F-=I; @@ -2019,7 +2019,7 @@ int32s Ztring::To_int32s (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=Error) + if (Options&Ztring_Rounded && find(__T('.'))!=Error) { float80 F=To_float80(); F-=I; @@ -2057,7 +2057,7 @@ int32u Ztring::To_int32u (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=std::string::npos) + if (Options&Ztring_Rounded && find(__T('.'))!=std::string::npos) { float32 F=To_float32(); F-=I; @@ -2095,7 +2095,7 @@ int64s Ztring::To_int64s (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=std::string::npos) + if (Options&Ztring_Rounded && find(__T('.'))!=std::string::npos) { float32 F=To_float32(); F-=I; @@ -2133,7 +2133,7 @@ int64u Ztring::To_int64u (int8u Radix, ztring_t Options) const #endif //Rounded - if (Options==Ztring_Rounded && find(__T('.'))!=std::string::npos) + if (Options&Ztring_Rounded && find(__T('.'))!=std::string::npos) { float32 F=To_float32(); F-=I; diff --git a/Source/ZenLib/ZtringList.cpp b/Source/ZenLib/ZtringList.cpp index 4e960ad..0e2b516 100644 --- a/Source/ZenLib/ZtringList.cpp +++ b/Source/ZenLib/ZtringList.cpp @@ -39,7 +39,7 @@ extern Ztring EmptyZtring; //--------------------------------------------------------------------------- // Constructors ZtringList::ZtringList () -: std::vector > () +: std::vector > (), Max() { Separator[0]=__T(";"); Quote=__T("\""); @@ -47,7 +47,7 @@ ZtringList::ZtringList () } ZtringList::ZtringList(const ZtringList &Source) -: std::vector > () +: std::vector > (), Max() { Separator[0]=Source.Separator[0]; Quote=Source.Quote;