You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(189) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@op...> - 2024-03-02 23:08:09
|
Author: sagamusix Date: Sun Mar 3 00:08:03 2024 New Revision: 20184 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20184 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md ============================================================================== --- branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Mar 2 23:36:48 2024 (r20183) +++ branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sun Mar 3 00:08:03 2024 (r20184) @@ -13,6 +13,23 @@ * openmpt123: openmpt123 now uses a narrower layout on terminal windows with a width of less than 72 characters. + * Setting all possible `load_skip` flags resulted in nothing being loaded at + all, instead of just not loading the selected module parts. + * When playing all subsongs, `set_position_seconds` didn't always calculate + the correct subsong to jump to. + + * IT: A few more compatibility flags are now disabled for modules saved with + earlier Schism Tracker versions. + * IT: MIDI macros were reset in IT 2.14 / 2.15 files that declared to be + compatible with older IT versions (fixes spx-visionsofthepast.it). + * OKT: Work around missing negative arpeggio implementation by transposing the + notes up an octave. + * OKT: Channel volume commands were sometimes lost over less important + effects. + * IMF: Ignore magic bytes in sample header. "Leaving All Behind" by Karsten + Koch uses unexpected magic bytes, Orpheus ignores them just like the + instrument header magic bytes. + * zlib: Update to v1.3.1 (2024-01-22). * mpg123: Update to v1.32.5 (2024-02-17). * pugixml: Update to v1.14 (2023-10-01). |
From: <sv...@op...> - 2024-03-02 22:36:55
|
Author: sagamusix Date: Sat Mar 2 23:36:48 2024 New Revision: 20183 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20183 Log: [Mod] MIDI I/O Plugin: Try harder to retain previously-used device in case it disappears and then becomes available again. Modified: trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp trunk/OpenMPT/mptrack/plugins/MidiInOut.h Modified: trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp ============================================================================== --- trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp Sat Mar 2 23:31:19 2024 (r20182) +++ trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp Sat Mar 2 23:36:48 2024 (r20183) @@ -94,8 +94,8 @@ const std::string programName8 = mpt::ToCharset(mpt::Charset::UTF8, m_programName); uint32 flags = kLatencyCompensation | kLatencyPresent | (m_sendTimingInfo ? 0 : kIgnoreTiming); #ifdef MODPLUG_TRACKER - const std::string inFriendlyName = (m_inputDevice.index == MidiDevice::NO_MIDI_DEVICE) ? m_inputDevice.name : mpt::ToCharset(mpt::Charset::UTF8, theApp.GetFriendlyMIDIPortName(mpt::ToUnicode(mpt::Charset::UTF8, m_inputDevice.name), true, false)); - const std::string outFriendlyName = (m_outputDevice.index == MidiDevice::NO_MIDI_DEVICE) ? m_outputDevice.name : mpt::ToCharset(mpt::Charset::UTF8, theApp.GetFriendlyMIDIPortName(mpt::ToUnicode(mpt::Charset::UTF8, m_outputDevice.name), false, false)); + const std::string inFriendlyName = (m_inputDevice.index != MidiDevice::NO_MIDI_DEVICE && !m_inputDevice.friendlyName.empty()) ? mpt::ToCharset(mpt::Charset::UTF8, m_inputDevice.friendlyName) : m_inputDevice.name; + const std::string outFriendlyName = (m_outputDevice.index != MidiDevice::NO_MIDI_DEVICE && !m_outputDevice.friendlyName.empty()) ? mpt::ToCharset(mpt::Charset::UTF8, m_outputDevice.friendlyName) : m_outputDevice.name; if(inFriendlyName != m_inputDevice.name) { flags |= kFriendlyInputName; @@ -107,7 +107,7 @@ #endif std::ostringstream s; - mpt::IO::WriteRaw(s, "fEvN", 4); // VST program chunk magic + mpt::IO::WriteRaw(s, "fEvN", 4); // VST program chunk magic mpt::IO::WriteIntLE< int32>(s, GetVersion()); mpt::IO::WriteIntLE<uint32>(s, 1); // Number of programs mpt::IO::WriteIntLE<uint32>(s, static_cast<uint32>(programName8.size())); @@ -138,7 +138,7 @@ // Try to match a port name against stored name or friendly name (preferred) -static void FindPort(MidiDevice::ID &id, unsigned int numPorts, const std::string &name, const std::string &friendlyName, MidiDevice &midiDevice, bool isInput) +static void FindPort(MidiDevice::ID &id, unsigned int numPorts, const std::string &name, const mpt::ustring &friendlyName, MidiDevice &midiDevice, bool isInput) { bool foundFriendly = false; for(unsigned int i = 0; i < numPorts; i++) @@ -148,7 +148,7 @@ auto portName = midiDevice.GetPortName(i); bool deviceNameMatches = (portName == name); #ifdef MODPLUG_TRACKER - if(!friendlyName.empty() && friendlyName == mpt::ToCharset(mpt::Charset::UTF8, theApp.GetFriendlyMIDIPortName(mpt::ToUnicode(mpt::Charset::UTF8, portName), isInput, false))) + if(!friendlyName.empty() && friendlyName == theApp.GetFriendlyMIDIPortName(mpt::ToUnicode(mpt::Charset::UTF8, portName), isInput, false)) { // Preferred match id = i; @@ -207,8 +207,10 @@ file.ReadSizedString<uint32le, mpt::String::maybeNullTerminated>(outFriendlyName); // Try to match an input port name against stored name or friendly name (preferred) - FindPort(inID, m_midiIn.getPortCount(), inName, inFriendlyName, m_inputDevice, true); - FindPort(outID, m_midiOut.getPortCount(), outName, outFriendlyName, m_outputDevice, false); + m_inputDevice.friendlyName = mpt::ToUnicode(mpt::Charset::UTF8, inFriendlyName); + m_outputDevice.friendlyName = mpt::ToUnicode(mpt::Charset::UTF8, outFriendlyName); + FindPort(inID, m_midiIn.getPortCount(), inName, m_inputDevice.friendlyName, m_inputDevice, true); + FindPort(outID, m_midiOut.getPortCount(), outName, m_outputDevice.friendlyName, m_outputDevice, false); SetParameter(MidiInOut::kInputParameter, DeviceIDToParameter(inID)); SetParameter(MidiInOut::kOutputParameter, DeviceIDToParameter(outID)); @@ -403,8 +405,8 @@ { if(m_sendTimingInfo && !m_SndFile.IsPaused()) { - MidiSend(0xFC); // Stop - MidiSend(0xFA); // Start + MidiSend(0xFC); // Stop + MidiSend(0xFA); // Start } } @@ -487,17 +489,13 @@ // Open a device for input or output. void MidiInOut::OpenDevice(MidiDevice newDevice, bool asInputDevice) { - std::string friendlyName; -#ifdef MODPLUG_TRACKER - friendlyName = mpt::ToCharset(mpt::Charset::UTF8, theApp.GetFriendlyMIDIPortName(mpt::ToUnicode(mpt::Charset::UTF8, newDevice.name), asInputDevice, false)); -#endif // MODPLUG_TRACKER - FindPort(newDevice.index, asInputDevice ? m_midiIn.getPortCount() : m_midiOut.getPortCount(), newDevice.name, friendlyName, newDevice, asInputDevice); - SetParameter(asInputDevice ? MidiInOut::kInputParameter : MidiInOut::kOutputParameter, DeviceIDToParameter(newDevice.index)); + FindPort(newDevice.index, asInputDevice ? m_midiIn.getPortCount() : m_midiOut.getPortCount(), newDevice.name, newDevice.friendlyName, newDevice, asInputDevice); + OpenDevice(newDevice.index, asInputDevice, false); } // Open a device for input or output. -void MidiInOut::OpenDevice(MidiDevice::ID newDevice, bool asInputDevice) +void MidiInOut::OpenDevice(MidiDevice::ID newDevice, bool asInputDevice, bool updateName) { MidiDevice &device = asInputDevice ? m_inputDevice : m_outputDevice; @@ -515,11 +513,18 @@ if(device.index == kNoDevice) { // Dummy device - device.name = "<none>"; + if(updateName) + device.name = "<none>"; return; } - device.name = device.GetPortName(newDevice); + if(updateName) + { + device.name = device.GetPortName(newDevice); +#ifdef MODPLUG_TRACKER + device.friendlyName = theApp.GetFriendlyMIDIPortName(mpt::ToUnicode(mpt::Charset::UTF8, device.name), asInputDevice, false); +#endif // MODPLUG_TRACKER + } //if(m_isResumed) { mpt::lock_guard<mpt::mutex> lock(m_mutex); Modified: trunk/OpenMPT/mptrack/plugins/MidiInOut.h ============================================================================== --- trunk/OpenMPT/mptrack/plugins/MidiInOut.h Sat Mar 2 23:31:19 2024 (r20182) +++ trunk/OpenMPT/mptrack/plugins/MidiInOut.h Sat Mar 2 23:36:48 2024 (r20183) @@ -31,6 +31,7 @@ RtMidi &stream; std::string name; // Charset::UTF8 + mpt::ustring friendlyName; ID index = NO_MIDI_DEVICE; public: @@ -217,7 +218,7 @@ protected: // Open a device for input or output. void OpenDevice(MidiDevice newDevice, bool asInputDevice); - void OpenDevice(MidiDevice::ID newDevice, bool asInputDevice); + void OpenDevice(MidiDevice::ID newDevice, bool asInputDevice, bool updateName = true); // Close an active device. void CloseDevice(MidiDevice &device); |
From: <sv...@op...> - 2024-03-02 22:31:36
|
Author: sagamusix Date: Sat Mar 2 23:31:19 2024 New Revision: 20182 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20182 Log: Merged revision(s) 20181 from trunk/OpenMPT: [Var] unrar: Update to v7.0.7. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/include/unrar/OpenMPT.txt branches/OpenMPT-1.31/include/unrar/arccmt.cpp branches/OpenMPT-1.31/include/unrar/archive.cpp branches/OpenMPT-1.31/include/unrar/archive.hpp branches/OpenMPT-1.31/include/unrar/arcread.cpp branches/OpenMPT-1.31/include/unrar/blake2s.cpp branches/OpenMPT-1.31/include/unrar/blake2s_sse.cpp branches/OpenMPT-1.31/include/unrar/blake2sp.cpp branches/OpenMPT-1.31/include/unrar/cmddata.cpp branches/OpenMPT-1.31/include/unrar/cmddata.hpp branches/OpenMPT-1.31/include/unrar/cmdfilter.cpp branches/OpenMPT-1.31/include/unrar/cmdmix.cpp branches/OpenMPT-1.31/include/unrar/coder.cpp branches/OpenMPT-1.31/include/unrar/coder.hpp branches/OpenMPT-1.31/include/unrar/compress.hpp branches/OpenMPT-1.31/include/unrar/consio.cpp branches/OpenMPT-1.31/include/unrar/consio.hpp branches/OpenMPT-1.31/include/unrar/crc.cpp branches/OpenMPT-1.31/include/unrar/crc.hpp branches/OpenMPT-1.31/include/unrar/crypt.cpp branches/OpenMPT-1.31/include/unrar/crypt.hpp branches/OpenMPT-1.31/include/unrar/crypt1.cpp branches/OpenMPT-1.31/include/unrar/crypt5.cpp branches/OpenMPT-1.31/include/unrar/dll.cpp branches/OpenMPT-1.31/include/unrar/dll.hpp branches/OpenMPT-1.31/include/unrar/encname.cpp branches/OpenMPT-1.31/include/unrar/encname.hpp branches/OpenMPT-1.31/include/unrar/errhnd.cpp branches/OpenMPT-1.31/include/unrar/errhnd.hpp branches/OpenMPT-1.31/include/unrar/extinfo.cpp branches/OpenMPT-1.31/include/unrar/extinfo.hpp branches/OpenMPT-1.31/include/unrar/extract.cpp branches/OpenMPT-1.31/include/unrar/extract.hpp branches/OpenMPT-1.31/include/unrar/filcreat.cpp branches/OpenMPT-1.31/include/unrar/filcreat.hpp branches/OpenMPT-1.31/include/unrar/file.cpp branches/OpenMPT-1.31/include/unrar/file.hpp branches/OpenMPT-1.31/include/unrar/filefn.cpp branches/OpenMPT-1.31/include/unrar/filefn.hpp branches/OpenMPT-1.31/include/unrar/filestr.cpp branches/OpenMPT-1.31/include/unrar/filestr.hpp branches/OpenMPT-1.31/include/unrar/find.cpp branches/OpenMPT-1.31/include/unrar/find.hpp branches/OpenMPT-1.31/include/unrar/getbits.cpp branches/OpenMPT-1.31/include/unrar/getbits.hpp branches/OpenMPT-1.31/include/unrar/hardlinks.cpp branches/OpenMPT-1.31/include/unrar/hash.cpp branches/OpenMPT-1.31/include/unrar/hash.hpp branches/OpenMPT-1.31/include/unrar/headers.cpp branches/OpenMPT-1.31/include/unrar/headers.hpp branches/OpenMPT-1.31/include/unrar/headers5.hpp branches/OpenMPT-1.31/include/unrar/isnt.cpp branches/OpenMPT-1.31/include/unrar/list.cpp branches/OpenMPT-1.31/include/unrar/loclang.hpp branches/OpenMPT-1.31/include/unrar/log.cpp branches/OpenMPT-1.31/include/unrar/log.hpp branches/OpenMPT-1.31/include/unrar/match.cpp branches/OpenMPT-1.31/include/unrar/match.hpp branches/OpenMPT-1.31/include/unrar/model.cpp branches/OpenMPT-1.31/include/unrar/model.hpp branches/OpenMPT-1.31/include/unrar/options.cpp branches/OpenMPT-1.31/include/unrar/options.hpp branches/OpenMPT-1.31/include/unrar/os.hpp branches/OpenMPT-1.31/include/unrar/pathfn.cpp branches/OpenMPT-1.31/include/unrar/pathfn.hpp branches/OpenMPT-1.31/include/unrar/qopen.cpp branches/OpenMPT-1.31/include/unrar/qopen.hpp branches/OpenMPT-1.31/include/unrar/rar.cpp branches/OpenMPT-1.31/include/unrar/rar.hpp branches/OpenMPT-1.31/include/unrar/rardefs.hpp branches/OpenMPT-1.31/include/unrar/raros.hpp branches/OpenMPT-1.31/include/unrar/rartypes.hpp branches/OpenMPT-1.31/include/unrar/rarvm.cpp branches/OpenMPT-1.31/include/unrar/rawint.hpp branches/OpenMPT-1.31/include/unrar/rawread.cpp branches/OpenMPT-1.31/include/unrar/rawread.hpp branches/OpenMPT-1.31/include/unrar/rdwrfn.cpp branches/OpenMPT-1.31/include/unrar/rdwrfn.hpp branches/OpenMPT-1.31/include/unrar/recvol.cpp branches/OpenMPT-1.31/include/unrar/recvol.hpp branches/OpenMPT-1.31/include/unrar/recvol3.cpp branches/OpenMPT-1.31/include/unrar/recvol5.cpp branches/OpenMPT-1.31/include/unrar/resource.cpp branches/OpenMPT-1.31/include/unrar/resource.hpp branches/OpenMPT-1.31/include/unrar/rijndael.cpp branches/OpenMPT-1.31/include/unrar/rijndael.hpp branches/OpenMPT-1.31/include/unrar/rs16.cpp branches/OpenMPT-1.31/include/unrar/rs16.hpp branches/OpenMPT-1.31/include/unrar/scantree.cpp branches/OpenMPT-1.31/include/unrar/scantree.hpp branches/OpenMPT-1.31/include/unrar/secpassword.cpp branches/OpenMPT-1.31/include/unrar/secpassword.hpp branches/OpenMPT-1.31/include/unrar/sha256.cpp branches/OpenMPT-1.31/include/unrar/sha256.hpp branches/OpenMPT-1.31/include/unrar/strfn.cpp branches/OpenMPT-1.31/include/unrar/strfn.hpp branches/OpenMPT-1.31/include/unrar/strlist.cpp branches/OpenMPT-1.31/include/unrar/strlist.hpp branches/OpenMPT-1.31/include/unrar/system.cpp branches/OpenMPT-1.31/include/unrar/system.hpp branches/OpenMPT-1.31/include/unrar/timefn.cpp branches/OpenMPT-1.31/include/unrar/timefn.hpp branches/OpenMPT-1.31/include/unrar/ui.hpp branches/OpenMPT-1.31/include/unrar/uicommon.cpp branches/OpenMPT-1.31/include/unrar/uiconsole.cpp branches/OpenMPT-1.31/include/unrar/uisilent.cpp branches/OpenMPT-1.31/include/unrar/ulinks.cpp branches/OpenMPT-1.31/include/unrar/unicode.cpp branches/OpenMPT-1.31/include/unrar/unicode.hpp branches/OpenMPT-1.31/include/unrar/unpack.cpp branches/OpenMPT-1.31/include/unrar/unpack.hpp branches/OpenMPT-1.31/include/unrar/unpack15.cpp branches/OpenMPT-1.31/include/unrar/unpack20.cpp branches/OpenMPT-1.31/include/unrar/unpack30.cpp branches/OpenMPT-1.31/include/unrar/unpack50.cpp branches/OpenMPT-1.31/include/unrar/unpack50frag.cpp branches/OpenMPT-1.31/include/unrar/unpack50mt.cpp branches/OpenMPT-1.31/include/unrar/unpackinline.cpp branches/OpenMPT-1.31/include/unrar/uowners.cpp branches/OpenMPT-1.31/include/unrar/version.hpp branches/OpenMPT-1.31/include/unrar/volume.cpp branches/OpenMPT-1.31/include/unrar/win32acl.cpp branches/OpenMPT-1.31/include/unrar/win32lnk.cpp branches/OpenMPT-1.31/include/unrar/win32stm.cpp Modified: branches/OpenMPT-1.31/include/unrar/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.31/include/unrar/OpenMPT.txt Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/OpenMPT.txt Sat Mar 2 23:31:19 2024 (r20182) @@ -1,4 +1,4 @@ -This folder is based on https://rarlab.com/rar/unrarsrc-6.2.10.tar.gz +This folder is based on https://rarlab.com/rar/unrarsrc-7.0.7.tar.gz All modifications to existing files have been done in a manner so that no existing lines were edited; only new lines were added. @@ -10,9 +10,9 @@ never be used in OpenMPT's context. The following files have been modified: -arcread.cpp, extract.cpp, filcreat.cpp, file.cpp, filefn.cpp, find.cpp, -match.cpp, os.hpp, pathfn.cpp, rdwrfn.cpp, secpassword.cpp, system.cpp, -volume.cpp, win32acl.cpp, win32lnk.cpp +extract.cpp, filcreat.cpp, file.cpp, filefn.cpp, find.cpp, match.cpp, +os.hpp, pathfn.cpp, rdwrfn.cpp, secpassword.cpp, volume.cpp, +win32acl.cpp, win32lnk.cpp For building, premake is used to generate Visual Studio project files. See ../build/premake/ for details. Modified: branches/OpenMPT-1.31/include/unrar/arccmt.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/arccmt.cpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/arccmt.cpp Sat Mar 2 23:31:19 2024 (r20182) @@ -1,6 +1,6 @@ static bool IsAnsiEscComment(const wchar *Data,size_t Size); -bool Archive::GetComment(Array<wchar> *CmtData) +bool Archive::GetComment(std::wstring &CmtData) { if (!MainComment) return false; @@ -11,7 +11,7 @@ } -bool Archive::DoGetComment(Array<wchar> *CmtData) +bool Archive::DoGetComment(std::wstring &CmtData) { #ifndef SFX_MODULE uint CmtLength; @@ -101,10 +101,9 @@ // 4x memory for OEM to UTF-8 output here. OemToCharBuffA((char *)UnpData,(char *)UnpData,(DWORD)UnpDataSize); #endif - CmtData->Alloc(UnpDataSize+1); - memset(CmtData->Addr(0),0,CmtData->Size()*sizeof(wchar)); - CharToWide((char *)UnpData,CmtData->Addr(0),CmtData->Size()); - CmtData->Alloc(wcslen(CmtData->Addr(0))); +// CmtData.resize(UnpDataSize+1); + CharToWide((const char *)UnpData,CmtData); +// CmtData.resize(wcslen(CmtData->data())); } } } @@ -112,12 +111,12 @@ { if (CmtLength==0) return false; - Array<byte> CmtRaw(CmtLength); - int ReadSize=Read(&CmtRaw[0],CmtLength); + std::vector<byte> CmtRaw(CmtLength); + int ReadSize=Read(CmtRaw.data(),CmtLength); if (ReadSize>=0 && (uint)ReadSize<CmtLength) // Comment is shorter than declared. { CmtLength=ReadSize; - CmtRaw.Alloc(CmtLength); + CmtRaw.resize(CmtLength); } if (Format!=RARFMT14 && CommHead.CommCRC!=(~CRC32(0xffffffff,&CmtRaw[0],CmtLength)&0xffff)) @@ -125,43 +124,41 @@ uiMsg(UIERROR_CMTBROKEN,FileName); return false; } - CmtData->Alloc(CmtLength+1); - CmtRaw.Push(0); +// CmtData.resize(CmtLength+1); + CmtRaw.push_back(0); #ifdef _WIN_ALL // If we ever decide to extend it to Android, we'll need to alloc // 4x memory for OEM to UTF-8 output here. - OemToCharA((char *)&CmtRaw[0],(char *)&CmtRaw[0]); + OemToCharA((char *)CmtRaw.data(),(char *)CmtRaw.data()); #endif - CharToWide((char *)&CmtRaw[0],CmtData->Addr(0),CmtData->Size()); - CmtData->Alloc(wcslen(CmtData->Addr(0))); + CharToWide((const char *)CmtRaw.data(),CmtData); +// CmtData->resize(wcslen(CmtData->data())); } #endif - return CmtData->Size() > 0; + return CmtData.size() > 0; } -bool Archive::ReadCommentData(Array<wchar> *CmtData) +bool Archive::ReadCommentData(std::wstring &CmtData) { - Array<byte> CmtRaw; + std::vector<byte> CmtRaw; if (!ReadSubData(&CmtRaw,NULL,false)) return false; - size_t CmtSize=CmtRaw.Size(); - CmtRaw.Push(0); - CmtData->Alloc(CmtSize+1); + size_t CmtSize=CmtRaw.size(); + CmtRaw.push_back(0); +// CmtData->resize(CmtSize+1); if (Format==RARFMT50) - UtfToWide((char *)&CmtRaw[0],CmtData->Addr(0),CmtData->Size()); + UtfToWide((char *)CmtRaw.data(),CmtData); else if ((SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE)!=0) { - RawToWide(&CmtRaw[0],CmtData->Addr(0),CmtSize/2); - (*CmtData)[CmtSize/2]=0; - + CmtData=RawToWide(CmtRaw); } else { - CharToWide((char *)&CmtRaw[0],CmtData->Addr(0),CmtData->Size()); + CharToWide((const char *)CmtRaw.data(),CmtData); } - CmtData->Alloc(wcslen(CmtData->Addr(0))); // Set buffer size to actual comment length. +// CmtData->resize(wcslen(CmtData->data())); // Set buffer size to actual comment length. return true; } @@ -170,15 +167,16 @@ { if (Cmd->DisableComment) return; - Array<wchar> CmtBuf; - if (GetComment(&CmtBuf)) // In GUI too, so "Test" command detects broken comments. + std::wstring CmtBuf; + if (GetComment(CmtBuf)) // In GUI too, so "Test" command detects broken comments. { - size_t CmtSize=CmtBuf.Size(); - wchar *ChPtr=wcschr(&CmtBuf[0],0x1A); - if (ChPtr!=NULL) - CmtSize=ChPtr-&CmtBuf[0]; - mprintf(L"\n"); - OutComment(&CmtBuf[0],CmtSize); + size_t CmtSize=CmtBuf.size(); + auto EndPos=CmtBuf.find(0x1A); + if (EndPos!=std::wstring::npos) + CmtSize=EndPos; + mprintf(St(MArcComment)); + mprintf(L":\n"); + OutComment(CmtBuf); } } Modified: branches/OpenMPT-1.31/include/unrar/archive.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/archive.cpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/archive.cpp Sat Mar 2 23:31:19 2024 (r20182) @@ -39,7 +39,6 @@ VolWrite=0; AddingFilesSize=0; AddingHeadersSize=0; - *FirstVolumeName=0; Splitting=false; NewArchive=false; @@ -74,7 +73,7 @@ #if !defined(SFX_MODULE) -void Archive::CheckOpen(const wchar *Name) +void Archive::CheckOpen(const std::wstring &Name) { TOpen(Name); CheckArc(false); @@ -82,7 +81,7 @@ #endif -bool Archive::WCheckOpen(const wchar *Name) +bool Archive::WCheckOpen(const std::wstring &Name) { if (!WOpen(Name)) return false; @@ -148,9 +147,9 @@ } else { - Array<char> Buffer(MAXSFXSIZE); + std::vector<char> Buffer(MAXSFXSIZE); long CurPos=(long)Tell(); - int ReadSize=Read(&Buffer[0],Buffer.Size()-16); + int ReadSize=Read(Buffer.data(),Buffer.size()-16); for (int I=0;I<ReadSize;I++) if (Buffer[I]==0x52 && (Type=IsSignature((byte *)&Buffer[I],ReadSize-I))!=RARFMT_NONE) { @@ -265,7 +264,7 @@ Seek(SavePos,SEEK_SET); } if (!Volume || FirstVolume) - wcsncpyz(FirstVolumeName,FileName,ASIZE(FirstVolumeName)); + FirstVolumeName=FileName; return true; } @@ -301,7 +300,7 @@ #ifdef USE_QOPEN -bool Archive::Open(const wchar *Name,uint Mode) +bool Archive::Open(const std::wstring &Name,uint Mode) { // Important if we reuse Archive object and it has virtual QOpen // file position not matching real. For example, for 'l -v volname'. @@ -336,3 +335,23 @@ } #endif + +// Return 0 if dictionary size is invalid. If size is RAR7 only, return +// the adjusted nearest bottom value. Return header flags in Flags. +uint64 Archive::GetWinSize(uint64 Size,uint &Flags) +{ + Flags=0; + // Allow 128 KB - 1 TB range. + if (Size<0x20000 || Size>0x10000000000ULL) + return 0; + uint64 Pow2=0x20000; // Power of 2 dictionary size. + for (;2*Pow2<=Size;Pow2*=2) + Flags+=FCI_DICT_BIT0; + if (Size==Pow2) + return Size; // If 'Size' is the power of 2, return it as is. + + // Get the number of Pow2/32 to add to Pow2 for nearest value not exceeding 'Size'. + uint64 Fraction=(Size-Pow2)/(Pow2/32); + Flags+=(uint)Fraction*FCI_DICT_FRACT0; + return Pow2+Fraction*(Pow2/32); +} Modified: branches/OpenMPT-1.31/include/unrar/archive.hpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/archive.hpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/archive.hpp Sat Mar 2 23:31:19 2024 (r20182) @@ -27,7 +27,7 @@ { private: void UpdateLatestTime(FileHeader *CurBlock); - void ConvertNameCase(wchar *Name); + void ConvertNameCase(std::wstring &Name); void ConvertFileHeader(FileHeader *hd); size_t ReadHeader14(); size_t ReadHeader15(); @@ -36,9 +36,9 @@ void RequestArcPassword(RarCheckPassword *SelPwd); void UnexpEndArcMsg(); void BrokenHeaderMsg(); - void UnkEncVerMsg(const wchar *Name,const wchar *Info); - bool DoGetComment(Array<wchar> *CmtData); - bool ReadCommentData(Array<wchar> *CmtData); + void UnkEncVerMsg(const std::wstring &Name,const std::wstring &Info); + bool DoGetComment(std::wstring &CmtData); + bool ReadCommentData(std::wstring &CmtData); #if !defined(RAR_NOCRYPT) CryptData HeadersCrypt; @@ -67,9 +67,9 @@ size_t SearchRR(); size_t ReadHeader(); void CheckArc(bool EnableBroken); - void CheckOpen(const wchar *Name); - bool WCheckOpen(const wchar *Name); - bool GetComment(Array<wchar> *CmtData); + void CheckOpen(const std::wstring &Name); + bool WCheckOpen(const std::wstring &Name); + bool GetComment(std::wstring &CmtData); void ViewComment(); void SetLatestTime(RarTime *NewTime); void SeekToNext(); @@ -79,23 +79,25 @@ void VolSubtractHeaderSize(size_t SubSize); uint FullHeaderSize(size_t Size); int64 GetStartPos(); - void AddSubData(byte *SrcData,uint64 DataSize,File *SrcFile, + void AddSubData(const byte *SrcData,uint64 DataSize,File *SrcFile, const wchar *Name,uint Flags); - bool ReadSubData(Array<byte> *UnpData,File *DestFile,bool TestMode); + bool ReadSubData(std::vector<byte> *UnpData,File *DestFile,bool TestMode); HEADER_TYPE GetHeaderType() {return CurHeaderType;} CommandData* GetCommandData() {return Cmd;} void SetSilentOpen(bool Mode) {SilentOpen=Mode;} -#if 0 - void GetRecoveryInfo(bool Required,int64 *Size,int *Percent); -#endif #ifdef USE_QOPEN - bool Open(const wchar *Name,uint Mode=FMF_READ); - int Read(void *Data,size_t Size); - void Seek(int64 Offset,int Method); - int64 Tell(); + bool Open(const std::wstring &Name,uint Mode=FMF_READ) override; + int Read(void *Data,size_t Size) override; + void Seek(int64 Offset,int Method) override; + int64 Tell() override; void QOpenUnload() {QOpen.Unload();} void SetProhibitQOpen(bool Mode) {ProhibitQOpen=Mode;} #endif + static uint64 GetWinSize(uint64 Size,uint &Flags); + + // Needed to see wstring based Open from File. Otherwise compiler finds + // Open in Archive and doesn't check the base class overloads. + using File::Open; BaseBlock ShortBlock; MarkHeader MarkHead; @@ -135,12 +137,16 @@ uint VolNumber; int64 VolWrite; + + // Total size of files adding to archive. Might also include the size of + // files repacked in solid archive. uint64 AddingFilesSize; + uint64 AddingHeadersSize; bool NewArchive; - wchar FirstVolumeName[NM]; + std::wstring FirstVolumeName; }; Modified: branches/OpenMPT-1.31/include/unrar/arcread.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/arcread.cpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/arcread.cpp Sat Mar 2 23:31:19 2024 (r20182) @@ -119,7 +119,7 @@ } -void Archive::UnkEncVerMsg(const wchar *Name,const wchar *Info) +void Archive::UnkEncVerMsg(const std::wstring &Name,const std::wstring &Info) { uiMsg(UIERROR_UNKNOWNENCMETHOD,FileName,Name,Info); ErrHandler.SetErrorCode(RARX_WARNING); @@ -222,7 +222,7 @@ { case HEAD_MAIN: MainHead.Reset(); - *(BaseBlock *)&MainHead=ShortBlock; + MainHead.SetBaseBlock(ShortBlock); MainHead.HighPosAV=Raw.Get2(); MainHead.PosAV=Raw.Get4(); @@ -248,7 +248,7 @@ FileHeader *hd=FileBlock ? &FileHead:&SubHead; hd->Reset(); - *(BaseBlock *)hd=ShortBlock; + hd->SetBaseBlock(ShortBlock); hd->SplitBefore=(hd->Flags & LHD_SPLIT_BEFORE)!=0; hd->SplitAfter=(hd->Flags & LHD_SPLIT_AFTER)!=0; @@ -307,7 +307,7 @@ if (hd->HostOS==HOST_UNIX && (hd->FileAttr & 0xF000)==0xA000) { hd->RedirType=FSREDIR_UNIXSYMLINK; - *hd->RedirName=0; + hd->RedirName.clear(); } hd->Inherited=!FileBlock && (hd->SubFlags & SUBHEAD_FLAGS_INHERITED)!=0; @@ -334,27 +334,26 @@ if (hd->UnknownUnpSize) hd->UnpSize=INT64NDF; - char FileName[NM*4]; - size_t ReadNameSize=Min(NameSize,ASIZE(FileName)-1); - Raw.GetB((byte *)FileName,ReadNameSize); - FileName[ReadNameSize]=0; + size_t ReadNameSize=Min(NameSize,MAXPATHSIZE); + std::string FileName(ReadNameSize,0); + Raw.GetB((byte *)&FileName[0],ReadNameSize); if (FileBlock) { - *hd->FileName=0; + hd->FileName.clear(); if ((hd->Flags & LHD_UNICODE)!=0) { EncodeFileName NameCoder; - size_t Length=strlen(FileName); + size_t Length=strlen(FileName.data()); Length++; if (ReadNameSize>Length) - NameCoder.Decode(FileName,ReadNameSize,(byte *)FileName+Length, - ReadNameSize-Length,hd->FileName, - ASIZE(hd->FileName)); + NameCoder.Decode(FileName.data(),ReadNameSize, + (byte *)&FileName[Length], + ReadNameSize-Length,hd->FileName); } - if (*hd->FileName==0) - ArcCharToWide(FileName,hd->FileName,ASIZE(hd->FileName),ACTW_OEM); + if (hd->FileName.empty()) + ArcCharToWide(FileName.data(),hd->FileName,ACTW_OEM); #ifndef SFX_MODULE ConvertNameCase(hd->FileName); @@ -363,7 +362,7 @@ } else { - CharToWide(FileName,hd->FileName,ASIZE(hd->FileName)); + CharToWide(FileName.data(),hd->FileName); // Calculate the size of optional data. int DataSize=int(hd->HeadSize-NameSize-SIZEOF_FILEHEAD3); @@ -374,14 +373,15 @@ { // Here we read optional additional fields for subheaders. // They are stored after the file name and before salt. - hd->SubData.Alloc(DataSize); - Raw.GetB(&hd->SubData[0],DataSize); + hd->SubData.resize(DataSize); + Raw.GetB(hd->SubData.data(),DataSize); } if (hd->CmpName(SUBHEAD_TYPE_CMT)) MainComment=true; } + if ((hd->Flags & LHD_SALT)!=0) Raw.GetB(hd->Salt,SIZE_SALT30); hd->mtime.SetDos(FileTime); @@ -424,7 +424,7 @@ NextBlockPos=SafeAdd(NextBlockPos,hd->PackSize,0); bool CRCProcessedOnly=hd->CommentInHeader; - ushort HeaderCRC=Raw.GetCRC15(CRCProcessedOnly); + uint HeaderCRC=Raw.GetCRC15(CRCProcessedOnly); if (hd->HeadCRC!=HeaderCRC) { BrokenHeader=true; @@ -441,7 +441,7 @@ } break; case HEAD_ENDARC: - *(BaseBlock *)&EndArcHead=ShortBlock; + EndArcHead.SetBaseBlock(ShortBlock); EndArcHead.NextVolume=(EndArcHead.Flags & EARC_NEXT_VOLUME)!=0; EndArcHead.DataCRC=(EndArcHead.Flags & EARC_DATACRC)!=0; EndArcHead.RevSpace=(EndArcHead.Flags & EARC_REVSPACE)!=0; @@ -453,14 +453,14 @@ break; #ifndef SFX_MODULE case HEAD3_CMT: - *(BaseBlock *)&CommHead=ShortBlock; + CommHead.SetBaseBlock(ShortBlock); CommHead.UnpSize=Raw.Get2(); CommHead.UnpVer=Raw.Get1(); CommHead.Method=Raw.Get1(); CommHead.CommCRC=Raw.Get2(); break; case HEAD3_PROTECT: - *(BaseBlock *)&ProtectHead=ShortBlock; + ProtectHead.SetBaseBlock(ShortBlock); ProtectHead.DataSize=Raw.Get4(); ProtectHead.Version=Raw.Get1(); ProtectHead.RecSectors=Raw.Get2(); @@ -469,7 +469,7 @@ NextBlockPos+=ProtectHead.DataSize; break; case HEAD3_OLDSERVICE: // RAR 2.9 and earlier. - *(BaseBlock *)&SubBlockHead=ShortBlock; + SubBlockHead.SetBaseBlock(ShortBlock); SubBlockHead.DataSize=Raw.Get4(); NextBlockPos+=SubBlockHead.DataSize; SubBlockHead.SubType=Raw.Get2(); @@ -490,10 +490,13 @@ StreamHead.Method=Raw.Get1(); StreamHead.StreamCRC=Raw.Get4(); StreamHead.StreamNameSize=Raw.Get2(); - if (StreamHead.StreamNameSize>=ASIZE(StreamHead.StreamName)) - StreamHead.StreamNameSize=ASIZE(StreamHead.StreamName)-1; - Raw.GetB(StreamHead.StreamName,StreamHead.StreamNameSize); - StreamHead.StreamName[StreamHead.StreamNameSize]=0; + + const size_t MaxStreamName20=260; // Maximum allowed stream name in RAR 2.x format. + if (StreamHead.StreamNameSize>MaxStreamName20) + StreamHead.StreamNameSize=MaxStreamName20; + + StreamHead.StreamName.resize(StreamHead.StreamNameSize); + Raw.GetB(&StreamHead.StreamName[0],StreamHead.StreamNameSize); break; } break; @@ -504,7 +507,7 @@ break; } - ushort HeaderCRC=Raw.GetCRC15(false); + uint HeaderCRC=Raw.GetCRC15(false); // Old AV header does not have header CRC properly set. // Old Unix owners header didn't include string fields into header size, @@ -646,7 +649,7 @@ } int SizeToRead=int(BlockSize); - SizeToRead-=FirstReadSize-SizeBytes-4; // Adjust overread size bytes if any. + SizeToRead-=int(FirstReadSize-SizeBytes-4); // Adjust overread size bytes if any. uint HeaderSize=4+SizeBytes+(uint)BlockSize; if (SizeToRead<0 || HeaderSize<SIZEOF_SHORTBLOCKHEAD5) @@ -711,13 +714,12 @@ { case HEAD_CRYPT: { - *(BaseBlock *)&CryptHead=ShortBlock; + CryptHead.SetBaseBlock(ShortBlock); uint CryptVersion=(uint)Raw.GetV(); if (CryptVersion>CRYPT_VERSION) { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"h%u",CryptVersion); - UnkEncVerMsg(FileName,Info); + UnkEncVerMsg(FileName,L"h" + std::to_wstring(CryptVersion)); + FailedHeaderDecryption=true; return 0; } uint EncFlags=(uint)Raw.GetV(); @@ -725,9 +727,8 @@ CryptHead.Lg2Count=Raw.Get1(); if (CryptHead.Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX) { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"hc%u",CryptHead.Lg2Count); - UnkEncVerMsg(FileName,Info); + UnkEncVerMsg(FileName,L"hc" + std::to_wstring(CryptHead.Lg2Count)); + FailedHeaderDecryption=true; return 0; } @@ -739,12 +740,8 @@ byte csum[SIZE_PSWCHECK_CSUM]; Raw.GetB(csum,SIZE_PSWCHECK_CSUM); - sha256_context ctx; - sha256_init(&ctx); - sha256_process(&ctx, CryptHead.PswCheck, SIZE_PSWCHECK); - byte Digest[SHA256_DIGEST_SIZE]; - sha256_done(&ctx, Digest); + sha256_get(CryptHead.PswCheck, SIZE_PSWCHECK, Digest); CryptHead.UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; } @@ -754,7 +751,7 @@ case HEAD_MAIN: { MainHead.Reset(); - *(BaseBlock *)&MainHead=ShortBlock; + MainHead.SetBaseBlock(ShortBlock); uint ArcFlags=(uint)Raw.GetV(); Volume=(ArcFlags & MHFL_VOLUME)!=0; @@ -832,9 +829,14 @@ // we may need to use the compression algorithm 15 in the future, // but it was already used in RAR 1.5 and Unpack needs to distinguish // them. - hd->UnpVer=(CompInfo & 0x3f) + 50; - if (hd->UnpVer!=50) // Only 5.0 compression is known now. - hd->UnpVer=VER_UNKNOWN; + uint UnpVer=(CompInfo & 0x3f); + if (UnpVer==0) + hd->UnpVer=VER_PACK5; + else + if (UnpVer==1) + hd->UnpVer=VER_PACK7; + else + hd->UnpVer=VER_UNKNOWN; hd->HostOS=(byte)Raw.GetV(); size_t NameSize=(size_t)Raw.GetV(); @@ -852,14 +854,29 @@ hd->SubBlock=(hd->Flags & HFL_CHILD)!=0; hd->Solid=FileBlock && (CompInfo & FCI_SOLID)!=0; hd->Dir=(hd->FileFlags & FHFL_DIRECTORY)!=0; - hd->WinSize=hd->Dir ? 0:size_t(0x20000)<<((CompInfo>>10)&0xf); + if (hd->Dir || UnpVer>1) + hd->WinSize=0; + else + { + hd->WinSize=0x20000ULL<<((CompInfo>>10)&(UnpVer==0 ? 0x0f:0x1f)); + if (UnpVer==1) + { + hd->WinSize+=hd->WinSize/32*((CompInfo>>15)&0x1f); - char FileName[NM*4]; - size_t ReadNameSize=Min(NameSize,ASIZE(FileName)-1); - Raw.GetB((byte *)FileName,ReadNameSize); - FileName[ReadNameSize]=0; + // RAR7 header with RAR5 compression. Needed to append RAR7 files + // to RAR5 solid stream if new dictionary is larger than existing. + if ((CompInfo & FCI_RAR5_COMPAT)!=0) + hd->UnpVer=VER_PACK5; + if (hd->WinSize>UNPACK_MAX_DICT) + hd->UnpVer=VER_UNKNOWN; + } + } - UtfToWide(FileName,hd->FileName,ASIZE(hd->FileName)); + size_t ReadNameSize=Min(NameSize,MAXPATHSIZE); + std::string FileName(ReadNameSize,0); + Raw.GetB((byte *)&FileName[0],ReadNameSize); + + UtfToWide(FileName.data(),hd->FileName); // Should do it before converting names, because extra fields can // affect name processing, like in case of NTFS streams. @@ -884,7 +901,7 @@ break; case HEAD_ENDARC: { - *(BaseBlock *)&EndArcHead=ShortBlock; + EndArcHead.SetBaseBlock(ShortBlock); uint ArcFlags=(uint)Raw.GetV(); EndArcHead.NextVolume=(ArcFlags & EHFL_NEXTVOLUME)!=0; EndArcHead.StoreVolNumber=false; @@ -916,7 +933,7 @@ *PasswordA=0; if (Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)PasswordA,ASIZE(PasswordA))==-1) *PasswordA=0; - GetWideName(PasswordA,NULL,PasswordW,ASIZE(PasswordW)); + CharToWide(PasswordA,PasswordW,ASIZE(PasswordW)); cleandata(PasswordA,sizeof(PasswordA)); } Cmd->Password.Set(PasswordW); @@ -991,19 +1008,14 @@ if ((Flags & MHEXTRA_METADATA_NAME)!=0) { uint64 NameSize=Raw->GetV(); - if (NameSize<0x10000) // Prevent excessive allocation. + if (NameSize>0 && NameSize<MAXPATHSIZE) // Prevent excessive allocation. { - std::vector<char> NameU((size_t)NameSize); // UTF-8 name. + std::string NameU((size_t)NameSize,0); // UTF-8 name. Raw->GetB(&NameU[0],(size_t)NameSize); // If starts from 0, the name was longer than reserved space // when saving this extra field. if (NameU[0]!=0) - { - NameU.push_back(0); - std::vector<wchar> NameW(NameU.size()*4); - UtfToWide(&NameU[0],&NameW[0],NameW.size()); - hd->OrigName.assign(&NameW[0]); - } + UtfToWide(&NameU[0],hd->OrigName); } } if ((Flags & MHEXTRA_METADATA_CTIME)!=0) @@ -1029,11 +1041,7 @@ FileHeader *hd=(FileHeader *)bb; uint EncVersion=(uint)Raw->GetV(); if (EncVersion>CRYPT_VERSION) - { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"x%u",EncVersion); - UnkEncVerMsg(hd->FileName,Info); - } + UnkEncVerMsg(hd->FileName,L"x" + std::to_wstring(EncVersion)); else { uint Flags=(uint)Raw->GetV(); @@ -1041,11 +1049,7 @@ hd->UseHashKey=(Flags & FHEXTRA_CRYPT_HASHMAC)!=0; hd->Lg2Count=Raw->Get1(); if (hd->Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX) - { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"xc%u",hd->Lg2Count); - UnkEncVerMsg(hd->FileName,Info); - } + UnkEncVerMsg(hd->FileName,L"xc" + std::to_wstring(hd->Lg2Count)); Raw->GetB(hd->Salt,SIZE_SALT50); Raw->GetB(hd->InitV,SIZE_INITV); if (hd->UsePswCheck) @@ -1062,12 +1066,8 @@ byte csum[SIZE_PSWCHECK_CSUM]; Raw->GetB(csum,SIZE_PSWCHECK_CSUM); - sha256_context ctx; - sha256_init(&ctx); - sha256_process(&ctx, hd->PswCheck, SIZE_PSWCHECK); - byte Digest[SHA256_DIGEST_SIZE]; - sha256_done(&ctx, Digest); + sha256_get(hd->PswCheck, SIZE_PSWCHECK, Digest); hd->UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; @@ -1133,31 +1133,27 @@ if (Version!=0) { hd->Version=true; - - wchar VerText[20]; - swprintf(VerText,ASIZE(VerText),L";%u",Version); - wcsncatz(hd->FileName,VerText,ASIZE(hd->FileName)); + hd->FileName += L';' + std::to_wstring(Version); } } break; case FHEXTRA_REDIR: { - hd->RedirType=(FILE_SYSTEM_REDIRECT)Raw->GetV(); + FILE_SYSTEM_REDIRECT RedirType=(FILE_SYSTEM_REDIRECT)Raw->GetV(); uint Flags=(uint)Raw->GetV(); - hd->DirTarget=(Flags & FHEXTRA_REDIR_DIR)!=0; size_t NameSize=(size_t)Raw->GetV(); - char UtfName[NM*4]; - *UtfName=0; - if (NameSize<ASIZE(UtfName)-1) + if (NameSize>0 && NameSize<MAXPATHSIZE) { - Raw->GetB(UtfName,NameSize); - UtfName[NameSize]=0; - } + std::string UtfName(NameSize,0); + hd->RedirType=RedirType; + hd->DirTarget=(Flags & FHEXTRA_REDIR_DIR)!=0; + Raw->GetB(&UtfName[0],NameSize); + UtfToWide(&UtfName[0],hd->RedirName); #ifdef _WIN_ALL - UnixSlashToDos(UtfName,UtfName,ASIZE(UtfName)); + UnixSlashToDos(hd->RedirName,hd->RedirName); #endif - UtfToWide(UtfName,hd->RedirName,ASIZE(hd->RedirName)); + } } break; case FHEXTRA_UOWNER: @@ -1214,8 +1210,8 @@ // We cannot allocate too much memory here, because above // we check FieldSize againt Raw size and we control that Raw size // is sensible when reading headers. - hd->SubData.Alloc((size_t)FieldSize); - Raw->GetB(hd->SubData.Addr(0),(size_t)FieldSize); + hd->SubData.resize((size_t)FieldSize); + Raw->GetB(hd->SubData.data(),(size_t)FieldSize); } break; } @@ -1238,7 +1234,7 @@ Raw.GetB(Mark,4); uint HeadSize=Raw.Get2(); if (HeadSize<7) - return false; + return 0; byte Flags=Raw.Get1(); NextBlockPos=CurBlockPos+HeadSize; CurHeaderType=HEAD_MAIN; @@ -1261,7 +1257,7 @@ FileHead.FileHash.CRC32=Raw.Get2(); FileHead.HeadSize=Raw.Get2(); if (FileHead.HeadSize<21) - return false; + return 0; uint FileTime=Raw.Get4(); FileHead.FileAttr=Raw.Get1(); FileHead.Flags=Raw.Get1()|LONG_BLOCK; @@ -1285,12 +1281,13 @@ Raw.Read(NameSize); - char FileName[NM]; - size_t ReadNameSize=Min(NameSize,ASIZE(FileName)-1); - Raw.GetB((byte *)FileName,ReadNameSize); - FileName[ReadNameSize]=0; - IntToExt(FileName,FileName,ASIZE(FileName)); - CharToWide(FileName,FileHead.FileName,ASIZE(FileHead.FileName)); + // RAR 1.4 name size is stored in a single byte field and it can't + // exceed 255, so additional checks are not needed. + std::string FileName(NameSize,0); + Raw.GetB((byte *)&FileName[0],NameSize); + std::string NameA; + IntToExt(FileName,NameA); + CharToWide(NameA,FileHead.FileName); ConvertNameCase(FileHead.FileName); ConvertFileHeader(&FileHead); @@ -1304,7 +1301,7 @@ #ifndef SFX_MODULE -void Archive::ConvertNameCase(wchar *Name) +void Archive::ConvertNameCase(std::wstring &Name) { if (Cmd->ConvertNames==NAMES_UPPERCASE) wcsupper(Name); @@ -1322,7 +1319,7 @@ void Archive::ConvertAttributes() { -#if defined(_WIN_ALL) || defined(_EMX) +#ifdef _WIN_ALL if (FileHead.HSType!=HSYS_WINDOWS) FileHead.FileAttr=FileHead.Dir ? 0x10 : 0x20; #endif @@ -1387,19 +1384,23 @@ void Archive::ConvertFileHeader(FileHeader *hd) { +/* if (hd->HSType==HSYS_UNKNOWN) if (hd->Dir) hd->FileAttr=0x10; else hd->FileAttr=0x20; +*/ #ifdef _WIN_ALL if (hd->HSType==HSYS_UNIX) // Convert Unix, OS X and Android decomposed chracters to Windows precomposed. - ConvertToPrecomposed(hd->FileName,ASIZE(hd->FileName)); + ConvertToPrecomposed(hd->FileName); #endif - for (wchar *s=hd->FileName;*s!=0;s++) + for (uint I=0;I<hd->FileName.size();I++) { + wchar *s=&hd->FileName[I]; + #ifdef _UNIX // Backslash is the invalid character for Windows file headers, // but it can present in Unix file names extracted in Unix. @@ -1407,7 +1408,7 @@ *s='_'; #endif -#if defined(_WIN_ALL) || defined(_EMX) +#ifdef _WIN_ALL // RAR 5.0 archives do not use '\' as path separator, so if we see it, // it means that it is a part of Unix file name, which we cannot // extract in Windows. @@ -1432,6 +1433,9 @@ if (*s=='/' || *s=='\\' && Format!=RARFMT50) *s=CPATHDIVIDER; } + + // Zeroes inside might be possible in broken Unicode names decoded with EncodeFileName::Decode. + TruncateAtZero(hd->FileName); // Ensure there are no zeroes inside of string. } @@ -1446,7 +1450,7 @@ } -bool Archive::ReadSubData(Array<byte> *UnpData,File *DestFile,bool TestMode) +bool Archive::ReadSubData(std::vector<byte> *UnpData,File *DestFile,bool TestMode) { if (BrokenHeader) { @@ -1454,7 +1458,7 @@ ErrHandler.SetErrorCode(RARX_CRC); return false; } - if (SubHead.Method>5 || SubHead.UnpVer>(Format==RARFMT50 ? VER_UNPACK5:VER_UNPACK)) + if (SubHead.Method>5 || SubHead.UnpVer>(Format==RARFMT50 ? VER_UNPACK7:VER_UNPACK)) { uiMsg(UIERROR_SUBHEADERUNKNOWN,FileName); return false; @@ -1481,7 +1485,7 @@ SubDataIO.SetTestMode(true); else { - UnpData->Alloc((size_t)SubHead.UnpSize); + UnpData->resize((size_t)SubHead.UnpSize); SubDataIO.SetUnpackToMemory(&(*UnpData)[0],(uint)SubHead.UnpSize); } } @@ -1510,7 +1514,7 @@ uiMsg(UIERROR_SUBHEADERDATABROKEN,FileName,SubHead.FileName); ErrHandler.SetErrorCode(RARX_CRC); if (UnpData!=NULL) - UnpData->Reset(); + UnpData->clear(); return false; } return true; Modified: branches/OpenMPT-1.31/include/unrar/blake2s.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/blake2s.cpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/blake2s.cpp Sat Mar 2 23:31:19 2024 (r20182) @@ -2,6 +2,20 @@ #include "rar.hpp" +static const byte blake2s_sigma[10][16] = +{ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , +}; + #ifdef USE_SSE #include "blake2s_sse.cpp" #endif @@ -18,20 +32,6 @@ 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL }; -static const byte blake2s_sigma[10][16] = -{ - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , - { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , - { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , - { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , - { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , - { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , - { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , - { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , - { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , - { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , -}; - static inline void blake2s_set_lastnode( blake2s_state *S ) { S->f[1] = ~0U; @@ -134,11 +134,7 @@ blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES ); #ifdef USE_SSE -#ifdef _WIN_32 // We use SSSE3 _mm_shuffle_epi8 only in x64 mode. - if (_SSE_Version>=SSE_SSE2) -#else if (_SSE_Version>=SSE_SSSE3) -#endif blake2s_compress_sse( S, S->buf ); else blake2s_compress( S, S->buf ); // Compress Modified: branches/OpenMPT-1.31/include/unrar/blake2s_sse.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/blake2s_sse.cpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/blake2s_sse.cpp Sat Mar 2 23:31:19 2024 (r20182) @@ -1,15 +1,14 @@ // Based on public domain code written in 2012 by Samuel Neves -extern const byte blake2s_sigma[10][16]; - // Initialization vector. static __m128i blake2s_IV_0_3, blake2s_IV_4_7; -#ifdef _WIN_64 -// Constants for cyclic rotation. Used in 64-bit mode in mm_rotr_epi32 macro. +// Constants for cyclic rotation. static __m128i crotr8, crotr16; -#endif +#ifdef __GNUC__ +__attribute__((target("sse2"))) +#endif static void blake2s_init_sse() { // We cannot initialize these 128 bit variables in place when declaring @@ -24,28 +23,18 @@ blake2s_IV_0_3 = _mm_setr_epi32( 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A ); blake2s_IV_4_7 = _mm_setr_epi32( 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ); -#ifdef _WIN_64 crotr8 = _mm_set_epi8( 12, 15, 14, 13, 8, 11, 10, 9, 4, 7, 6, 5, 0, 3, 2, 1 ); crotr16 = _mm_set_epi8( 13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2 ); -#endif } #define LOAD(p) _mm_load_si128( (__m128i *)(p) ) #define STORE(p,r) _mm_store_si128((__m128i *)(p), r) -#ifdef _WIN_32 -// 32-bit mode has less SSE2 registers and in MSVC2008 it is more efficient -// to not use _mm_shuffle_epi8 here. -#define mm_rotr_epi32(r, c) ( \ - _mm_xor_si128(_mm_srli_epi32( (r), c ),_mm_slli_epi32( (r), 32-c )) ) -#else #define mm_rotr_epi32(r, c) ( \ c==8 ? _mm_shuffle_epi8(r,crotr8) \ : c==16 ? _mm_shuffle_epi8(r,crotr16) \ : _mm_xor_si128(_mm_srli_epi32( (r), c ),_mm_slli_epi32( (r), 32-c )) ) -#endif - #define G1(row1,row2,row3,row4,buf) \ row1 = _mm_add_epi32( _mm_add_epi32( row1, buf), row2 ); \ @@ -73,14 +62,6 @@ row3 = _mm_shuffle_epi32( row3, _MM_SHUFFLE(1,0,3,2) ); \ row2 = _mm_shuffle_epi32( row2, _MM_SHUFFLE(2,1,0,3) ); -#ifdef _WIN_64 - // MSVC 2008 in x64 mode expands _mm_set_epi32 to store to stack and load - // from stack operations, which are slower than this code. - #define _mm_set_epi32(i3,i2,i1,i0) \ - _mm_unpacklo_epi32(_mm_unpacklo_epi32(_mm_cvtsi32_si128(i0),_mm_cvtsi32_si128(i2)), \ - _mm_unpacklo_epi32(_mm_cvtsi32_si128(i1),_mm_cvtsi32_si128(i3))) -#endif - // Original BLAKE2 SSE4.1 message loading code was a little slower in x86 mode // and about the same in x64 mode in our test. Perhaps depends on compiler. // We also tried _mm_i32gather_epi32 and _mm256_i32gather_epi32 AVX2 gather @@ -101,6 +82,9 @@ } +#ifdef __GNUC__ +__attribute__((target("ssse3"))) +#endif static int blake2s_compress_sse( blake2s_state *S, const byte block[BLAKE2S_BLOCKBYTES] ) { __m128i row[4]; Modified: branches/OpenMPT-1.31/include/unrar/blake2sp.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/blake2sp.cpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/blake2sp.cpp Sat Mar 2 23:31:19 2024 (r20182) @@ -20,7 +20,7 @@ blake2s_init_param( &S->R, 0, 1 ); // Init root. - for( uint i = 0; i < PARALLELISM_DEGREE; ++i ) + for( uint32 i = 0; i < PARALLELISM_DEGREE; ++i ) blake2s_init_param( &S->S[i], i, 0 ); // Init leaf. S->R.last_node = 1; @@ -49,6 +49,8 @@ if (_SSE_Version>=SSE_SSE && inlen__ >= 2 * PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES) _mm_prefetch((char*)(in__ + PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES), _MM_HINT_T0); #endif + // We tried to _forceinline blake2s_update and blake2s_compress_sse, + // but it didn't improve performance. blake2s_update( S, in__, BLAKE2S_BLOCKBYTES ); in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES; inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES; Modified: branches/OpenMPT-1.31/include/unrar/cmddata.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/cmddata.cpp Sat Mar 2 23:29:05 2024 (r20181) +++ branches/OpenMPT-1.31/include/unrar/cmddata.cpp Sat Mar 2 23:31:19 2024 (r20182) @@ -13,8 +13,18 @@ { RAROptions::Init(); - *Command=0; - *ArcName=0; + Command.clear(); + ArcName.clear(); + ExtrPath.clear(); + TempPath.clear(); + SFXModule.clear(); + CommentFile.clear(); + ArcPath.clear(); + ExclArcPath.clear(); + LogName.clear(); + EmailTo.clear(); + UseStdin.clear(); + FileLists=false; NoMoreSwitches=false; @@ -30,57 +40,45 @@ StoreArgs.Reset(); Password.Clean(); NextVolSizes.clear(); -} - - -// Return the pointer to next position in the string and store dynamically -// allocated command line parameter in Par. -static const wchar *AllocCmdParam(const wchar *CmdLine,wchar **Par) -{ - const wchar *NextCmd=GetCmdParam(CmdLine,NULL,0); - if (NextCmd==NULL) - return NULL; - size_t ParSize=NextCmd-CmdLine+2; // Parameter size including the trailing zero. - *Par=(wchar *)malloc(ParSize*sizeof(wchar)); - if (*Par==NULL) - return NULL; - return GetCmdParam(CmdLine,*Par,ParSize); +#ifdef RARDLL + DllDestName.clear(); +#endif } #if !defined(SFX_MODULE) void CommandData::ParseCommandLine(bool Preprocess,int argc, char *argv[]) { - *Command=0; + Command.clear(); NoMoreSwitches=false; #ifdef CUSTOM_CMDLINE_PARSER // In Windows we may prefer to implement our own command line parser // to avoid replacing \" by " in standard parser. Such replacing corrupts // destination paths like "dest path\" in extraction commands. - const wchar *CmdLine=GetCommandLine(); + std::wstring CmdLine=GetCommandLine(); + + std::wstring Param; + std::wstring::size_type Pos=0; - wchar *Par; for (bool FirstParam=true;;FirstParam=false) { - if ((CmdLine=AllocCmdParam(CmdLine,&Par))==NULL) + if (!GetCmdParam(CmdLine,Pos,Param)) break; if (!FirstParam) // First parameter is the executable name. if (Preprocess) - PreprocessArg(Par); + PreprocessArg(Param.data()); else - ParseArg(Par); - free(Par); + ParseArg(Param.data()); } #else - Array<wchar> Arg; for (int I=1;I<argc;I++) { - Arg.Alloc(strlen(argv[I])+1); - CharToWide(argv[I],&Arg[0],Arg.Size()); + std::wstring Arg; + CharToWide(argv[I],Arg); if (Preprocess) - PreprocessArg(&Arg[0]); + PreprocessArg(Arg.data()); else - ParseArg(&Arg[0]); + ParseArg(Arg.data()); } #endif if (!Preprocess) @@ -90,7 +88,7 @@ #if !defined(SFX_MODULE) -void CommandData::ParseArg(wchar *Arg) +void CommandData::ParseArg(const wchar *Arg) { if (IsSwitch(*Arg) && !NoMoreSwitches) if (Arg[1]=='-' && Arg[2]==0) @@ -98,39 +96,52 @@ else ProcessSwitch(Arg+1); else - if (*Command==0) + if (Command.empty()) { - wcsncpyz(Command,Arg,ASIZE(Command)); + Command=Arg; - *Command=toupperw(*Command); + Command[0]=toupperw(Command[0]); // 'I' and 'S' commands can contain case sensitive strings after // the first character, so we must not modify their case. // 'S' can contain SFX name, which case is important in Unix. - if (*Command!='I' && *Command!='S') + if (Command[0]!='I' && Command[0]!='S') wcsupper(Command); - if (*Command=='P') // Enforce -idq for print command. + if (Command[0]=='P') // Enforce -idq for print command. { MsgStream=MSG_ERRONLY; SetConsoleMsgStream(MSG_ERRONLY); } } else - if (*ArcName==0) - wcsncpyz(ArcName,Arg,ASIZE(ArcName)); + if (ArcName.empty()) + ArcName=Arg; else { // Check if last character is the path separator. size_t Length=wcslen(Arg); wchar EndChar=Length==0 ? 0:Arg[Length-1]; - bool EndSeparator=IsDriveDiv(EndChar) || IsPathDiv(EndChar); + // Check if trailing path separator like path\ is present. + bool FolderArg=IsDriveDiv(EndChar) || IsPathDiv(EndChar); + + // 2024.01.05: We were asked to support exotic d:. and d:.. paths. + if (IsDriveLetter(Arg) && Arg[2]=='.' && (Arg[3]==0 || Arg[3]=='.' && Arg[4]==0)) + FolderArg=true; + + // 2024.01.06: FindFile::FastFind check below fails in Windows 10 if + // "." or ".." points at disk root. So we enforce it for "." and ".." + // optionally preceded with some path like "..\..". + size_t L=Length; + if (L>0 && Arg[L-1]=='.' && (L==1 || L>=2 && (IsPathDiv(Arg[L-2]) || + Arg[L-2]=='.' && (L==2 || L>=3 && IsPathDiv(Arg[L-3]))))) + FolderArg=true; - wchar CmdChar=toupperw(*Command); + wchar CmdChar=toupperw(Command[0]); bool Add=wcschr(L"AFUM",CmdChar)!=NULL; bool Extract=CmdChar=='X' || CmdChar=='E'; bool Repair=CmdChar=='R' && Command[1]==0; - if (EndSeparator && !Add) - wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); + if (FolderArg && !Add) + ExtrPath=Arg; else if ((Add || CmdChar=='T') && (*Arg!='@' || ListMode==RCLM_REJECT_LISTS)) FileArgs.AddString(Arg); @@ -147,10 +158,10 @@ } else // We use 'destpath\' when extracting and reparing. - if (Found && FileData.IsDir && (Extract || Repair) && *ExtrPath==0) + if (Found && FileData.IsDir && (Extract || Repair) && ExtrPath.empty()) { - wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); - AddEndSlash(ExtrPath,ASIZE(ExtrPath)); + ExtrPath=Arg; + AddEndSlash(ExtrPath); } else FileArgs.AddString(Arg); @@ -178,12 +189,12 @@ #if !defined(SFX_MODULE) void CommandData::ParseEnvVar() { - char *EnvStr=getenv("RAR"); - if (EnvStr!=NULL) + char *EnvVar=getenv("RAR"); + if (EnvVar!=NULL) { - Array<wchar> EnvStrW(strlen(EnvStr)+1); - CharToWide(EnvStr,&EnvStrW[0],EnvStrW.Size()); - ProcessSwitchesString(&EnvStrW[0]); + std::wstring EnvStr; + CharToWide(EnvVar,EnvStr); + ProcessSwitchesString(EnvStr); } } #endif @@ -192,7 +203,7 @@ #if !defined(SFX_MODULE) // Preprocess those parameters, which must be processed before the rest of -// command line. Return 'false' to stop further processing. +// command line. void CommandData::PreprocessArg(const wchar *Arg) { if (IsSwitch(Arg[0]) && !NoMoreSwitches) @@ -201,7 +212,7 @@ if (Arg[0]=='-' && Arg[1]==0) // Switch "--". NoMoreSwitches=true; if (wcsicomp(Arg,L"cfg-")==0) - ConfigDisabled=true; + ProcessSwitch(Arg); if (wcsnicomp(Arg,L"ilog",4)==0) { // Ensure that correct log file name is already set @@ -213,13 +224,13 @@ { // Process -sc before reading any file lists. ProcessSwitch(Arg); - if (*LogName!=0) + if (!LogName.empty()) InitLogOptions(LogName,ErrlogCharset); } } else - if (*Command==0) - wcsncpy(Command,Arg,ASIZE(Command)); // Need for rar.ini. + if (Command.empty()) + Command=Arg; // Need for rar.ini. } #endif @@ -237,10 +248,10 @@ Str++; if (wcsnicomp(Str,L"switches=",9)==0) ProcessSwitchesString(Str+9); - if (*Command!=0) + if (!Command.empty()) { wchar Cmd[16]; - wcsncpyz(Cmd,Command,ASIZE(Cmd)); + wcsncpyz(Cmd,Command.c_str(),ASIZE(Cmd)); wchar C0=toupperw(Cmd[0]); wchar C1=toupperw(Cmd[1]); if (C0=='I' || C0=='L' || C0=='M' || C0=='S' || C0=='V') @@ -260,14 +271,19 @@ #if !defined(SFX_MODULE) -void CommandData::ProcessSwitchesString(const wchar *Str) +void CommandData::ProcessSwitchesString(const std::wstring &Str) { - wchar *Par; - while ((Str=AllocCmdParam(Str,&Par))!=NULL) + std::wstring Par; + std::wstring::size_type Pos=0; + while (GetCmdParam(Str,Pos,Par)) { - if (IsSwitch(*Par)) - ProcessSwitch(Par+1); - free(Par); + if (IsSwitch(Par[0])) + ProcessSwitch(&Par[1]); + else + { + mprintf(St(MSwSyntaxError),Par.c_str()); + ErrHandler.Exit(RARX_USERERROR); + } } } #endif @@ -330,13 +346,12 @@ break; } break; - case 'N': // Reserved for archive name. - break; case 'O': AddArcOnly=true; break; case 'P': - wcsncpyz(ArcPath,Switch+2,ASIZE(ArcPath)); + // Convert slashes here than before every comparison. + SlashToNative(Switch+2,ArcPath); break; case 'S': SyncFiles=true; @@ -347,7 +362,14 @@ } break; case 'C': - if (Switch[2]==0) + if (Switch[2]!=0) + { + if (wcsicomp(Switch+1,L"FG-")==0) + ConfigDisabled=true; + else + BadSwitch(Switch); + } + else switch(toupperw(Switch[1])) { case '-': @@ -359,10 +381,15 @@ case 'L': ConvertNames=NAMES_LOWERCASE; break; + default: + BadSwitch(Switch); + break; } break; case 'D': - if (Switch[2]==0) + if (Switch[2]!=0) + BadSwitch(Switch); + else switch(toupperw(Switch[1])) { case 'S': @@ -374,6 +401,9 @@ case 'F': DeleteFiles=true; break; + default: + BadSwitch(Switch); + break; } break; case 'E': @@ -395,7 +425,11 @@ ExclPath=EXCL_ABSPATH; break; case '4': - wcsncpyz(ExclArcPath,Switch+3,ASIZE(ExclArcPath)); + // Convert slashes here than before every comparison. + SlashToNative(Switch+3,ArcPath); + break; + default: + BadSwitch(Switch); break; } break; @@ -431,7 +465,7 @@ else if (!Password.IsSet()) { - uiGetPassword(UIPASSWORD_GLOBAL,NULL,&Password,NULL); + uiGetPassword(UIPASSWORD_GLOBAL,L"",&Password,NULL); eprintf(L"\n"); } break; @@ -443,7 +477,7 @@ case 'I': if (wcsnicomp(Switch+1,L"LOG",3)==0) { - wcsncpyz(LogName,Switch[4]!=0 ? Switch+4:DefLogName,ASIZE(LogName)); + LogName=Switch[4]!=0 ? Switch+4:DefLogName; break; } if (wcsnicomp(Switch+1,L"SND",3)==0) @@ -461,7 +495,7 @@ } if (wcsnicomp(Switch+1,L"EML",3)==0) { - wcsncpyz(EmailTo,Switch[4]!=0 ? Switch+4:L"@",ASIZE(EmailTo)); + EmailTo=Switch[4]!=0 ? Switch+4:L"@"; break; } if (wcsicomp(Switch+1,L"M")==0) // For compatibility with pre-WinRAR 6.0 -im syntax. Replaced with -idv. @@ -568,12 +602,14 @@ } switch(toupperw(*(Str++))) { - case 'T': Type=FILTER_PPM; break; +// case 'T': Type=FILTER_TEXT; break; case 'E': Type=FILTER_E8; break; case 'D': Type=FILTER_DELTA; break; - case 'A': Type=FILTER_AUDIO; break; - case 'C': Type=FILTER_RGB; break; - case 'R': Type=FILTER_ARM; break; +// case 'A': Type=FILTER_AUDIO; break; +// case 'C': Type=FILTER_RGB; break; +// case 'R': Type=FILTER_ARM; break; + case 'L': Type=FILTER_LONGRANGE; break; + case 'X': Type=FILTER_EXHAUSTIVE; break; } if (*Str=='+' || *Str=='-') State=*(Str++)=='+' ? FILTER_FORCE:FILTER_DISABLE; @@ -586,6 +622,44 @@ case 'M': break; case 'D': + { + bool SetDictLimit=toupperw(Switch[2])=='X'; + + uint64 Size=atoiw(Switch+(SetDictLimit ? 3 : 2)); + wchar LastChar=toupperw(Switch[wcslen(Switch)-1]); + if (IsDigit(LastChar)) + LastChar=SetDictLimit ? 'G':'M'; // Treat -md128 as -md128m and -mdx32 as -mdx32g. + switch(LastChar) + { + case 'K': + Size*=1024; + break; + case 'M': + Size*=1024*1024; + break; + case 'G': + Size*=1024*1024*1024; + break; + default: + BadSwitch(Switch); + } + + // 2023.07.22: For 4 GB and less we also check that it is power of 2, + // so archives are compatible with RAR 5.0+. + // We allow Size>PACK_MAX_DICT here, so we can use -md[x] to unpack + // archives created by future versions with higher PACK_MAX_DICT + uint Flags; + if ((Size=Archive::GetWinSize(Size,Flags))==0 || + Size<=0x100000000ULL && !IsPow2(Size)) + BadSwitch(Switch); + else + if (SetDictLimit) + WinSizeLimit=Size; + else + { + WinSize=Size; + } + } break; case 'E': if (toupperw(Switch[2])=='S' && Switch[3]==0) @@ -593,25 +667,20 @@ break; case 'S': { - wchar StoreNames[1024]; - wcsncpyz(StoreNames,(Switch[2]==0 ? DefaultStoreList:Switch+2),ASIZE(StoreNames)); - wchar *Names=StoreNames; - while (*Names!=0) + std::wstring StoreNames=(Switch[2]==0 ? DefaultStoreList:Switch+2); + size_t Pos=0; + while (Pos<StoreNames.size()) { - wchar *End=wcschr(Names,';'); - if (End!=NULL) - *End=0; - if (*Names=='.') - Names++; - wchar Mask[NM]; - if (wcspbrk(Names,L"*?.")==NULL) - swprintf(Mask,ASIZE(Mask),L"*.%ls",Names); - else - wcsncpyz(Mask,Names,ASIZE(Mask)); + if (StoreNames[Pos]=='.') + Pos++; + size_t EndPos=StoreNames.find(';',Pos); + std::wstring Mask=StoreNames.substr(Pos,EndPos==std::wstring::npos ? EndPos:EndPos-Pos); + if (Mask.find_first_of(L"*?.")==std::wstring::npos) + Mask.insert(0,L"*."); StoreArgs.AddString(Mask); - if (End==NULL) + if (EndPos==std::wstring::npos) break; - Names=End+1; + Pos=EndPos+1; } } break; @@ -668,8 +737,19 @@ #ifdef SAVE_LINKS case 'L': SaveSymLinks=true; - if (toupperw(Switch[2])=='A') - AbsoluteLinks=true; + for (uint I=2;Switch[I]!=0;I++) + switch(toupperw(Switch[I])) + { + case 'A': + AbsoluteLinks=true; + break; + case '-': + SkipSymLinks=true; + break; + default: + BadSwitch(Switch); + break; + } break; #endif #ifdef _WIN_ALL @@ -679,8 +759,8 @@ break; #endif case 'P': - wcsncpyz(ExtrPath,Switch+2,ASIZE(ExtrPath)); - AddEndSlash(ExtrPath,ASIZE(ExtrPath)); + ExtrPath=Switch+2; + AddEndSlash(ExtrPath); break; case 'R': Overwrite=OVERWRITE_AUTORENAME; @@ -701,7 +781,7 @@ case 'P': if (Switch[1]==0) { - uiGetPassword(UIPASSWORD_GLOBAL,NULL,&Password,NULL); + uiGetPassword(UIPASSWORD_GLOBAL,L"",&Password,NULL); eprintf(L"\n"); } else @@ -790,15 +870,15 @@ break; case 'I': ProhibitConsoleInput(); - wcsncpyz(UseStdin,Switch[2] ? Switch+2:L"stdin",ASIZE(UseStdin)); + UseStdin=Switch[2] ? Switch+2:L"stdin"; break; case 'L': if (IsDigit(Switch[2])) - FileSizeLess=atoilw(Switch+2); + ... [truncated message content] |
From: <sv...@op...> - 2024-03-02 22:29:23
|
Author: sagamusix Date: Sat Mar 2 23:29:05 2024 New Revision: 20181 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20181 Log: [Var] unrar: Update to v7.0.7. Modified: trunk/OpenMPT/include/unrar/OpenMPT.txt trunk/OpenMPT/include/unrar/arccmt.cpp trunk/OpenMPT/include/unrar/archive.cpp trunk/OpenMPT/include/unrar/archive.hpp trunk/OpenMPT/include/unrar/arcread.cpp trunk/OpenMPT/include/unrar/blake2s.cpp trunk/OpenMPT/include/unrar/blake2s_sse.cpp trunk/OpenMPT/include/unrar/blake2sp.cpp trunk/OpenMPT/include/unrar/cmddata.cpp trunk/OpenMPT/include/unrar/cmddata.hpp trunk/OpenMPT/include/unrar/cmdfilter.cpp trunk/OpenMPT/include/unrar/cmdmix.cpp trunk/OpenMPT/include/unrar/coder.cpp trunk/OpenMPT/include/unrar/coder.hpp trunk/OpenMPT/include/unrar/compress.hpp trunk/OpenMPT/include/unrar/consio.cpp trunk/OpenMPT/include/unrar/consio.hpp trunk/OpenMPT/include/unrar/crc.cpp trunk/OpenMPT/include/unrar/crc.hpp trunk/OpenMPT/include/unrar/crypt.cpp trunk/OpenMPT/include/unrar/crypt.hpp trunk/OpenMPT/include/unrar/crypt1.cpp trunk/OpenMPT/include/unrar/crypt5.cpp trunk/OpenMPT/include/unrar/dll.cpp trunk/OpenMPT/include/unrar/dll.hpp trunk/OpenMPT/include/unrar/encname.cpp trunk/OpenMPT/include/unrar/encname.hpp trunk/OpenMPT/include/unrar/errhnd.cpp trunk/OpenMPT/include/unrar/errhnd.hpp trunk/OpenMPT/include/unrar/extinfo.cpp trunk/OpenMPT/include/unrar/extinfo.hpp trunk/OpenMPT/include/unrar/extract.cpp trunk/OpenMPT/include/unrar/extract.hpp trunk/OpenMPT/include/unrar/filcreat.cpp trunk/OpenMPT/include/unrar/filcreat.hpp trunk/OpenMPT/include/unrar/file.cpp trunk/OpenMPT/include/unrar/file.hpp trunk/OpenMPT/include/unrar/filefn.cpp trunk/OpenMPT/include/unrar/filefn.hpp trunk/OpenMPT/include/unrar/filestr.cpp trunk/OpenMPT/include/unrar/filestr.hpp trunk/OpenMPT/include/unrar/find.cpp trunk/OpenMPT/include/unrar/find.hpp trunk/OpenMPT/include/unrar/getbits.cpp trunk/OpenMPT/include/unrar/getbits.hpp trunk/OpenMPT/include/unrar/hardlinks.cpp trunk/OpenMPT/include/unrar/hash.cpp trunk/OpenMPT/include/unrar/hash.hpp trunk/OpenMPT/include/unrar/headers.cpp trunk/OpenMPT/include/unrar/headers.hpp trunk/OpenMPT/include/unrar/headers5.hpp trunk/OpenMPT/include/unrar/isnt.cpp trunk/OpenMPT/include/unrar/list.cpp trunk/OpenMPT/include/unrar/loclang.hpp trunk/OpenMPT/include/unrar/log.cpp trunk/OpenMPT/include/unrar/log.hpp trunk/OpenMPT/include/unrar/match.cpp trunk/OpenMPT/include/unrar/match.hpp trunk/OpenMPT/include/unrar/model.cpp trunk/OpenMPT/include/unrar/model.hpp trunk/OpenMPT/include/unrar/options.cpp trunk/OpenMPT/include/unrar/options.hpp trunk/OpenMPT/include/unrar/os.hpp trunk/OpenMPT/include/unrar/pathfn.cpp trunk/OpenMPT/include/unrar/pathfn.hpp trunk/OpenMPT/include/unrar/qopen.cpp trunk/OpenMPT/include/unrar/qopen.hpp trunk/OpenMPT/include/unrar/rar.cpp trunk/OpenMPT/include/unrar/rar.hpp trunk/OpenMPT/include/unrar/rardefs.hpp trunk/OpenMPT/include/unrar/raros.hpp trunk/OpenMPT/include/unrar/rartypes.hpp trunk/OpenMPT/include/unrar/rarvm.cpp trunk/OpenMPT/include/unrar/rawint.hpp trunk/OpenMPT/include/unrar/rawread.cpp trunk/OpenMPT/include/unrar/rawread.hpp trunk/OpenMPT/include/unrar/rdwrfn.cpp trunk/OpenMPT/include/unrar/rdwrfn.hpp trunk/OpenMPT/include/unrar/recvol.cpp trunk/OpenMPT/include/unrar/recvol.hpp trunk/OpenMPT/include/unrar/recvol3.cpp trunk/OpenMPT/include/unrar/recvol5.cpp trunk/OpenMPT/include/unrar/resource.cpp trunk/OpenMPT/include/unrar/resource.hpp trunk/OpenMPT/include/unrar/rijndael.cpp trunk/OpenMPT/include/unrar/rijndael.hpp trunk/OpenMPT/include/unrar/rs16.cpp trunk/OpenMPT/include/unrar/rs16.hpp trunk/OpenMPT/include/unrar/scantree.cpp trunk/OpenMPT/include/unrar/scantree.hpp trunk/OpenMPT/include/unrar/secpassword.cpp trunk/OpenMPT/include/unrar/secpassword.hpp trunk/OpenMPT/include/unrar/sha256.cpp trunk/OpenMPT/include/unrar/sha256.hpp trunk/OpenMPT/include/unrar/strfn.cpp trunk/OpenMPT/include/unrar/strfn.hpp trunk/OpenMPT/include/unrar/strlist.cpp trunk/OpenMPT/include/unrar/strlist.hpp trunk/OpenMPT/include/unrar/system.cpp trunk/OpenMPT/include/unrar/system.hpp trunk/OpenMPT/include/unrar/timefn.cpp trunk/OpenMPT/include/unrar/timefn.hpp trunk/OpenMPT/include/unrar/ui.hpp trunk/OpenMPT/include/unrar/uicommon.cpp trunk/OpenMPT/include/unrar/uiconsole.cpp trunk/OpenMPT/include/unrar/uisilent.cpp trunk/OpenMPT/include/unrar/ulinks.cpp trunk/OpenMPT/include/unrar/unicode.cpp trunk/OpenMPT/include/unrar/unicode.hpp trunk/OpenMPT/include/unrar/unpack.cpp trunk/OpenMPT/include/unrar/unpack.hpp trunk/OpenMPT/include/unrar/unpack15.cpp trunk/OpenMPT/include/unrar/unpack20.cpp trunk/OpenMPT/include/unrar/unpack30.cpp trunk/OpenMPT/include/unrar/unpack50.cpp trunk/OpenMPT/include/unrar/unpack50frag.cpp trunk/OpenMPT/include/unrar/unpack50mt.cpp trunk/OpenMPT/include/unrar/unpackinline.cpp trunk/OpenMPT/include/unrar/uowners.cpp trunk/OpenMPT/include/unrar/version.hpp trunk/OpenMPT/include/unrar/volume.cpp trunk/OpenMPT/include/unrar/win32acl.cpp trunk/OpenMPT/include/unrar/win32lnk.cpp trunk/OpenMPT/include/unrar/win32stm.cpp Modified: trunk/OpenMPT/include/unrar/OpenMPT.txt ============================================================================== --- trunk/OpenMPT/include/unrar/OpenMPT.txt Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/OpenMPT.txt Sat Mar 2 23:29:05 2024 (r20181) @@ -1,4 +1,4 @@ -This folder is based on https://rarlab.com/rar/unrarsrc-6.2.10.tar.gz +This folder is based on https://rarlab.com/rar/unrarsrc-7.0.7.tar.gz All modifications to existing files have been done in a manner so that no existing lines were edited; only new lines were added. @@ -10,9 +10,9 @@ never be used in OpenMPT's context. The following files have been modified: -arcread.cpp, extract.cpp, filcreat.cpp, file.cpp, filefn.cpp, find.cpp, -match.cpp, os.hpp, pathfn.cpp, rdwrfn.cpp, secpassword.cpp, system.cpp, -volume.cpp, win32acl.cpp, win32lnk.cpp +extract.cpp, filcreat.cpp, file.cpp, filefn.cpp, find.cpp, match.cpp, +os.hpp, pathfn.cpp, rdwrfn.cpp, secpassword.cpp, volume.cpp, +win32acl.cpp, win32lnk.cpp For building, premake is used to generate Visual Studio project files. See ../build/premake/ for details. Modified: trunk/OpenMPT/include/unrar/arccmt.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/arccmt.cpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/arccmt.cpp Sat Mar 2 23:29:05 2024 (r20181) @@ -1,6 +1,6 @@ static bool IsAnsiEscComment(const wchar *Data,size_t Size); -bool Archive::GetComment(Array<wchar> *CmtData) +bool Archive::GetComment(std::wstring &CmtData) { if (!MainComment) return false; @@ -11,7 +11,7 @@ } -bool Archive::DoGetComment(Array<wchar> *CmtData) +bool Archive::DoGetComment(std::wstring &CmtData) { #ifndef SFX_MODULE uint CmtLength; @@ -101,10 +101,9 @@ // 4x memory for OEM to UTF-8 output here. OemToCharBuffA((char *)UnpData,(char *)UnpData,(DWORD)UnpDataSize); #endif - CmtData->Alloc(UnpDataSize+1); - memset(CmtData->Addr(0),0,CmtData->Size()*sizeof(wchar)); - CharToWide((char *)UnpData,CmtData->Addr(0),CmtData->Size()); - CmtData->Alloc(wcslen(CmtData->Addr(0))); +// CmtData.resize(UnpDataSize+1); + CharToWide((const char *)UnpData,CmtData); +// CmtData.resize(wcslen(CmtData->data())); } } } @@ -112,12 +111,12 @@ { if (CmtLength==0) return false; - Array<byte> CmtRaw(CmtLength); - int ReadSize=Read(&CmtRaw[0],CmtLength); + std::vector<byte> CmtRaw(CmtLength); + int ReadSize=Read(CmtRaw.data(),CmtLength); if (ReadSize>=0 && (uint)ReadSize<CmtLength) // Comment is shorter than declared. { CmtLength=ReadSize; - CmtRaw.Alloc(CmtLength); + CmtRaw.resize(CmtLength); } if (Format!=RARFMT14 && CommHead.CommCRC!=(~CRC32(0xffffffff,&CmtRaw[0],CmtLength)&0xffff)) @@ -125,43 +124,41 @@ uiMsg(UIERROR_CMTBROKEN,FileName); return false; } - CmtData->Alloc(CmtLength+1); - CmtRaw.Push(0); +// CmtData.resize(CmtLength+1); + CmtRaw.push_back(0); #ifdef _WIN_ALL // If we ever decide to extend it to Android, we'll need to alloc // 4x memory for OEM to UTF-8 output here. - OemToCharA((char *)&CmtRaw[0],(char *)&CmtRaw[0]); + OemToCharA((char *)CmtRaw.data(),(char *)CmtRaw.data()); #endif - CharToWide((char *)&CmtRaw[0],CmtData->Addr(0),CmtData->Size()); - CmtData->Alloc(wcslen(CmtData->Addr(0))); + CharToWide((const char *)CmtRaw.data(),CmtData); +// CmtData->resize(wcslen(CmtData->data())); } #endif - return CmtData->Size() > 0; + return CmtData.size() > 0; } -bool Archive::ReadCommentData(Array<wchar> *CmtData) +bool Archive::ReadCommentData(std::wstring &CmtData) { - Array<byte> CmtRaw; + std::vector<byte> CmtRaw; if (!ReadSubData(&CmtRaw,NULL,false)) return false; - size_t CmtSize=CmtRaw.Size(); - CmtRaw.Push(0); - CmtData->Alloc(CmtSize+1); + size_t CmtSize=CmtRaw.size(); + CmtRaw.push_back(0); +// CmtData->resize(CmtSize+1); if (Format==RARFMT50) - UtfToWide((char *)&CmtRaw[0],CmtData->Addr(0),CmtData->Size()); + UtfToWide((char *)CmtRaw.data(),CmtData); else if ((SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE)!=0) { - RawToWide(&CmtRaw[0],CmtData->Addr(0),CmtSize/2); - (*CmtData)[CmtSize/2]=0; - + CmtData=RawToWide(CmtRaw); } else { - CharToWide((char *)&CmtRaw[0],CmtData->Addr(0),CmtData->Size()); + CharToWide((const char *)CmtRaw.data(),CmtData); } - CmtData->Alloc(wcslen(CmtData->Addr(0))); // Set buffer size to actual comment length. +// CmtData->resize(wcslen(CmtData->data())); // Set buffer size to actual comment length. return true; } @@ -170,15 +167,16 @@ { if (Cmd->DisableComment) return; - Array<wchar> CmtBuf; - if (GetComment(&CmtBuf)) // In GUI too, so "Test" command detects broken comments. + std::wstring CmtBuf; + if (GetComment(CmtBuf)) // In GUI too, so "Test" command detects broken comments. { - size_t CmtSize=CmtBuf.Size(); - wchar *ChPtr=wcschr(&CmtBuf[0],0x1A); - if (ChPtr!=NULL) - CmtSize=ChPtr-&CmtBuf[0]; - mprintf(L"\n"); - OutComment(&CmtBuf[0],CmtSize); + size_t CmtSize=CmtBuf.size(); + auto EndPos=CmtBuf.find(0x1A); + if (EndPos!=std::wstring::npos) + CmtSize=EndPos; + mprintf(St(MArcComment)); + mprintf(L":\n"); + OutComment(CmtBuf); } } Modified: trunk/OpenMPT/include/unrar/archive.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/archive.cpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/archive.cpp Sat Mar 2 23:29:05 2024 (r20181) @@ -39,7 +39,6 @@ VolWrite=0; AddingFilesSize=0; AddingHeadersSize=0; - *FirstVolumeName=0; Splitting=false; NewArchive=false; @@ -74,7 +73,7 @@ #if !defined(SFX_MODULE) -void Archive::CheckOpen(const wchar *Name) +void Archive::CheckOpen(const std::wstring &Name) { TOpen(Name); CheckArc(false); @@ -82,7 +81,7 @@ #endif -bool Archive::WCheckOpen(const wchar *Name) +bool Archive::WCheckOpen(const std::wstring &Name) { if (!WOpen(Name)) return false; @@ -148,9 +147,9 @@ } else { - Array<char> Buffer(MAXSFXSIZE); + std::vector<char> Buffer(MAXSFXSIZE); long CurPos=(long)Tell(); - int ReadSize=Read(&Buffer[0],Buffer.Size()-16); + int ReadSize=Read(Buffer.data(),Buffer.size()-16); for (int I=0;I<ReadSize;I++) if (Buffer[I]==0x52 && (Type=IsSignature((byte *)&Buffer[I],ReadSize-I))!=RARFMT_NONE) { @@ -265,7 +264,7 @@ Seek(SavePos,SEEK_SET); } if (!Volume || FirstVolume) - wcsncpyz(FirstVolumeName,FileName,ASIZE(FirstVolumeName)); + FirstVolumeName=FileName; return true; } @@ -301,7 +300,7 @@ #ifdef USE_QOPEN -bool Archive::Open(const wchar *Name,uint Mode) +bool Archive::Open(const std::wstring &Name,uint Mode) { // Important if we reuse Archive object and it has virtual QOpen // file position not matching real. For example, for 'l -v volname'. @@ -336,3 +335,23 @@ } #endif + +// Return 0 if dictionary size is invalid. If size is RAR7 only, return +// the adjusted nearest bottom value. Return header flags in Flags. +uint64 Archive::GetWinSize(uint64 Size,uint &Flags) +{ + Flags=0; + // Allow 128 KB - 1 TB range. + if (Size<0x20000 || Size>0x10000000000ULL) + return 0; + uint64 Pow2=0x20000; // Power of 2 dictionary size. + for (;2*Pow2<=Size;Pow2*=2) + Flags+=FCI_DICT_BIT0; + if (Size==Pow2) + return Size; // If 'Size' is the power of 2, return it as is. + + // Get the number of Pow2/32 to add to Pow2 for nearest value not exceeding 'Size'. + uint64 Fraction=(Size-Pow2)/(Pow2/32); + Flags+=(uint)Fraction*FCI_DICT_FRACT0; + return Pow2+Fraction*(Pow2/32); +} Modified: trunk/OpenMPT/include/unrar/archive.hpp ============================================================================== --- trunk/OpenMPT/include/unrar/archive.hpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/archive.hpp Sat Mar 2 23:29:05 2024 (r20181) @@ -27,7 +27,7 @@ { private: void UpdateLatestTime(FileHeader *CurBlock); - void ConvertNameCase(wchar *Name); + void ConvertNameCase(std::wstring &Name); void ConvertFileHeader(FileHeader *hd); size_t ReadHeader14(); size_t ReadHeader15(); @@ -36,9 +36,9 @@ void RequestArcPassword(RarCheckPassword *SelPwd); void UnexpEndArcMsg(); void BrokenHeaderMsg(); - void UnkEncVerMsg(const wchar *Name,const wchar *Info); - bool DoGetComment(Array<wchar> *CmtData); - bool ReadCommentData(Array<wchar> *CmtData); + void UnkEncVerMsg(const std::wstring &Name,const std::wstring &Info); + bool DoGetComment(std::wstring &CmtData); + bool ReadCommentData(std::wstring &CmtData); #if !defined(RAR_NOCRYPT) CryptData HeadersCrypt; @@ -67,9 +67,9 @@ size_t SearchRR(); size_t ReadHeader(); void CheckArc(bool EnableBroken); - void CheckOpen(const wchar *Name); - bool WCheckOpen(const wchar *Name); - bool GetComment(Array<wchar> *CmtData); + void CheckOpen(const std::wstring &Name); + bool WCheckOpen(const std::wstring &Name); + bool GetComment(std::wstring &CmtData); void ViewComment(); void SetLatestTime(RarTime *NewTime); void SeekToNext(); @@ -79,23 +79,25 @@ void VolSubtractHeaderSize(size_t SubSize); uint FullHeaderSize(size_t Size); int64 GetStartPos(); - void AddSubData(byte *SrcData,uint64 DataSize,File *SrcFile, + void AddSubData(const byte *SrcData,uint64 DataSize,File *SrcFile, const wchar *Name,uint Flags); - bool ReadSubData(Array<byte> *UnpData,File *DestFile,bool TestMode); + bool ReadSubData(std::vector<byte> *UnpData,File *DestFile,bool TestMode); HEADER_TYPE GetHeaderType() {return CurHeaderType;} CommandData* GetCommandData() {return Cmd;} void SetSilentOpen(bool Mode) {SilentOpen=Mode;} -#if 0 - void GetRecoveryInfo(bool Required,int64 *Size,int *Percent); -#endif #ifdef USE_QOPEN - bool Open(const wchar *Name,uint Mode=FMF_READ); - int Read(void *Data,size_t Size); - void Seek(int64 Offset,int Method); - int64 Tell(); + bool Open(const std::wstring &Name,uint Mode=FMF_READ) override; + int Read(void *Data,size_t Size) override; + void Seek(int64 Offset,int Method) override; + int64 Tell() override; void QOpenUnload() {QOpen.Unload();} void SetProhibitQOpen(bool Mode) {ProhibitQOpen=Mode;} #endif + static uint64 GetWinSize(uint64 Size,uint &Flags); + + // Needed to see wstring based Open from File. Otherwise compiler finds + // Open in Archive and doesn't check the base class overloads. + using File::Open; BaseBlock ShortBlock; MarkHeader MarkHead; @@ -135,12 +137,16 @@ uint VolNumber; int64 VolWrite; + + // Total size of files adding to archive. Might also include the size of + // files repacked in solid archive. uint64 AddingFilesSize; + uint64 AddingHeadersSize; bool NewArchive; - wchar FirstVolumeName[NM]; + std::wstring FirstVolumeName; }; Modified: trunk/OpenMPT/include/unrar/arcread.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/arcread.cpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/arcread.cpp Sat Mar 2 23:29:05 2024 (r20181) @@ -119,7 +119,7 @@ } -void Archive::UnkEncVerMsg(const wchar *Name,const wchar *Info) +void Archive::UnkEncVerMsg(const std::wstring &Name,const std::wstring &Info) { uiMsg(UIERROR_UNKNOWNENCMETHOD,FileName,Name,Info); ErrHandler.SetErrorCode(RARX_WARNING); @@ -222,7 +222,7 @@ { case HEAD_MAIN: MainHead.Reset(); - *(BaseBlock *)&MainHead=ShortBlock; + MainHead.SetBaseBlock(ShortBlock); MainHead.HighPosAV=Raw.Get2(); MainHead.PosAV=Raw.Get4(); @@ -248,7 +248,7 @@ FileHeader *hd=FileBlock ? &FileHead:&SubHead; hd->Reset(); - *(BaseBlock *)hd=ShortBlock; + hd->SetBaseBlock(ShortBlock); hd->SplitBefore=(hd->Flags & LHD_SPLIT_BEFORE)!=0; hd->SplitAfter=(hd->Flags & LHD_SPLIT_AFTER)!=0; @@ -307,7 +307,7 @@ if (hd->HostOS==HOST_UNIX && (hd->FileAttr & 0xF000)==0xA000) { hd->RedirType=FSREDIR_UNIXSYMLINK; - *hd->RedirName=0; + hd->RedirName.clear(); } hd->Inherited=!FileBlock && (hd->SubFlags & SUBHEAD_FLAGS_INHERITED)!=0; @@ -334,27 +334,26 @@ if (hd->UnknownUnpSize) hd->UnpSize=INT64NDF; - char FileName[NM*4]; - size_t ReadNameSize=Min(NameSize,ASIZE(FileName)-1); - Raw.GetB((byte *)FileName,ReadNameSize); - FileName[ReadNameSize]=0; + size_t ReadNameSize=Min(NameSize,MAXPATHSIZE); + std::string FileName(ReadNameSize,0); + Raw.GetB((byte *)&FileName[0],ReadNameSize); if (FileBlock) { - *hd->FileName=0; + hd->FileName.clear(); if ((hd->Flags & LHD_UNICODE)!=0) { EncodeFileName NameCoder; - size_t Length=strlen(FileName); + size_t Length=strlen(FileName.data()); Length++; if (ReadNameSize>Length) - NameCoder.Decode(FileName,ReadNameSize,(byte *)FileName+Length, - ReadNameSize-Length,hd->FileName, - ASIZE(hd->FileName)); + NameCoder.Decode(FileName.data(),ReadNameSize, + (byte *)&FileName[Length], + ReadNameSize-Length,hd->FileName); } - if (*hd->FileName==0) - ArcCharToWide(FileName,hd->FileName,ASIZE(hd->FileName),ACTW_OEM); + if (hd->FileName.empty()) + ArcCharToWide(FileName.data(),hd->FileName,ACTW_OEM); #ifndef SFX_MODULE ConvertNameCase(hd->FileName); @@ -363,7 +362,7 @@ } else { - CharToWide(FileName,hd->FileName,ASIZE(hd->FileName)); + CharToWide(FileName.data(),hd->FileName); // Calculate the size of optional data. int DataSize=int(hd->HeadSize-NameSize-SIZEOF_FILEHEAD3); @@ -374,14 +373,15 @@ { // Here we read optional additional fields for subheaders. // They are stored after the file name and before salt. - hd->SubData.Alloc(DataSize); - Raw.GetB(&hd->SubData[0],DataSize); + hd->SubData.resize(DataSize); + Raw.GetB(hd->SubData.data(),DataSize); } if (hd->CmpName(SUBHEAD_TYPE_CMT)) MainComment=true; } + if ((hd->Flags & LHD_SALT)!=0) Raw.GetB(hd->Salt,SIZE_SALT30); hd->mtime.SetDos(FileTime); @@ -424,7 +424,7 @@ NextBlockPos=SafeAdd(NextBlockPos,hd->PackSize,0); bool CRCProcessedOnly=hd->CommentInHeader; - ushort HeaderCRC=Raw.GetCRC15(CRCProcessedOnly); + uint HeaderCRC=Raw.GetCRC15(CRCProcessedOnly); if (hd->HeadCRC!=HeaderCRC) { BrokenHeader=true; @@ -441,7 +441,7 @@ } break; case HEAD_ENDARC: - *(BaseBlock *)&EndArcHead=ShortBlock; + EndArcHead.SetBaseBlock(ShortBlock); EndArcHead.NextVolume=(EndArcHead.Flags & EARC_NEXT_VOLUME)!=0; EndArcHead.DataCRC=(EndArcHead.Flags & EARC_DATACRC)!=0; EndArcHead.RevSpace=(EndArcHead.Flags & EARC_REVSPACE)!=0; @@ -453,14 +453,14 @@ break; #ifndef SFX_MODULE case HEAD3_CMT: - *(BaseBlock *)&CommHead=ShortBlock; + CommHead.SetBaseBlock(ShortBlock); CommHead.UnpSize=Raw.Get2(); CommHead.UnpVer=Raw.Get1(); CommHead.Method=Raw.Get1(); CommHead.CommCRC=Raw.Get2(); break; case HEAD3_PROTECT: - *(BaseBlock *)&ProtectHead=ShortBlock; + ProtectHead.SetBaseBlock(ShortBlock); ProtectHead.DataSize=Raw.Get4(); ProtectHead.Version=Raw.Get1(); ProtectHead.RecSectors=Raw.Get2(); @@ -469,7 +469,7 @@ NextBlockPos+=ProtectHead.DataSize; break; case HEAD3_OLDSERVICE: // RAR 2.9 and earlier. - *(BaseBlock *)&SubBlockHead=ShortBlock; + SubBlockHead.SetBaseBlock(ShortBlock); SubBlockHead.DataSize=Raw.Get4(); NextBlockPos+=SubBlockHead.DataSize; SubBlockHead.SubType=Raw.Get2(); @@ -490,10 +490,13 @@ StreamHead.Method=Raw.Get1(); StreamHead.StreamCRC=Raw.Get4(); StreamHead.StreamNameSize=Raw.Get2(); - if (StreamHead.StreamNameSize>=ASIZE(StreamHead.StreamName)) - StreamHead.StreamNameSize=ASIZE(StreamHead.StreamName)-1; - Raw.GetB(StreamHead.StreamName,StreamHead.StreamNameSize); - StreamHead.StreamName[StreamHead.StreamNameSize]=0; + + const size_t MaxStreamName20=260; // Maximum allowed stream name in RAR 2.x format. + if (StreamHead.StreamNameSize>MaxStreamName20) + StreamHead.StreamNameSize=MaxStreamName20; + + StreamHead.StreamName.resize(StreamHead.StreamNameSize); + Raw.GetB(&StreamHead.StreamName[0],StreamHead.StreamNameSize); break; } break; @@ -504,7 +507,7 @@ break; } - ushort HeaderCRC=Raw.GetCRC15(false); + uint HeaderCRC=Raw.GetCRC15(false); // Old AV header does not have header CRC properly set. // Old Unix owners header didn't include string fields into header size, @@ -646,7 +649,7 @@ } int SizeToRead=int(BlockSize); - SizeToRead-=FirstReadSize-SizeBytes-4; // Adjust overread size bytes if any. + SizeToRead-=int(FirstReadSize-SizeBytes-4); // Adjust overread size bytes if any. uint HeaderSize=4+SizeBytes+(uint)BlockSize; if (SizeToRead<0 || HeaderSize<SIZEOF_SHORTBLOCKHEAD5) @@ -711,13 +714,12 @@ { case HEAD_CRYPT: { - *(BaseBlock *)&CryptHead=ShortBlock; + CryptHead.SetBaseBlock(ShortBlock); uint CryptVersion=(uint)Raw.GetV(); if (CryptVersion>CRYPT_VERSION) { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"h%u",CryptVersion); - UnkEncVerMsg(FileName,Info); + UnkEncVerMsg(FileName,L"h" + std::to_wstring(CryptVersion)); + FailedHeaderDecryption=true; return 0; } uint EncFlags=(uint)Raw.GetV(); @@ -725,9 +727,8 @@ CryptHead.Lg2Count=Raw.Get1(); if (CryptHead.Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX) { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"hc%u",CryptHead.Lg2Count); - UnkEncVerMsg(FileName,Info); + UnkEncVerMsg(FileName,L"hc" + std::to_wstring(CryptHead.Lg2Count)); + FailedHeaderDecryption=true; return 0; } @@ -739,12 +740,8 @@ byte csum[SIZE_PSWCHECK_CSUM]; Raw.GetB(csum,SIZE_PSWCHECK_CSUM); - sha256_context ctx; - sha256_init(&ctx); - sha256_process(&ctx, CryptHead.PswCheck, SIZE_PSWCHECK); - byte Digest[SHA256_DIGEST_SIZE]; - sha256_done(&ctx, Digest); + sha256_get(CryptHead.PswCheck, SIZE_PSWCHECK, Digest); CryptHead.UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; } @@ -754,7 +751,7 @@ case HEAD_MAIN: { MainHead.Reset(); - *(BaseBlock *)&MainHead=ShortBlock; + MainHead.SetBaseBlock(ShortBlock); uint ArcFlags=(uint)Raw.GetV(); Volume=(ArcFlags & MHFL_VOLUME)!=0; @@ -832,9 +829,14 @@ // we may need to use the compression algorithm 15 in the future, // but it was already used in RAR 1.5 and Unpack needs to distinguish // them. - hd->UnpVer=(CompInfo & 0x3f) + 50; - if (hd->UnpVer!=50) // Only 5.0 compression is known now. - hd->UnpVer=VER_UNKNOWN; + uint UnpVer=(CompInfo & 0x3f); + if (UnpVer==0) + hd->UnpVer=VER_PACK5; + else + if (UnpVer==1) + hd->UnpVer=VER_PACK7; + else + hd->UnpVer=VER_UNKNOWN; hd->HostOS=(byte)Raw.GetV(); size_t NameSize=(size_t)Raw.GetV(); @@ -852,14 +854,29 @@ hd->SubBlock=(hd->Flags & HFL_CHILD)!=0; hd->Solid=FileBlock && (CompInfo & FCI_SOLID)!=0; hd->Dir=(hd->FileFlags & FHFL_DIRECTORY)!=0; - hd->WinSize=hd->Dir ? 0:size_t(0x20000)<<((CompInfo>>10)&0xf); + if (hd->Dir || UnpVer>1) + hd->WinSize=0; + else + { + hd->WinSize=0x20000ULL<<((CompInfo>>10)&(UnpVer==0 ? 0x0f:0x1f)); + if (UnpVer==1) + { + hd->WinSize+=hd->WinSize/32*((CompInfo>>15)&0x1f); - char FileName[NM*4]; - size_t ReadNameSize=Min(NameSize,ASIZE(FileName)-1); - Raw.GetB((byte *)FileName,ReadNameSize); - FileName[ReadNameSize]=0; + // RAR7 header with RAR5 compression. Needed to append RAR7 files + // to RAR5 solid stream if new dictionary is larger than existing. + if ((CompInfo & FCI_RAR5_COMPAT)!=0) + hd->UnpVer=VER_PACK5; + if (hd->WinSize>UNPACK_MAX_DICT) + hd->UnpVer=VER_UNKNOWN; + } + } - UtfToWide(FileName,hd->FileName,ASIZE(hd->FileName)); + size_t ReadNameSize=Min(NameSize,MAXPATHSIZE); + std::string FileName(ReadNameSize,0); + Raw.GetB((byte *)&FileName[0],ReadNameSize); + + UtfToWide(FileName.data(),hd->FileName); // Should do it before converting names, because extra fields can // affect name processing, like in case of NTFS streams. @@ -884,7 +901,7 @@ break; case HEAD_ENDARC: { - *(BaseBlock *)&EndArcHead=ShortBlock; + EndArcHead.SetBaseBlock(ShortBlock); uint ArcFlags=(uint)Raw.GetV(); EndArcHead.NextVolume=(ArcFlags & EHFL_NEXTVOLUME)!=0; EndArcHead.StoreVolNumber=false; @@ -916,7 +933,7 @@ *PasswordA=0; if (Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)PasswordA,ASIZE(PasswordA))==-1) *PasswordA=0; - GetWideName(PasswordA,NULL,PasswordW,ASIZE(PasswordW)); + CharToWide(PasswordA,PasswordW,ASIZE(PasswordW)); cleandata(PasswordA,sizeof(PasswordA)); } Cmd->Password.Set(PasswordW); @@ -991,19 +1008,14 @@ if ((Flags & MHEXTRA_METADATA_NAME)!=0) { uint64 NameSize=Raw->GetV(); - if (NameSize<0x10000) // Prevent excessive allocation. + if (NameSize>0 && NameSize<MAXPATHSIZE) // Prevent excessive allocation. { - std::vector<char> NameU((size_t)NameSize); // UTF-8 name. + std::string NameU((size_t)NameSize,0); // UTF-8 name. Raw->GetB(&NameU[0],(size_t)NameSize); // If starts from 0, the name was longer than reserved space // when saving this extra field. if (NameU[0]!=0) - { - NameU.push_back(0); - std::vector<wchar> NameW(NameU.size()*4); - UtfToWide(&NameU[0],&NameW[0],NameW.size()); - hd->OrigName.assign(&NameW[0]); - } + UtfToWide(&NameU[0],hd->OrigName); } } if ((Flags & MHEXTRA_METADATA_CTIME)!=0) @@ -1029,11 +1041,7 @@ FileHeader *hd=(FileHeader *)bb; uint EncVersion=(uint)Raw->GetV(); if (EncVersion>CRYPT_VERSION) - { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"x%u",EncVersion); - UnkEncVerMsg(hd->FileName,Info); - } + UnkEncVerMsg(hd->FileName,L"x" + std::to_wstring(EncVersion)); else { uint Flags=(uint)Raw->GetV(); @@ -1041,11 +1049,7 @@ hd->UseHashKey=(Flags & FHEXTRA_CRYPT_HASHMAC)!=0; hd->Lg2Count=Raw->Get1(); if (hd->Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX) - { - wchar Info[20]; - swprintf(Info,ASIZE(Info),L"xc%u",hd->Lg2Count); - UnkEncVerMsg(hd->FileName,Info); - } + UnkEncVerMsg(hd->FileName,L"xc" + std::to_wstring(hd->Lg2Count)); Raw->GetB(hd->Salt,SIZE_SALT50); Raw->GetB(hd->InitV,SIZE_INITV); if (hd->UsePswCheck) @@ -1062,12 +1066,8 @@ byte csum[SIZE_PSWCHECK_CSUM]; Raw->GetB(csum,SIZE_PSWCHECK_CSUM); - sha256_context ctx; - sha256_init(&ctx); - sha256_process(&ctx, hd->PswCheck, SIZE_PSWCHECK); - byte Digest[SHA256_DIGEST_SIZE]; - sha256_done(&ctx, Digest); + sha256_get(hd->PswCheck, SIZE_PSWCHECK, Digest); hd->UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; @@ -1133,31 +1133,27 @@ if (Version!=0) { hd->Version=true; - - wchar VerText[20]; - swprintf(VerText,ASIZE(VerText),L";%u",Version); - wcsncatz(hd->FileName,VerText,ASIZE(hd->FileName)); + hd->FileName += L';' + std::to_wstring(Version); } } break; case FHEXTRA_REDIR: { - hd->RedirType=(FILE_SYSTEM_REDIRECT)Raw->GetV(); + FILE_SYSTEM_REDIRECT RedirType=(FILE_SYSTEM_REDIRECT)Raw->GetV(); uint Flags=(uint)Raw->GetV(); - hd->DirTarget=(Flags & FHEXTRA_REDIR_DIR)!=0; size_t NameSize=(size_t)Raw->GetV(); - char UtfName[NM*4]; - *UtfName=0; - if (NameSize<ASIZE(UtfName)-1) + if (NameSize>0 && NameSize<MAXPATHSIZE) { - Raw->GetB(UtfName,NameSize); - UtfName[NameSize]=0; - } + std::string UtfName(NameSize,0); + hd->RedirType=RedirType; + hd->DirTarget=(Flags & FHEXTRA_REDIR_DIR)!=0; + Raw->GetB(&UtfName[0],NameSize); + UtfToWide(&UtfName[0],hd->RedirName); #ifdef _WIN_ALL - UnixSlashToDos(UtfName,UtfName,ASIZE(UtfName)); + UnixSlashToDos(hd->RedirName,hd->RedirName); #endif - UtfToWide(UtfName,hd->RedirName,ASIZE(hd->RedirName)); + } } break; case FHEXTRA_UOWNER: @@ -1214,8 +1210,8 @@ // We cannot allocate too much memory here, because above // we check FieldSize againt Raw size and we control that Raw size // is sensible when reading headers. - hd->SubData.Alloc((size_t)FieldSize); - Raw->GetB(hd->SubData.Addr(0),(size_t)FieldSize); + hd->SubData.resize((size_t)FieldSize); + Raw->GetB(hd->SubData.data(),(size_t)FieldSize); } break; } @@ -1238,7 +1234,7 @@ Raw.GetB(Mark,4); uint HeadSize=Raw.Get2(); if (HeadSize<7) - return false; + return 0; byte Flags=Raw.Get1(); NextBlockPos=CurBlockPos+HeadSize; CurHeaderType=HEAD_MAIN; @@ -1261,7 +1257,7 @@ FileHead.FileHash.CRC32=Raw.Get2(); FileHead.HeadSize=Raw.Get2(); if (FileHead.HeadSize<21) - return false; + return 0; uint FileTime=Raw.Get4(); FileHead.FileAttr=Raw.Get1(); FileHead.Flags=Raw.Get1()|LONG_BLOCK; @@ -1285,12 +1281,13 @@ Raw.Read(NameSize); - char FileName[NM]; - size_t ReadNameSize=Min(NameSize,ASIZE(FileName)-1); - Raw.GetB((byte *)FileName,ReadNameSize); - FileName[ReadNameSize]=0; - IntToExt(FileName,FileName,ASIZE(FileName)); - CharToWide(FileName,FileHead.FileName,ASIZE(FileHead.FileName)); + // RAR 1.4 name size is stored in a single byte field and it can't + // exceed 255, so additional checks are not needed. + std::string FileName(NameSize,0); + Raw.GetB((byte *)&FileName[0],NameSize); + std::string NameA; + IntToExt(FileName,NameA); + CharToWide(NameA,FileHead.FileName); ConvertNameCase(FileHead.FileName); ConvertFileHeader(&FileHead); @@ -1304,7 +1301,7 @@ #ifndef SFX_MODULE -void Archive::ConvertNameCase(wchar *Name) +void Archive::ConvertNameCase(std::wstring &Name) { if (Cmd->ConvertNames==NAMES_UPPERCASE) wcsupper(Name); @@ -1322,7 +1319,7 @@ void Archive::ConvertAttributes() { -#if defined(_WIN_ALL) || defined(_EMX) +#ifdef _WIN_ALL if (FileHead.HSType!=HSYS_WINDOWS) FileHead.FileAttr=FileHead.Dir ? 0x10 : 0x20; #endif @@ -1387,19 +1384,23 @@ void Archive::ConvertFileHeader(FileHeader *hd) { +/* if (hd->HSType==HSYS_UNKNOWN) if (hd->Dir) hd->FileAttr=0x10; else hd->FileAttr=0x20; +*/ #ifdef _WIN_ALL if (hd->HSType==HSYS_UNIX) // Convert Unix, OS X and Android decomposed chracters to Windows precomposed. - ConvertToPrecomposed(hd->FileName,ASIZE(hd->FileName)); + ConvertToPrecomposed(hd->FileName); #endif - for (wchar *s=hd->FileName;*s!=0;s++) + for (uint I=0;I<hd->FileName.size();I++) { + wchar *s=&hd->FileName[I]; + #ifdef _UNIX // Backslash is the invalid character for Windows file headers, // but it can present in Unix file names extracted in Unix. @@ -1407,7 +1408,7 @@ *s='_'; #endif -#if defined(_WIN_ALL) || defined(_EMX) +#ifdef _WIN_ALL // RAR 5.0 archives do not use '\' as path separator, so if we see it, // it means that it is a part of Unix file name, which we cannot // extract in Windows. @@ -1432,6 +1433,9 @@ if (*s=='/' || *s=='\\' && Format!=RARFMT50) *s=CPATHDIVIDER; } + + // Zeroes inside might be possible in broken Unicode names decoded with EncodeFileName::Decode. + TruncateAtZero(hd->FileName); // Ensure there are no zeroes inside of string. } @@ -1446,7 +1450,7 @@ } -bool Archive::ReadSubData(Array<byte> *UnpData,File *DestFile,bool TestMode) +bool Archive::ReadSubData(std::vector<byte> *UnpData,File *DestFile,bool TestMode) { if (BrokenHeader) { @@ -1454,7 +1458,7 @@ ErrHandler.SetErrorCode(RARX_CRC); return false; } - if (SubHead.Method>5 || SubHead.UnpVer>(Format==RARFMT50 ? VER_UNPACK5:VER_UNPACK)) + if (SubHead.Method>5 || SubHead.UnpVer>(Format==RARFMT50 ? VER_UNPACK7:VER_UNPACK)) { uiMsg(UIERROR_SUBHEADERUNKNOWN,FileName); return false; @@ -1481,7 +1485,7 @@ SubDataIO.SetTestMode(true); else { - UnpData->Alloc((size_t)SubHead.UnpSize); + UnpData->resize((size_t)SubHead.UnpSize); SubDataIO.SetUnpackToMemory(&(*UnpData)[0],(uint)SubHead.UnpSize); } } @@ -1510,7 +1514,7 @@ uiMsg(UIERROR_SUBHEADERDATABROKEN,FileName,SubHead.FileName); ErrHandler.SetErrorCode(RARX_CRC); if (UnpData!=NULL) - UnpData->Reset(); + UnpData->clear(); return false; } return true; Modified: trunk/OpenMPT/include/unrar/blake2s.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/blake2s.cpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/blake2s.cpp Sat Mar 2 23:29:05 2024 (r20181) @@ -2,6 +2,20 @@ #include "rar.hpp" +static const byte blake2s_sigma[10][16] = +{ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , +}; + #ifdef USE_SSE #include "blake2s_sse.cpp" #endif @@ -18,20 +32,6 @@ 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL }; -static const byte blake2s_sigma[10][16] = -{ - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , - { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , - { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , - { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , - { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , - { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , - { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , - { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , - { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , - { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , -}; - static inline void blake2s_set_lastnode( blake2s_state *S ) { S->f[1] = ~0U; @@ -134,11 +134,7 @@ blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES ); #ifdef USE_SSE -#ifdef _WIN_32 // We use SSSE3 _mm_shuffle_epi8 only in x64 mode. - if (_SSE_Version>=SSE_SSE2) -#else if (_SSE_Version>=SSE_SSSE3) -#endif blake2s_compress_sse( S, S->buf ); else blake2s_compress( S, S->buf ); // Compress Modified: trunk/OpenMPT/include/unrar/blake2s_sse.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/blake2s_sse.cpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/blake2s_sse.cpp Sat Mar 2 23:29:05 2024 (r20181) @@ -1,15 +1,14 @@ // Based on public domain code written in 2012 by Samuel Neves -extern const byte blake2s_sigma[10][16]; - // Initialization vector. static __m128i blake2s_IV_0_3, blake2s_IV_4_7; -#ifdef _WIN_64 -// Constants for cyclic rotation. Used in 64-bit mode in mm_rotr_epi32 macro. +// Constants for cyclic rotation. static __m128i crotr8, crotr16; -#endif +#ifdef __GNUC__ +__attribute__((target("sse2"))) +#endif static void blake2s_init_sse() { // We cannot initialize these 128 bit variables in place when declaring @@ -24,28 +23,18 @@ blake2s_IV_0_3 = _mm_setr_epi32( 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A ); blake2s_IV_4_7 = _mm_setr_epi32( 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ); -#ifdef _WIN_64 crotr8 = _mm_set_epi8( 12, 15, 14, 13, 8, 11, 10, 9, 4, 7, 6, 5, 0, 3, 2, 1 ); crotr16 = _mm_set_epi8( 13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2 ); -#endif } #define LOAD(p) _mm_load_si128( (__m128i *)(p) ) #define STORE(p,r) _mm_store_si128((__m128i *)(p), r) -#ifdef _WIN_32 -// 32-bit mode has less SSE2 registers and in MSVC2008 it is more efficient -// to not use _mm_shuffle_epi8 here. -#define mm_rotr_epi32(r, c) ( \ - _mm_xor_si128(_mm_srli_epi32( (r), c ),_mm_slli_epi32( (r), 32-c )) ) -#else #define mm_rotr_epi32(r, c) ( \ c==8 ? _mm_shuffle_epi8(r,crotr8) \ : c==16 ? _mm_shuffle_epi8(r,crotr16) \ : _mm_xor_si128(_mm_srli_epi32( (r), c ),_mm_slli_epi32( (r), 32-c )) ) -#endif - #define G1(row1,row2,row3,row4,buf) \ row1 = _mm_add_epi32( _mm_add_epi32( row1, buf), row2 ); \ @@ -73,14 +62,6 @@ row3 = _mm_shuffle_epi32( row3, _MM_SHUFFLE(1,0,3,2) ); \ row2 = _mm_shuffle_epi32( row2, _MM_SHUFFLE(2,1,0,3) ); -#ifdef _WIN_64 - // MSVC 2008 in x64 mode expands _mm_set_epi32 to store to stack and load - // from stack operations, which are slower than this code. - #define _mm_set_epi32(i3,i2,i1,i0) \ - _mm_unpacklo_epi32(_mm_unpacklo_epi32(_mm_cvtsi32_si128(i0),_mm_cvtsi32_si128(i2)), \ - _mm_unpacklo_epi32(_mm_cvtsi32_si128(i1),_mm_cvtsi32_si128(i3))) -#endif - // Original BLAKE2 SSE4.1 message loading code was a little slower in x86 mode // and about the same in x64 mode in our test. Perhaps depends on compiler. // We also tried _mm_i32gather_epi32 and _mm256_i32gather_epi32 AVX2 gather @@ -101,6 +82,9 @@ } +#ifdef __GNUC__ +__attribute__((target("ssse3"))) +#endif static int blake2s_compress_sse( blake2s_state *S, const byte block[BLAKE2S_BLOCKBYTES] ) { __m128i row[4]; Modified: trunk/OpenMPT/include/unrar/blake2sp.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/blake2sp.cpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/blake2sp.cpp Sat Mar 2 23:29:05 2024 (r20181) @@ -20,7 +20,7 @@ blake2s_init_param( &S->R, 0, 1 ); // Init root. - for( uint i = 0; i < PARALLELISM_DEGREE; ++i ) + for( uint32 i = 0; i < PARALLELISM_DEGREE; ++i ) blake2s_init_param( &S->S[i], i, 0 ); // Init leaf. S->R.last_node = 1; @@ -49,6 +49,8 @@ if (_SSE_Version>=SSE_SSE && inlen__ >= 2 * PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES) _mm_prefetch((char*)(in__ + PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES), _MM_HINT_T0); #endif + // We tried to _forceinline blake2s_update and blake2s_compress_sse, + // but it didn't improve performance. blake2s_update( S, in__, BLAKE2S_BLOCKBYTES ); in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES; inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES; Modified: trunk/OpenMPT/include/unrar/cmddata.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/cmddata.cpp Sat Mar 2 22:17:07 2024 (r20180) +++ trunk/OpenMPT/include/unrar/cmddata.cpp Sat Mar 2 23:29:05 2024 (r20181) @@ -13,8 +13,18 @@ { RAROptions::Init(); - *Command=0; - *ArcName=0; + Command.clear(); + ArcName.clear(); + ExtrPath.clear(); + TempPath.clear(); + SFXModule.clear(); + CommentFile.clear(); + ArcPath.clear(); + ExclArcPath.clear(); + LogName.clear(); + EmailTo.clear(); + UseStdin.clear(); + FileLists=false; NoMoreSwitches=false; @@ -30,57 +40,45 @@ StoreArgs.Reset(); Password.Clean(); NextVolSizes.clear(); -} - - -// Return the pointer to next position in the string and store dynamically -// allocated command line parameter in Par. -static const wchar *AllocCmdParam(const wchar *CmdLine,wchar **Par) -{ - const wchar *NextCmd=GetCmdParam(CmdLine,NULL,0); - if (NextCmd==NULL) - return NULL; - size_t ParSize=NextCmd-CmdLine+2; // Parameter size including the trailing zero. - *Par=(wchar *)malloc(ParSize*sizeof(wchar)); - if (*Par==NULL) - return NULL; - return GetCmdParam(CmdLine,*Par,ParSize); +#ifdef RARDLL + DllDestName.clear(); +#endif } #if !defined(SFX_MODULE) void CommandData::ParseCommandLine(bool Preprocess,int argc, char *argv[]) { - *Command=0; + Command.clear(); NoMoreSwitches=false; #ifdef CUSTOM_CMDLINE_PARSER // In Windows we may prefer to implement our own command line parser // to avoid replacing \" by " in standard parser. Such replacing corrupts // destination paths like "dest path\" in extraction commands. - const wchar *CmdLine=GetCommandLine(); + std::wstring CmdLine=GetCommandLine(); + + std::wstring Param; + std::wstring::size_type Pos=0; - wchar *Par; for (bool FirstParam=true;;FirstParam=false) { - if ((CmdLine=AllocCmdParam(CmdLine,&Par))==NULL) + if (!GetCmdParam(CmdLine,Pos,Param)) break; if (!FirstParam) // First parameter is the executable name. if (Preprocess) - PreprocessArg(Par); + PreprocessArg(Param.data()); else - ParseArg(Par); - free(Par); + ParseArg(Param.data()); } #else - Array<wchar> Arg; for (int I=1;I<argc;I++) { - Arg.Alloc(strlen(argv[I])+1); - CharToWide(argv[I],&Arg[0],Arg.Size()); + std::wstring Arg; + CharToWide(argv[I],Arg); if (Preprocess) - PreprocessArg(&Arg[0]); + PreprocessArg(Arg.data()); else - ParseArg(&Arg[0]); + ParseArg(Arg.data()); } #endif if (!Preprocess) @@ -90,7 +88,7 @@ #if !defined(SFX_MODULE) -void CommandData::ParseArg(wchar *Arg) +void CommandData::ParseArg(const wchar *Arg) { if (IsSwitch(*Arg) && !NoMoreSwitches) if (Arg[1]=='-' && Arg[2]==0) @@ -98,39 +96,52 @@ else ProcessSwitch(Arg+1); else - if (*Command==0) + if (Command.empty()) { - wcsncpyz(Command,Arg,ASIZE(Command)); + Command=Arg; - *Command=toupperw(*Command); + Command[0]=toupperw(Command[0]); // 'I' and 'S' commands can contain case sensitive strings after // the first character, so we must not modify their case. // 'S' can contain SFX name, which case is important in Unix. - if (*Command!='I' && *Command!='S') + if (Command[0]!='I' && Command[0]!='S') wcsupper(Command); - if (*Command=='P') // Enforce -idq for print command. + if (Command[0]=='P') // Enforce -idq for print command. { MsgStream=MSG_ERRONLY; SetConsoleMsgStream(MSG_ERRONLY); } } else - if (*ArcName==0) - wcsncpyz(ArcName,Arg,ASIZE(ArcName)); + if (ArcName.empty()) + ArcName=Arg; else { // Check if last character is the path separator. size_t Length=wcslen(Arg); wchar EndChar=Length==0 ? 0:Arg[Length-1]; - bool EndSeparator=IsDriveDiv(EndChar) || IsPathDiv(EndChar); + // Check if trailing path separator like path\ is present. + bool FolderArg=IsDriveDiv(EndChar) || IsPathDiv(EndChar); + + // 2024.01.05: We were asked to support exotic d:. and d:.. paths. + if (IsDriveLetter(Arg) && Arg[2]=='.' && (Arg[3]==0 || Arg[3]=='.' && Arg[4]==0)) + FolderArg=true; + + // 2024.01.06: FindFile::FastFind check below fails in Windows 10 if + // "." or ".." points at disk root. So we enforce it for "." and ".." + // optionally preceded with some path like "..\..". + size_t L=Length; + if (L>0 && Arg[L-1]=='.' && (L==1 || L>=2 && (IsPathDiv(Arg[L-2]) || + Arg[L-2]=='.' && (L==2 || L>=3 && IsPathDiv(Arg[L-3]))))) + FolderArg=true; - wchar CmdChar=toupperw(*Command); + wchar CmdChar=toupperw(Command[0]); bool Add=wcschr(L"AFUM",CmdChar)!=NULL; bool Extract=CmdChar=='X' || CmdChar=='E'; bool Repair=CmdChar=='R' && Command[1]==0; - if (EndSeparator && !Add) - wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); + if (FolderArg && !Add) + ExtrPath=Arg; else if ((Add || CmdChar=='T') && (*Arg!='@' || ListMode==RCLM_REJECT_LISTS)) FileArgs.AddString(Arg); @@ -147,10 +158,10 @@ } else // We use 'destpath\' when extracting and reparing. - if (Found && FileData.IsDir && (Extract || Repair) && *ExtrPath==0) + if (Found && FileData.IsDir && (Extract || Repair) && ExtrPath.empty()) { - wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); - AddEndSlash(ExtrPath,ASIZE(ExtrPath)); + ExtrPath=Arg; + AddEndSlash(ExtrPath); } else FileArgs.AddString(Arg); @@ -178,12 +189,12 @@ #if !defined(SFX_MODULE) void CommandData::ParseEnvVar() { - char *EnvStr=getenv("RAR"); - if (EnvStr!=NULL) + char *EnvVar=getenv("RAR"); + if (EnvVar!=NULL) { - Array<wchar> EnvStrW(strlen(EnvStr)+1); - CharToWide(EnvStr,&EnvStrW[0],EnvStrW.Size()); - ProcessSwitchesString(&EnvStrW[0]); + std::wstring EnvStr; + CharToWide(EnvVar,EnvStr); + ProcessSwitchesString(EnvStr); } } #endif @@ -192,7 +203,7 @@ #if !defined(SFX_MODULE) // Preprocess those parameters, which must be processed before the rest of -// command line. Return 'false' to stop further processing. +// command line. void CommandData::PreprocessArg(const wchar *Arg) { if (IsSwitch(Arg[0]) && !NoMoreSwitches) @@ -201,7 +212,7 @@ if (Arg[0]=='-' && Arg[1]==0) // Switch "--". NoMoreSwitches=true; if (wcsicomp(Arg,L"cfg-")==0) - ConfigDisabled=true; + ProcessSwitch(Arg); if (wcsnicomp(Arg,L"ilog",4)==0) { // Ensure that correct log file name is already set @@ -213,13 +224,13 @@ { // Process -sc before reading any file lists. ProcessSwitch(Arg); - if (*LogName!=0) + if (!LogName.empty()) InitLogOptions(LogName,ErrlogCharset); } } else - if (*Command==0) - wcsncpy(Command,Arg,ASIZE(Command)); // Need for rar.ini. + if (Command.empty()) + Command=Arg; // Need for rar.ini. } #endif @@ -237,10 +248,10 @@ Str++; if (wcsnicomp(Str,L"switches=",9)==0) ProcessSwitchesString(Str+9); - if (*Command!=0) + if (!Command.empty()) { wchar Cmd[16]; - wcsncpyz(Cmd,Command,ASIZE(Cmd)); + wcsncpyz(Cmd,Command.c_str(),ASIZE(Cmd)); wchar C0=toupperw(Cmd[0]); wchar C1=toupperw(Cmd[1]); if (C0=='I' || C0=='L' || C0=='M' || C0=='S' || C0=='V') @@ -260,14 +271,19 @@ #if !defined(SFX_MODULE) -void CommandData::ProcessSwitchesString(const wchar *Str) +void CommandData::ProcessSwitchesString(const std::wstring &Str) { - wchar *Par; - while ((Str=AllocCmdParam(Str,&Par))!=NULL) + std::wstring Par; + std::wstring::size_type Pos=0; + while (GetCmdParam(Str,Pos,Par)) { - if (IsSwitch(*Par)) - ProcessSwitch(Par+1); - free(Par); + if (IsSwitch(Par[0])) + ProcessSwitch(&Par[1]); + else + { + mprintf(St(MSwSyntaxError),Par.c_str()); + ErrHandler.Exit(RARX_USERERROR); + } } } #endif @@ -330,13 +346,12 @@ break; } break; - case 'N': // Reserved for archive name. - break; case 'O': AddArcOnly=true; break; case 'P': - wcsncpyz(ArcPath,Switch+2,ASIZE(ArcPath)); + // Convert slashes here than before every comparison. + SlashToNative(Switch+2,ArcPath); break; case 'S': SyncFiles=true; @@ -347,7 +362,14 @@ } break; case 'C': - if (Switch[2]==0) + if (Switch[2]!=0) + { + if (wcsicomp(Switch+1,L"FG-")==0) + ConfigDisabled=true; + else + BadSwitch(Switch); + } + else switch(toupperw(Switch[1])) { case '-': @@ -359,10 +381,15 @@ case 'L': ConvertNames=NAMES_LOWERCASE; break; + default: + BadSwitch(Switch); + break; } break; case 'D': - if (Switch[2]==0) + if (Switch[2]!=0) + BadSwitch(Switch); + else switch(toupperw(Switch[1])) { case 'S': @@ -374,6 +401,9 @@ case 'F': DeleteFiles=true; break; + default: + BadSwitch(Switch); + break; } break; case 'E': @@ -395,7 +425,11 @@ ExclPath=EXCL_ABSPATH; break; case '4': - wcsncpyz(ExclArcPath,Switch+3,ASIZE(ExclArcPath)); + // Convert slashes here than before every comparison. + SlashToNative(Switch+3,ArcPath); + break; + default: + BadSwitch(Switch); break; } break; @@ -431,7 +465,7 @@ else if (!Password.IsSet()) { - uiGetPassword(UIPASSWORD_GLOBAL,NULL,&Password,NULL); + uiGetPassword(UIPASSWORD_GLOBAL,L"",&Password,NULL); eprintf(L"\n"); } break; @@ -443,7 +477,7 @@ case 'I': if (wcsnicomp(Switch+1,L"LOG",3)==0) { - wcsncpyz(LogName,Switch[4]!=0 ? Switch+4:DefLogName,ASIZE(LogName)); + LogName=Switch[4]!=0 ? Switch+4:DefLogName; break; } if (wcsnicomp(Switch+1,L"SND",3)==0) @@ -461,7 +495,7 @@ } if (wcsnicomp(Switch+1,L"EML",3)==0) { - wcsncpyz(EmailTo,Switch[4]!=0 ? Switch+4:L"@",ASIZE(EmailTo)); + EmailTo=Switch[4]!=0 ? Switch+4:L"@"; break; } if (wcsicomp(Switch+1,L"M")==0) // For compatibility with pre-WinRAR 6.0 -im syntax. Replaced with -idv. @@ -568,12 +602,14 @@ } switch(toupperw(*(Str++))) { - case 'T': Type=FILTER_PPM; break; +// case 'T': Type=FILTER_TEXT; break; case 'E': Type=FILTER_E8; break; case 'D': Type=FILTER_DELTA; break; - case 'A': Type=FILTER_AUDIO; break; - case 'C': Type=FILTER_RGB; break; - case 'R': Type=FILTER_ARM; break; +// case 'A': Type=FILTER_AUDIO; break; +// case 'C': Type=FILTER_RGB; break; +// case 'R': Type=FILTER_ARM; break; + case 'L': Type=FILTER_LONGRANGE; break; + case 'X': Type=FILTER_EXHAUSTIVE; break; } if (*Str=='+' || *Str=='-') State=*(Str++)=='+' ? FILTER_FORCE:FILTER_DISABLE; @@ -586,6 +622,44 @@ case 'M': break; case 'D': + { + bool SetDictLimit=toupperw(Switch[2])=='X'; + + uint64 Size=atoiw(Switch+(SetDictLimit ? 3 : 2)); + wchar LastChar=toupperw(Switch[wcslen(Switch)-1]); + if (IsDigit(LastChar)) + LastChar=SetDictLimit ? 'G':'M'; // Treat -md128 as -md128m and -mdx32 as -mdx32g. + switch(LastChar) + { + case 'K': + Size*=1024; + break; + case 'M': + Size*=1024*1024; + break; + case 'G': + Size*=1024*1024*1024; + break; + default: + BadSwitch(Switch); + } + + // 2023.07.22: For 4 GB and less we also check that it is power of 2, + // so archives are compatible with RAR 5.0+. + // We allow Size>PACK_MAX_DICT here, so we can use -md[x] to unpack + // archives created by future versions with higher PACK_MAX_DICT + uint Flags; + if ((Size=Archive::GetWinSize(Size,Flags))==0 || + Size<=0x100000000ULL && !IsPow2(Size)) + BadSwitch(Switch); + else + if (SetDictLimit) + WinSizeLimit=Size; + else + { + WinSize=Size; + } + } break; case 'E': if (toupperw(Switch[2])=='S' && Switch[3]==0) @@ -593,25 +667,20 @@ break; case 'S': { - wchar StoreNames[1024]; - wcsncpyz(StoreNames,(Switch[2]==0 ? DefaultStoreList:Switch+2),ASIZE(StoreNames)); - wchar *Names=StoreNames; - while (*Names!=0) + std::wstring StoreNames=(Switch[2]==0 ? DefaultStoreList:Switch+2); + size_t Pos=0; + while (Pos<StoreNames.size()) { - wchar *End=wcschr(Names,';'); - if (End!=NULL) - *End=0; - if (*Names=='.') - Names++; - wchar Mask[NM]; - if (wcspbrk(Names,L"*?.")==NULL) - swprintf(Mask,ASIZE(Mask),L"*.%ls",Names); - else - wcsncpyz(Mask,Names,ASIZE(Mask)); + if (StoreNames[Pos]=='.') + Pos++; + size_t EndPos=StoreNames.find(';',Pos); + std::wstring Mask=StoreNames.substr(Pos,EndPos==std::wstring::npos ? EndPos:EndPos-Pos); + if (Mask.find_first_of(L"*?.")==std::wstring::npos) + Mask.insert(0,L"*."); StoreArgs.AddString(Mask); - if (End==NULL) + if (EndPos==std::wstring::npos) break; - Names=End+1; + Pos=EndPos+1; } } break; @@ -668,8 +737,19 @@ #ifdef SAVE_LINKS case 'L': SaveSymLinks=true; - if (toupperw(Switch[2])=='A') - AbsoluteLinks=true; + for (uint I=2;Switch[I]!=0;I++) + switch(toupperw(Switch[I])) + { + case 'A': + AbsoluteLinks=true; + break; + case '-': + SkipSymLinks=true; + break; + default: + BadSwitch(Switch); + break; + } break; #endif #ifdef _WIN_ALL @@ -679,8 +759,8 @@ break; #endif case 'P': - wcsncpyz(ExtrPath,Switch+2,ASIZE(ExtrPath)); - AddEndSlash(ExtrPath,ASIZE(ExtrPath)); + ExtrPath=Switch+2; + AddEndSlash(ExtrPath); break; case 'R': Overwrite=OVERWRITE_AUTORENAME; @@ -701,7 +781,7 @@ case 'P': if (Switch[1]==0) { - uiGetPassword(UIPASSWORD_GLOBAL,NULL,&Password,NULL); + uiGetPassword(UIPASSWORD_GLOBAL,L"",&Password,NULL); eprintf(L"\n"); } else @@ -790,15 +870,15 @@ break; case 'I': ProhibitConsoleInput(); - wcsncpyz(UseStdin,Switch[2] ? Switch+2:L"stdin",ASIZE(UseStdin)); + UseStdin=Switch[2] ? Switch+2:L"stdin"; break; case 'L': if (IsDigit(Switch[2])) - FileSizeLess=atoilw(Switch+2); + FileSizeLess=GetVolSize(Switch+2,1); break; case 'M': if (IsDigit(Switch[2])) - FileSizeMore=atoilw(Switch+2); + FileSizeMore=GetVolSize(Switch+2,1); break; case 'C': { @@ -913,8 +993,8 @@ } break; case 'W': - wcsncpyz(TempPath,Switch+1,ASIZE(TempPath)); - AddEndSlash(TempPath,ASIZE(TempPath)); + TempPath=Switch+1; + AddEndSlash(TempPath); break; case 'Y': AllYes=true; @@ -923,10 +1003,10 @@ if (Switch[1]==0) { // If comment file is not specified, we read data from stdin. - wcsncpyz(CommentFile,L"stdin",ASIZE(CommentFile)); + CommentFile=L"stdin"; } else - wcsncpyz(CommentFile,Switch+1,ASIZE(CommentFile)); + CommentFile=Switch+1; break; case '?' : OutHelp(RARX_SUCCESS); @@ -943,7 +1023,6 @@ void CommandData::BadSwitch(const wchar *Switch) { mprintf(St(MUnknownOption),Switch); - mprintf(L"\n"); ErrHandler.Exit(RARX_USERERROR); } #endif @@ -954,34 +1033,36 @@ #ifndef SFX_MODULE const wchar *SingleCharCommands=L"FUADPXETK"; - if (Command[0]!=0 && Command[1]!=0 && wcschr(SingleCharCommands,Command[0])!=NULL || *ArcName==0) - Out... [truncated message content] |
From: <sv...@op...> - 2024-03-02 21:17:18
|
Author: sagamusix Date: Sat Mar 2 22:17:07 2024 New Revision: 20180 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20180 Log: [Fix] Pattern tab: Avoid selecting an invisible column when pattern detail is medium or high and right-clicking past the last channel. Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/PatternCursor.h trunk/OpenMPT/mptrack/PatternFindReplace.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp Sat Mar 2 21:22:13 2024 (r20179) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp Sat Mar 2 22:17:07 2024 (r20180) @@ -1520,7 +1520,7 @@ m_Selection = PatternRect(beginSel, endSel); if(const CSoundFile *sndFile = GetSoundFile(); sndFile != nullptr && sndFile->Patterns.IsValidPat(m_nPattern)) { - m_Selection.Sanitize(sndFile->Patterns[m_nPattern].GetNumRows(), sndFile->GetNumChannels()); + m_Selection.Sanitize(sndFile->Patterns[m_nPattern].GetNumRows(), sndFile->GetNumChannels(), m_nDetailLevel); } UpdateIndicator(); Modified: trunk/OpenMPT/mptrack/PatternCursor.h ============================================================================== --- trunk/OpenMPT/mptrack/PatternCursor.h Sat Mar 2 21:22:13 2024 (r20179) +++ trunk/OpenMPT/mptrack/PatternCursor.h Sat Mar 2 22:17:07 2024 (r20180) @@ -173,7 +173,7 @@ // Ensure that the point lies within a given pattern size. - void Sanitize(ROWINDEX maxRows, CHANNELINDEX maxChans) + void Sanitize(ROWINDEX maxRows, CHANNELINDEX maxChans, Columns maxColumn = PatternCursor::lastColumn) { ROWINDEX row = std::min(GetRow(), static_cast<ROWINDEX>(maxRows - 1)); CHANNELINDEX chn = GetChannel(); @@ -182,10 +182,10 @@ if(chn >= maxChans) { chn = maxChans - 1; - col = lastColumn; - } else if(col > lastColumn) + col = maxColumn; + } else if(col > maxColumn) { - col = lastColumn; + col = maxColumn; } Set(row, chn, col); }; @@ -272,11 +272,11 @@ } // Ensure that the selection doesn't exceed a given pattern size. - void Sanitize(ROWINDEX maxRows, CHANNELINDEX maxChans) + void Sanitize(ROWINDEX maxRows, CHANNELINDEX maxChans, PatternCursor::Columns maxColumn = PatternCursor::lastColumn) { - upperLeft.Sanitize(maxRows, maxChans); - lowerRight.Sanitize(maxRows, maxChans); - }; + upperLeft.Sanitize(maxRows, maxChans, maxColumn); + lowerRight.Sanitize(maxRows, maxChans, maxColumn); + } // Get first row of selection Modified: trunk/OpenMPT/mptrack/PatternFindReplace.cpp ============================================================================== --- trunk/OpenMPT/mptrack/PatternFindReplace.cpp Sat Mar 2 21:22:13 2024 (r20179) +++ trunk/OpenMPT/mptrack/PatternFindReplace.cpp Sat Mar 2 22:17:07 2024 (r20180) @@ -40,7 +40,7 @@ } else if(sndFile.Patterns.IsValidPat(m_nPattern)) { const CPattern &pat = sndFile.Patterns[m_nPattern]; - m_Cursor.Sanitize(pat.GetNumRows(), pat.GetNumChannels()); + m_Cursor.Sanitize(pat.GetNumRows(), pat.GetNumChannels(), m_nDetailLevel); m = *pat.GetpModCommand(m_Cursor.GetRow(), m_Cursor.GetChannel()); } Modified: trunk/OpenMPT/mptrack/View_pat.cpp ============================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp Sat Mar 2 21:22:13 2024 (r20179) +++ trunk/OpenMPT/mptrack/View_pat.cpp Sat Mar 2 22:17:07 2024 (r20180) @@ -3844,8 +3844,8 @@ if(pSndFile != nullptr && pSndFile->Patterns.IsValidPat(GetCurrentPattern())) { const auto &pattern = GetSoundFile()->Patterns[m_nPattern]; - m_Cursor.Sanitize(pattern.GetNumRows(), pattern.GetNumChannels()); - m_Selection.Sanitize(pattern.GetNumRows(), pattern.GetNumChannels()); + m_Cursor.Sanitize(pattern.GetNumRows(), pattern.GetNumChannels(), m_nDetailLevel); + m_Selection.Sanitize(pattern.GetNumRows(), pattern.GetNumChannels(), m_nDetailLevel); } }; |
From: <sv...@op...> - 2024-03-02 20:22:25
|
Author: manx Date: Sat Mar 2 21:22:13 2024 New Revision: 20179 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20179 Log: Merged revision(s) 20178 from trunk/OpenMPT: [Fix] build: Emscripten 3.1.55 does not produce separate .mem files any more. Do not try to copy them for distribution. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/Makefile branches/OpenMPT-1.31/build/auto/dist-js.sh Modified: branches/OpenMPT-1.31/Makefile ============================================================================== --- branches/OpenMPT-1.31/Makefile Sat Mar 2 21:21:46 2024 (r20178) +++ branches/OpenMPT-1.31/Makefile Sat Mar 2 21:22:13 2024 (r20179) @@ -1854,7 +1854,6 @@ mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.js bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.js - cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.js.mem bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.js.mem cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.wasm bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.wasm cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.wasm.js bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.wasm.js mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)wasm @@ -1862,7 +1861,6 @@ cp bin/$(FLAVOUR_DIR)stage/wasm/libopenmpt.wasm bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)wasm/libopenmpt.wasm mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js cp bin/$(FLAVOUR_DIR)stage/js/libopenmpt.js bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js/libopenmpt.js - cp bin/$(FLAVOUR_DIR)stage/js/libopenmpt.js.mem bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js/libopenmpt.js.mem cd bin/$(FLAVOUR_DIR)dist-js/ && tar cv --numeric-owner --owner=0 --group=0 libopenmpt-$(DIST_LIBOPENMPT_VERSION) > libopenmpt-$(DIST_LIBOPENMPT_VERSION).dev.js.tar .PHONY: bin/$(FLAVOUR_DIR)dist-dos/libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.dos.zip Modified: branches/OpenMPT-1.31/build/auto/dist-js.sh ============================================================================== --- branches/OpenMPT-1.31/build/auto/dist-js.sh Sat Mar 2 21:21:46 2024 (r20178) +++ branches/OpenMPT-1.31/build/auto/dist-js.sh Sat Mar 2 21:22:13 2024 (r20179) @@ -16,7 +16,6 @@ make CONFIG=emscripten TEST=1 ONLY_TEST=1 EMSCRIPTEN_TARGET=all VERBOSE=1 check make CONFIG=emscripten TEST=0 EMSCRIPTEN_TARGET=all VERBOSE=1 cp bin/libopenmpt.js bin/stage/all/ -cp bin/libopenmpt.js.mem bin/stage/all/ cp bin/libopenmpt.wasm bin/stage/all/ cp bin/libopenmpt.wasm.js bin/stage/all/ make CONFIG=emscripten EMSCRIPTEN_TARGET=all VERBOSE=1 clean @@ -36,7 +35,6 @@ make CONFIG=emscripten TEST=1 ONLY_TEST=1 EMSCRIPTEN_TARGET=js VERBOSE=1 check make CONFIG=emscripten TEST=0 EMSCRIPTEN_TARGET=js VERBOSE=1 cp bin/libopenmpt.js bin/stage/js/ -cp bin/libopenmpt.js.mem bin/stage/js/ make CONFIG=emscripten EMSCRIPTEN_TARGET=js VERBOSE=1 clean make CONFIG=emscripten VERBOSE=1 dist-js |
From: <sv...@op...> - 2024-03-02 20:22:02
|
Author: manx Date: Sat Mar 2 21:21:46 2024 New Revision: 20178 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20178 Log: [Fix] build: Emscripten 3.1.55 does not produce separate .mem files any more. Do not try to copy them for distribution. Modified: trunk/OpenMPT/Makefile trunk/OpenMPT/build/auto/dist-js.sh Modified: trunk/OpenMPT/Makefile ============================================================================== --- trunk/OpenMPT/Makefile Sat Mar 2 20:42:53 2024 (r20177) +++ trunk/OpenMPT/Makefile Sat Mar 2 21:21:46 2024 (r20178) @@ -1933,7 +1933,6 @@ mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.js bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.js - cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.js.mem bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.js.mem cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.wasm bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.wasm cp bin/$(FLAVOUR_DIR)stage/all/libopenmpt.wasm.js bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)all/libopenmpt.wasm.js mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)wasm @@ -1941,7 +1940,6 @@ cp bin/$(FLAVOUR_DIR)stage/wasm/libopenmpt.wasm bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)wasm/libopenmpt.wasm mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js cp bin/$(FLAVOUR_DIR)stage/js/libopenmpt.js bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js/libopenmpt.js - cp bin/$(FLAVOUR_DIR)stage/js/libopenmpt.js.mem bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js/libopenmpt.js.mem cd bin/$(FLAVOUR_DIR)dist-js/ && tar cv --numeric-owner --owner=0 --group=0 libopenmpt-$(DIST_LIBOPENMPT_VERSION) > libopenmpt-$(DIST_LIBOPENMPT_VERSION).dev.js.tar .PHONY: bin/$(FLAVOUR_DIR)dist-dos/libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.dos.zip Modified: trunk/OpenMPT/build/auto/dist-js.sh ============================================================================== --- trunk/OpenMPT/build/auto/dist-js.sh Sat Mar 2 20:42:53 2024 (r20177) +++ trunk/OpenMPT/build/auto/dist-js.sh Sat Mar 2 21:21:46 2024 (r20178) @@ -16,7 +16,6 @@ make CONFIG=emscripten TEST=1 ONLY_TEST=1 EMSCRIPTEN_TARGET=all VERBOSE=1 check make CONFIG=emscripten TEST=0 EMSCRIPTEN_TARGET=all VERBOSE=1 cp bin/libopenmpt.js bin/stage/all/ -cp bin/libopenmpt.js.mem bin/stage/all/ cp bin/libopenmpt.wasm bin/stage/all/ cp bin/libopenmpt.wasm.js bin/stage/all/ make CONFIG=emscripten EMSCRIPTEN_TARGET=all VERBOSE=1 clean @@ -36,7 +35,6 @@ make CONFIG=emscripten TEST=1 ONLY_TEST=1 EMSCRIPTEN_TARGET=js VERBOSE=1 check make CONFIG=emscripten TEST=0 EMSCRIPTEN_TARGET=js VERBOSE=1 cp bin/libopenmpt.js bin/stage/js/ -cp bin/libopenmpt.js.mem bin/stage/js/ make CONFIG=emscripten EMSCRIPTEN_TARGET=js VERBOSE=1 clean make CONFIG=emscripten VERBOSE=1 dist-js |
From: <sv...@op...> - 2024-03-02 19:43:04
|
Author: manx Date: Sat Mar 2 20:42:53 2024 New Revision: 20177 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20177 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.28/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.28/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.28/libopenmpt/dox/changelog.md Sat Mar 2 20:42:33 2024 (r20176) +++ branches/OpenMPT-1.28/libopenmpt/dox/changelog.md Sat Mar 2 20:42:53 2024 (r20177) @@ -7,6 +7,7 @@ ### libopenmpt 0.4.39-pre + * zlib: Update to v1.3.1 (2024-01-22). * mpg123: Update to v1.32.5 (2024-02-17). ### libopenmpt 0.4.38 (2023-09-09) |
From: <sv...@op...> - 2024-03-02 19:42:45
|
Author: manx Date: Sat Mar 2 20:42:33 2024 New Revision: 20176 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20176 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.29/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Sat Mar 2 20:42:13 2024 (r20175) +++ branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Sat Mar 2 20:42:33 2024 (r20176) @@ -7,6 +7,7 @@ ### libopenmpt 0.5.27-pre + * zlib: Update to v1.3.1 (2024-01-22). * mpg123: Update to v1.32.5 (2024-02-17). * pugixml: Update to v1.14 (2023-10-01). |
From: <sv...@op...> - 2024-03-02 19:42:24
|
Author: manx Date: Sat Mar 2 20:42:13 2024 New Revision: 20175 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20175 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Mar 2 20:41:40 2024 (r20174) +++ branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Mar 2 20:42:13 2024 (r20175) @@ -7,6 +7,7 @@ ### libopenmpt 0.6.13-pre + * zlib: Update to v1.3.1 (2024-01-22). * mpg123: Update to v1.32.5 (2024-02-17). * pugixml: Update to v1.14 (2023-10-01). |
From: <sv...@op...> - 2024-03-02 19:41:46
|
Author: manx Date: Sat Mar 2 20:41:40 2024 New Revision: 20174 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20174 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md ============================================================================== --- branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Mar 2 20:41:02 2024 (r20173) +++ branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Mar 2 20:41:40 2024 (r20174) @@ -13,6 +13,7 @@ * openmpt123: openmpt123 now uses a narrower layout on terminal windows with a width of less than 72 characters. + * zlib: Update to v1.3.1 (2024-01-22). * mpg123: Update to v1.32.5 (2024-02-17). * pugixml: Update to v1.14 (2023-10-01). |
From: <sv...@op...> - 2024-03-02 19:41:10
|
Author: manx Date: Sat Mar 2 20:41:02 2024 New Revision: 20173 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20173 Log: Merged revision(s) 20165 from trunk/OpenMPT: [Var] zlib: Update to 1.3.1 (2024-01-22). ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/include/zlib/ChangeLog branches/OpenMPT-1.28/include/zlib/FAQ branches/OpenMPT-1.28/include/zlib/OpenMPT.txt branches/OpenMPT-1.28/include/zlib/README branches/OpenMPT-1.28/include/zlib/contrib/ (props changed) branches/OpenMPT-1.28/include/zlib/contrib/minizip/ioapi.h branches/OpenMPT-1.28/include/zlib/contrib/minizip/miniunz.c branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.c branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.h branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.c branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.h branches/OpenMPT-1.28/include/zlib/deflate.c branches/OpenMPT-1.28/include/zlib/deflate.h branches/OpenMPT-1.28/include/zlib/gzguts.h branches/OpenMPT-1.28/include/zlib/gzlib.c branches/OpenMPT-1.28/include/zlib/inflate.c branches/OpenMPT-1.28/include/zlib/inftrees.c branches/OpenMPT-1.28/include/zlib/inftrees.h branches/OpenMPT-1.28/include/zlib/trees.c branches/OpenMPT-1.28/include/zlib/zconf.h branches/OpenMPT-1.28/include/zlib/zlib.h branches/OpenMPT-1.28/include/zlib/zutil.h Modified: branches/OpenMPT-1.28/include/zlib/ChangeLog ============================================================================== --- branches/OpenMPT-1.28/include/zlib/ChangeLog Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/ChangeLog Sat Mar 2 20:41:02 2024 (r20173) @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 Modified: branches/OpenMPT-1.28/include/zlib/FAQ ============================================================================== --- branches/OpenMPT-1.28/include/zlib/FAQ Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/FAQ Sat Mar 2 20:41:02 2024 (r20173) @@ -14,8 +14,7 @@ 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? Modified: branches/OpenMPT-1.28/include/zlib/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.28/include/zlib/OpenMPT.txt Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/OpenMPT.txt Sat Mar 2 20:41:02 2024 (r20173) @@ -1,4 +1,4 @@ -zlib 1.3. +zlib 1.3.1. Files not required by OpenMPT have been removed. OpenMPT specific changes: * iowin32.c has been modified to only use Windows 8 WinRT API when actually Modified: branches/OpenMPT-1.28/include/zlib/README ============================================================================== --- branches/OpenMPT-1.28/include/zlib/README Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/README Sat Mar 2 20:41:02 2024 (r20173) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: branches/OpenMPT-1.28/include/zlib/contrib/minizip/ioapi.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:41:02 2024 (r20173) @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; Modified: branches/OpenMPT-1.28/include/zlib/contrib/minizip/miniunz.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:41:02 2024 (r20173) @@ -79,7 +79,7 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 @@ -186,7 +186,7 @@ } static void do_banner(void) { - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } @@ -356,6 +356,20 @@ else write_filename = filename_withoutpath; + if (write_filename[0]!='\0') + { + const char* relative_check = write_filename; + while (relative_check[1]!='\0') + { + if (relative_check[0]=='.' && relative_check[1]=='.') + write_filename = relative_check; + relative_check++; + } + } + + while (write_filename[0]=='/' || write_filename[0]=='.') + write_filename++; + err = unzOpenCurrentFilePassword(uf,password); if (err!=UNZ_OK) { Modified: branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:41:02 2024 (r20173) @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir Modified: branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:41:02 2024 (r20173) @@ -306,7 +306,7 @@ Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). Modified: branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:41:02 2024 (r20173) @@ -575,7 +575,7 @@ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,7 +1872,7 @@ free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); Modified: branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:41:02 2024 (r20173) @@ -177,9 +177,9 @@ filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) Modified: branches/OpenMPT-1.28/include/zlib/deflate.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/deflate.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/deflate.c Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { Modified: branches/OpenMPT-1.28/include/zlib/deflate.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/deflate.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/deflate.h Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ Modified: branches/OpenMPT-1.28/include/zlib/gzguts.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/gzguts.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/gzguts.h Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) Modified: branches/OpenMPT-1.28/include/zlib/gzlib.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/gzlib.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/gzlib.c Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} Modified: branches/OpenMPT-1.28/include/zlib/inflate.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/inflate.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/inflate.c Sat Mar 2 20:41:02 2024 (r20173) @@ -1387,7 +1387,7 @@ /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { Modified: branches/OpenMPT-1.28/include/zlib/inftrees.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/inftrees.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/inftrees.c Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, Modified: branches/OpenMPT-1.28/include/zlib/inftrees.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/inftrees.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/inftrees.h Sat Mar 2 20:41:02 2024 (r20173) @@ -41,8 +41,8 @@ examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ Modified: branches/OpenMPT-1.28/include/zlib/trees.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/trees.c Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/trees.c Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; Modified: branches/OpenMPT-1.28/include/zlib/zconf.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/zconf.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/zconf.h Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have Modified: branches/OpenMPT-1.28/include/zlib/zlib.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/zlib.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/zlib.h Sat Mar 2 20:41:02 2024 (r20173) @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); Modified: branches/OpenMPT-1.28/include/zlib/zutil.h ============================================================================== --- branches/OpenMPT-1.28/include/zlib/zutil.h Sat Mar 2 20:40:26 2024 (r20172) +++ branches/OpenMPT-1.28/include/zlib/zutil.h Sat Mar 2 20:41:02 2024 (r20173) @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 |
From: <sv...@op...> - 2024-03-02 19:40:33
|
Author: manx Date: Sat Mar 2 20:40:26 2024 New Revision: 20172 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20172 Log: Merged revision(s) 20164 from trunk/OpenMPT: [Fix] zlib: Fix minor mis-merge of zlib 1.3. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/include/zlib/contrib/minizip/iowin32.c Modified: branches/OpenMPT-1.28/include/zlib/contrib/minizip/iowin32.c ============================================================================== --- branches/OpenMPT-1.28/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:40:04 2024 (r20171) +++ branches/OpenMPT-1.28/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:40:26 2024 (r20172) @@ -28,12 +28,12 @@ #if (_WIN32_WINNT >= 0x0602) // OpenMPT // see Include/shared/winapifamily.h in the Windows Kit +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if !defined(WINAPI_FAMILY_ONE_PARTITION) #define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) #endif -#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if 1 // OpenMPT #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) // OpenMPT #define IOWIN32_USING_WINRT_API 1 // OpenMPT |
From: <sv...@op...> - 2024-03-02 19:40:18
|
Author: manx Date: Sat Mar 2 20:40:04 2024 New Revision: 20171 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20171 Log: Merged revision(s) 20165 from trunk/OpenMPT: [Var] zlib: Update to 1.3.1 (2024-01-22). ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/include/zlib/ChangeLog branches/OpenMPT-1.29/include/zlib/FAQ branches/OpenMPT-1.29/include/zlib/OpenMPT.txt branches/OpenMPT-1.29/include/zlib/README branches/OpenMPT-1.29/include/zlib/contrib/ (props changed) branches/OpenMPT-1.29/include/zlib/contrib/minizip/ioapi.h branches/OpenMPT-1.29/include/zlib/contrib/minizip/miniunz.c branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.c branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.h branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.c branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.h branches/OpenMPT-1.29/include/zlib/deflate.c branches/OpenMPT-1.29/include/zlib/deflate.h branches/OpenMPT-1.29/include/zlib/gzguts.h branches/OpenMPT-1.29/include/zlib/gzlib.c branches/OpenMPT-1.29/include/zlib/inflate.c branches/OpenMPT-1.29/include/zlib/inftrees.c branches/OpenMPT-1.29/include/zlib/inftrees.h branches/OpenMPT-1.29/include/zlib/trees.c branches/OpenMPT-1.29/include/zlib/zconf.h branches/OpenMPT-1.29/include/zlib/zlib.h branches/OpenMPT-1.29/include/zlib/zutil.h Modified: branches/OpenMPT-1.29/include/zlib/ChangeLog ============================================================================== --- branches/OpenMPT-1.29/include/zlib/ChangeLog Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/ChangeLog Sat Mar 2 20:40:04 2024 (r20171) @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 Modified: branches/OpenMPT-1.29/include/zlib/FAQ ============================================================================== --- branches/OpenMPT-1.29/include/zlib/FAQ Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/FAQ Sat Mar 2 20:40:04 2024 (r20171) @@ -14,8 +14,7 @@ 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? Modified: branches/OpenMPT-1.29/include/zlib/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.29/include/zlib/OpenMPT.txt Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/OpenMPT.txt Sat Mar 2 20:40:04 2024 (r20171) @@ -1,4 +1,4 @@ -zlib 1.3. +zlib 1.3.1. Files not required by OpenMPT have been removed. OpenMPT specific changes: * iowin32.c has been modified to only use Windows 8 WinRT API when actually Modified: branches/OpenMPT-1.29/include/zlib/README ============================================================================== --- branches/OpenMPT-1.29/include/zlib/README Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/README Sat Mar 2 20:40:04 2024 (r20171) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: branches/OpenMPT-1.29/include/zlib/contrib/minizip/ioapi.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:40:04 2024 (r20171) @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; Modified: branches/OpenMPT-1.29/include/zlib/contrib/minizip/miniunz.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:40:04 2024 (r20171) @@ -79,7 +79,7 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 @@ -186,7 +186,7 @@ } static void do_banner(void) { - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } @@ -356,6 +356,20 @@ else write_filename = filename_withoutpath; + if (write_filename[0]!='\0') + { + const char* relative_check = write_filename; + while (relative_check[1]!='\0') + { + if (relative_check[0]=='.' && relative_check[1]=='.') + write_filename = relative_check; + relative_check++; + } + } + + while (write_filename[0]=='/' || write_filename[0]=='.') + write_filename++; + err = unzOpenCurrentFilePassword(uf,password); if (err!=UNZ_OK) { Modified: branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:40:04 2024 (r20171) @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir Modified: branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:40:04 2024 (r20171) @@ -306,7 +306,7 @@ Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). Modified: branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:40:04 2024 (r20171) @@ -575,7 +575,7 @@ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,7 +1872,7 @@ free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); Modified: branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:40:04 2024 (r20171) @@ -177,9 +177,9 @@ filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) Modified: branches/OpenMPT-1.29/include/zlib/deflate.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/deflate.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/deflate.c Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { Modified: branches/OpenMPT-1.29/include/zlib/deflate.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/deflate.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/deflate.h Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ Modified: branches/OpenMPT-1.29/include/zlib/gzguts.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/gzguts.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/gzguts.h Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) Modified: branches/OpenMPT-1.29/include/zlib/gzlib.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/gzlib.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/gzlib.c Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} Modified: branches/OpenMPT-1.29/include/zlib/inflate.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/inflate.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/inflate.c Sat Mar 2 20:40:04 2024 (r20171) @@ -1387,7 +1387,7 @@ /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { Modified: branches/OpenMPT-1.29/include/zlib/inftrees.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/inftrees.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/inftrees.c Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, Modified: branches/OpenMPT-1.29/include/zlib/inftrees.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/inftrees.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/inftrees.h Sat Mar 2 20:40:04 2024 (r20171) @@ -41,8 +41,8 @@ examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ Modified: branches/OpenMPT-1.29/include/zlib/trees.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/trees.c Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/trees.c Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; Modified: branches/OpenMPT-1.29/include/zlib/zconf.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/zconf.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/zconf.h Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have Modified: branches/OpenMPT-1.29/include/zlib/zlib.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/zlib.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/zlib.h Sat Mar 2 20:40:04 2024 (r20171) @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); Modified: branches/OpenMPT-1.29/include/zlib/zutil.h ============================================================================== --- branches/OpenMPT-1.29/include/zlib/zutil.h Sat Mar 2 20:39:41 2024 (r20170) +++ branches/OpenMPT-1.29/include/zlib/zutil.h Sat Mar 2 20:40:04 2024 (r20171) @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 |
From: <sv...@op...> - 2024-03-02 19:39:54
|
Author: manx Date: Sat Mar 2 20:39:41 2024 New Revision: 20170 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20170 Log: Merged revision(s) 20164 from trunk/OpenMPT: [Fix] zlib: Fix minor mis-merge of zlib 1.3. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/include/zlib/contrib/minizip/iowin32.c Modified: branches/OpenMPT-1.29/include/zlib/contrib/minizip/iowin32.c ============================================================================== --- branches/OpenMPT-1.29/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:39:18 2024 (r20169) +++ branches/OpenMPT-1.29/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:39:41 2024 (r20170) @@ -28,12 +28,12 @@ #if (_WIN32_WINNT >= 0x0602) // OpenMPT // see Include/shared/winapifamily.h in the Windows Kit +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if !defined(WINAPI_FAMILY_ONE_PARTITION) #define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) #endif -#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if 1 // OpenMPT #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) // OpenMPT #define IOWIN32_USING_WINRT_API 1 // OpenMPT |
From: <sv...@op...> - 2024-03-02 19:39:27
|
Author: manx Date: Sat Mar 2 20:39:18 2024 New Revision: 20169 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20169 Log: Merged revision(s) 20165 from trunk/OpenMPT: [Var] zlib: Update to 1.3.1 (2024-01-22). ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/include/zlib/ChangeLog branches/OpenMPT-1.30/include/zlib/FAQ branches/OpenMPT-1.30/include/zlib/OpenMPT.txt branches/OpenMPT-1.30/include/zlib/README branches/OpenMPT-1.30/include/zlib/contrib/ (props changed) branches/OpenMPT-1.30/include/zlib/contrib/minizip/ioapi.h branches/OpenMPT-1.30/include/zlib/contrib/minizip/miniunz.c branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.c branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.h branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.c branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.h branches/OpenMPT-1.30/include/zlib/deflate.c branches/OpenMPT-1.30/include/zlib/deflate.h branches/OpenMPT-1.30/include/zlib/gzguts.h branches/OpenMPT-1.30/include/zlib/gzlib.c branches/OpenMPT-1.30/include/zlib/inflate.c branches/OpenMPT-1.30/include/zlib/inftrees.c branches/OpenMPT-1.30/include/zlib/inftrees.h branches/OpenMPT-1.30/include/zlib/trees.c branches/OpenMPT-1.30/include/zlib/zconf.h branches/OpenMPT-1.30/include/zlib/zlib.h branches/OpenMPT-1.30/include/zlib/zutil.h Modified: branches/OpenMPT-1.30/include/zlib/ChangeLog ============================================================================== --- branches/OpenMPT-1.30/include/zlib/ChangeLog Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/ChangeLog Sat Mar 2 20:39:18 2024 (r20169) @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 Modified: branches/OpenMPT-1.30/include/zlib/FAQ ============================================================================== --- branches/OpenMPT-1.30/include/zlib/FAQ Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/FAQ Sat Mar 2 20:39:18 2024 (r20169) @@ -14,8 +14,7 @@ 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? Modified: branches/OpenMPT-1.30/include/zlib/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.30/include/zlib/OpenMPT.txt Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/OpenMPT.txt Sat Mar 2 20:39:18 2024 (r20169) @@ -1,4 +1,4 @@ -zlib 1.3. +zlib 1.3.1. Files not required by OpenMPT have been removed. OpenMPT specific changes: * iowin32.c has been modified to only use Windows 8 WinRT API when actually Modified: branches/OpenMPT-1.30/include/zlib/README ============================================================================== --- branches/OpenMPT-1.30/include/zlib/README Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/README Sat Mar 2 20:39:18 2024 (r20169) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: branches/OpenMPT-1.30/include/zlib/contrib/minizip/ioapi.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:39:18 2024 (r20169) @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; Modified: branches/OpenMPT-1.30/include/zlib/contrib/minizip/miniunz.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:39:18 2024 (r20169) @@ -79,7 +79,7 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 @@ -186,7 +186,7 @@ } static void do_banner(void) { - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } @@ -356,6 +356,20 @@ else write_filename = filename_withoutpath; + if (write_filename[0]!='\0') + { + const char* relative_check = write_filename; + while (relative_check[1]!='\0') + { + if (relative_check[0]=='.' && relative_check[1]=='.') + write_filename = relative_check; + relative_check++; + } + } + + while (write_filename[0]=='/' || write_filename[0]=='.') + write_filename++; + err = unzOpenCurrentFilePassword(uf,password); if (err!=UNZ_OK) { Modified: branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:39:18 2024 (r20169) @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir Modified: branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:39:18 2024 (r20169) @@ -306,7 +306,7 @@ Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). Modified: branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:39:18 2024 (r20169) @@ -575,7 +575,7 @@ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,7 +1872,7 @@ free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); Modified: branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:39:18 2024 (r20169) @@ -177,9 +177,9 @@ filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) Modified: branches/OpenMPT-1.30/include/zlib/deflate.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/deflate.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/deflate.c Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { Modified: branches/OpenMPT-1.30/include/zlib/deflate.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/deflate.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/deflate.h Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ Modified: branches/OpenMPT-1.30/include/zlib/gzguts.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/gzguts.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/gzguts.h Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) Modified: branches/OpenMPT-1.30/include/zlib/gzlib.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/gzlib.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/gzlib.c Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} Modified: branches/OpenMPT-1.30/include/zlib/inflate.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/inflate.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/inflate.c Sat Mar 2 20:39:18 2024 (r20169) @@ -1387,7 +1387,7 @@ /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { Modified: branches/OpenMPT-1.30/include/zlib/inftrees.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/inftrees.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/inftrees.c Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, Modified: branches/OpenMPT-1.30/include/zlib/inftrees.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/inftrees.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/inftrees.h Sat Mar 2 20:39:18 2024 (r20169) @@ -41,8 +41,8 @@ examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ Modified: branches/OpenMPT-1.30/include/zlib/trees.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/trees.c Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/trees.c Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; Modified: branches/OpenMPT-1.30/include/zlib/zconf.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/zconf.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/zconf.h Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have Modified: branches/OpenMPT-1.30/include/zlib/zlib.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/zlib.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/zlib.h Sat Mar 2 20:39:18 2024 (r20169) @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); Modified: branches/OpenMPT-1.30/include/zlib/zutil.h ============================================================================== --- branches/OpenMPT-1.30/include/zlib/zutil.h Sat Mar 2 20:38:55 2024 (r20168) +++ branches/OpenMPT-1.30/include/zlib/zutil.h Sat Mar 2 20:39:18 2024 (r20169) @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 |
From: <sv...@op...> - 2024-03-02 19:39:07
|
Author: manx Date: Sat Mar 2 20:38:55 2024 New Revision: 20168 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20168 Log: Merged revision(s) 20164 from trunk/OpenMPT: [Fix] zlib: Fix minor mis-merge of zlib 1.3. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/include/zlib/contrib/minizip/iowin32.c Modified: branches/OpenMPT-1.30/include/zlib/contrib/minizip/iowin32.c ============================================================================== --- branches/OpenMPT-1.30/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:38:33 2024 (r20167) +++ branches/OpenMPT-1.30/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:38:55 2024 (r20168) @@ -28,12 +28,12 @@ #if (_WIN32_WINNT >= 0x0602) // OpenMPT // see Include/shared/winapifamily.h in the Windows Kit +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if !defined(WINAPI_FAMILY_ONE_PARTITION) #define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) #endif -#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if 1 // OpenMPT #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) // OpenMPT #define IOWIN32_USING_WINRT_API 1 // OpenMPT |
From: <sv...@op...> - 2024-03-02 19:38:41
|
Author: manx Date: Sat Mar 2 20:38:33 2024 New Revision: 20167 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20167 Log: Merged revision(s) 20165 from trunk/OpenMPT: [Var] zlib: Update to 1.3.1 (2024-01-22). ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/include/zlib/ChangeLog branches/OpenMPT-1.31/include/zlib/FAQ branches/OpenMPT-1.31/include/zlib/OpenMPT.txt branches/OpenMPT-1.31/include/zlib/README branches/OpenMPT-1.31/include/zlib/contrib/ (props changed) branches/OpenMPT-1.31/include/zlib/contrib/minizip/ioapi.h branches/OpenMPT-1.31/include/zlib/contrib/minizip/miniunz.c branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.c branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.h branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.c branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.h branches/OpenMPT-1.31/include/zlib/deflate.c branches/OpenMPT-1.31/include/zlib/deflate.h branches/OpenMPT-1.31/include/zlib/gzguts.h branches/OpenMPT-1.31/include/zlib/gzlib.c branches/OpenMPT-1.31/include/zlib/inflate.c branches/OpenMPT-1.31/include/zlib/inftrees.c branches/OpenMPT-1.31/include/zlib/inftrees.h branches/OpenMPT-1.31/include/zlib/trees.c branches/OpenMPT-1.31/include/zlib/zconf.h branches/OpenMPT-1.31/include/zlib/zlib.h branches/OpenMPT-1.31/include/zlib/zutil.h Modified: branches/OpenMPT-1.31/include/zlib/ChangeLog ============================================================================== --- branches/OpenMPT-1.31/include/zlib/ChangeLog Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/ChangeLog Sat Mar 2 20:38:33 2024 (r20167) @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 Modified: branches/OpenMPT-1.31/include/zlib/FAQ ============================================================================== --- branches/OpenMPT-1.31/include/zlib/FAQ Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/FAQ Sat Mar 2 20:38:33 2024 (r20167) @@ -14,8 +14,7 @@ 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? Modified: branches/OpenMPT-1.31/include/zlib/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.31/include/zlib/OpenMPT.txt Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/OpenMPT.txt Sat Mar 2 20:38:33 2024 (r20167) @@ -1,4 +1,4 @@ -zlib 1.3. +zlib 1.3.1. Files not required by OpenMPT have been removed. OpenMPT specific changes: * iowin32.c has been modified to only use Windows 8 WinRT API when actually Modified: branches/OpenMPT-1.31/include/zlib/README ============================================================================== --- branches/OpenMPT-1.31/include/zlib/README Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/README Sat Mar 2 20:38:33 2024 (r20167) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: branches/OpenMPT-1.31/include/zlib/contrib/minizip/ioapi.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:38:33 2024 (r20167) @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; Modified: branches/OpenMPT-1.31/include/zlib/contrib/minizip/miniunz.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:38:33 2024 (r20167) @@ -79,7 +79,7 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 @@ -186,7 +186,7 @@ } static void do_banner(void) { - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } @@ -356,6 +356,20 @@ else write_filename = filename_withoutpath; + if (write_filename[0]!='\0') + { + const char* relative_check = write_filename; + while (relative_check[1]!='\0') + { + if (relative_check[0]=='.' && relative_check[1]=='.') + write_filename = relative_check; + relative_check++; + } + } + + while (write_filename[0]=='/' || write_filename[0]=='.') + write_filename++; + err = unzOpenCurrentFilePassword(uf,password); if (err!=UNZ_OK) { Modified: branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:38:33 2024 (r20167) @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir Modified: branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:38:33 2024 (r20167) @@ -306,7 +306,7 @@ Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). Modified: branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:38:33 2024 (r20167) @@ -575,7 +575,7 @@ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,7 +1872,7 @@ free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); Modified: branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:38:33 2024 (r20167) @@ -177,9 +177,9 @@ filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) Modified: branches/OpenMPT-1.31/include/zlib/deflate.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/deflate.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/deflate.c Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { Modified: branches/OpenMPT-1.31/include/zlib/deflate.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/deflate.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/deflate.h Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ Modified: branches/OpenMPT-1.31/include/zlib/gzguts.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/gzguts.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/gzguts.h Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) Modified: branches/OpenMPT-1.31/include/zlib/gzlib.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/gzlib.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/gzlib.c Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} Modified: branches/OpenMPT-1.31/include/zlib/inflate.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/inflate.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/inflate.c Sat Mar 2 20:38:33 2024 (r20167) @@ -1387,7 +1387,7 @@ /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { Modified: branches/OpenMPT-1.31/include/zlib/inftrees.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/inftrees.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/inftrees.c Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, Modified: branches/OpenMPT-1.31/include/zlib/inftrees.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/inftrees.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/inftrees.h Sat Mar 2 20:38:33 2024 (r20167) @@ -41,8 +41,8 @@ examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ Modified: branches/OpenMPT-1.31/include/zlib/trees.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/trees.c Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/trees.c Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; Modified: branches/OpenMPT-1.31/include/zlib/zconf.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/zconf.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/zconf.h Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have Modified: branches/OpenMPT-1.31/include/zlib/zlib.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/zlib.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/zlib.h Sat Mar 2 20:38:33 2024 (r20167) @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); Modified: branches/OpenMPT-1.31/include/zlib/zutil.h ============================================================================== --- branches/OpenMPT-1.31/include/zlib/zutil.h Sat Mar 2 20:38:03 2024 (r20166) +++ branches/OpenMPT-1.31/include/zlib/zutil.h Sat Mar 2 20:38:33 2024 (r20167) @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 |
From: <sv...@op...> - 2024-03-02 19:38:15
|
Author: manx Date: Sat Mar 2 20:38:03 2024 New Revision: 20166 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20166 Log: Merged revision(s) 20164 from trunk/OpenMPT: [Fix] zlib: Fix minor mis-merge of zlib 1.3. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/include/zlib/contrib/minizip/iowin32.c Modified: branches/OpenMPT-1.31/include/zlib/contrib/minizip/iowin32.c ============================================================================== --- branches/OpenMPT-1.31/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:37:37 2024 (r20165) +++ branches/OpenMPT-1.31/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:38:03 2024 (r20166) @@ -28,12 +28,12 @@ #if (_WIN32_WINNT >= 0x0602) // OpenMPT // see Include/shared/winapifamily.h in the Windows Kit +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if !defined(WINAPI_FAMILY_ONE_PARTITION) #define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) #endif -#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if 1 // OpenMPT #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) // OpenMPT #define IOWIN32_USING_WINRT_API 1 // OpenMPT |
From: <sv...@op...> - 2024-03-02 19:37:51
|
Author: manx Date: Sat Mar 2 20:37:37 2024 New Revision: 20165 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20165 Log: [Var] zlib: Update to 1.3.1 (2024-01-22). Modified: trunk/OpenMPT/include/zlib/ChangeLog trunk/OpenMPT/include/zlib/FAQ trunk/OpenMPT/include/zlib/OpenMPT.txt trunk/OpenMPT/include/zlib/README trunk/OpenMPT/include/zlib/contrib/ (props changed) trunk/OpenMPT/include/zlib/contrib/minizip/ioapi.h trunk/OpenMPT/include/zlib/contrib/minizip/miniunz.c trunk/OpenMPT/include/zlib/contrib/minizip/unzip.c trunk/OpenMPT/include/zlib/contrib/minizip/unzip.h trunk/OpenMPT/include/zlib/contrib/minizip/zip.c trunk/OpenMPT/include/zlib/contrib/minizip/zip.h trunk/OpenMPT/include/zlib/deflate.c trunk/OpenMPT/include/zlib/deflate.h trunk/OpenMPT/include/zlib/gzguts.h trunk/OpenMPT/include/zlib/gzlib.c trunk/OpenMPT/include/zlib/inflate.c trunk/OpenMPT/include/zlib/inftrees.c trunk/OpenMPT/include/zlib/inftrees.h trunk/OpenMPT/include/zlib/trees.c trunk/OpenMPT/include/zlib/zconf.h trunk/OpenMPT/include/zlib/zlib.h trunk/OpenMPT/include/zlib/zutil.h Modified: trunk/OpenMPT/include/zlib/ChangeLog ============================================================================== --- trunk/OpenMPT/include/zlib/ChangeLog Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/ChangeLog Sat Mar 2 20:37:37 2024 (r20165) @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 Modified: trunk/OpenMPT/include/zlib/FAQ ============================================================================== --- trunk/OpenMPT/include/zlib/FAQ Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/FAQ Sat Mar 2 20:37:37 2024 (r20165) @@ -14,8 +14,7 @@ 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? Modified: trunk/OpenMPT/include/zlib/OpenMPT.txt ============================================================================== --- trunk/OpenMPT/include/zlib/OpenMPT.txt Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/OpenMPT.txt Sat Mar 2 20:37:37 2024 (r20165) @@ -1,4 +1,4 @@ -zlib 1.3. +zlib 1.3.1. Files not required by OpenMPT have been removed. OpenMPT specific changes: * iowin32.c has been modified to only use Windows 8 WinRT API when actually Modified: trunk/OpenMPT/include/zlib/README ============================================================================== --- trunk/OpenMPT/include/zlib/README Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/README Sat Mar 2 20:37:37 2024 (r20165) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: trunk/OpenMPT/include/zlib/contrib/minizip/ioapi.h ============================================================================== --- trunk/OpenMPT/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/contrib/minizip/ioapi.h Sat Mar 2 20:37:37 2024 (r20165) @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; Modified: trunk/OpenMPT/include/zlib/contrib/minizip/miniunz.c ============================================================================== --- trunk/OpenMPT/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/contrib/minizip/miniunz.c Sat Mar 2 20:37:37 2024 (r20165) @@ -79,7 +79,7 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 @@ -186,7 +186,7 @@ } static void do_banner(void) { - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } @@ -356,6 +356,20 @@ else write_filename = filename_withoutpath; + if (write_filename[0]!='\0') + { + const char* relative_check = write_filename; + while (relative_check[1]!='\0') + { + if (relative_check[0]=='.' && relative_check[1]=='.') + write_filename = relative_check; + relative_check++; + } + } + + while (write_filename[0]=='/' || write_filename[0]=='.') + write_filename++; + err = unzOpenCurrentFilePassword(uf,password); if (err!=UNZ_OK) { Modified: trunk/OpenMPT/include/zlib/contrib/minizip/unzip.c ============================================================================== --- trunk/OpenMPT/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/contrib/minizip/unzip.c Sat Mar 2 20:37:37 2024 (r20165) @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir Modified: trunk/OpenMPT/include/zlib/contrib/minizip/unzip.h ============================================================================== --- trunk/OpenMPT/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/contrib/minizip/unzip.h Sat Mar 2 20:37:37 2024 (r20165) @@ -306,7 +306,7 @@ Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). Modified: trunk/OpenMPT/include/zlib/contrib/minizip/zip.c ============================================================================== --- trunk/OpenMPT/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/contrib/minizip/zip.c Sat Mar 2 20:37:37 2024 (r20165) @@ -575,7 +575,7 @@ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,7 +1872,7 @@ free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); Modified: trunk/OpenMPT/include/zlib/contrib/minizip/zip.h ============================================================================== --- trunk/OpenMPT/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/contrib/minizip/zip.h Sat Mar 2 20:37:37 2024 (r20165) @@ -177,9 +177,9 @@ filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) Modified: trunk/OpenMPT/include/zlib/deflate.c ============================================================================== --- trunk/OpenMPT/include/zlib/deflate.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/deflate.c Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { Modified: trunk/OpenMPT/include/zlib/deflate.h ============================================================================== --- trunk/OpenMPT/include/zlib/deflate.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/deflate.h Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ Modified: trunk/OpenMPT/include/zlib/gzguts.h ============================================================================== --- trunk/OpenMPT/include/zlib/gzguts.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/gzguts.h Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) Modified: trunk/OpenMPT/include/zlib/gzlib.c ============================================================================== --- trunk/OpenMPT/include/zlib/gzlib.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/gzlib.c Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} Modified: trunk/OpenMPT/include/zlib/inflate.c ============================================================================== --- trunk/OpenMPT/include/zlib/inflate.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/inflate.c Sat Mar 2 20:37:37 2024 (r20165) @@ -1387,7 +1387,7 @@ /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { Modified: trunk/OpenMPT/include/zlib/inftrees.c ============================================================================== --- trunk/OpenMPT/include/zlib/inftrees.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/inftrees.c Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, Modified: trunk/OpenMPT/include/zlib/inftrees.h ============================================================================== --- trunk/OpenMPT/include/zlib/inftrees.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/inftrees.h Sat Mar 2 20:37:37 2024 (r20165) @@ -41,8 +41,8 @@ examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ Modified: trunk/OpenMPT/include/zlib/trees.c ============================================================================== --- trunk/OpenMPT/include/zlib/trees.c Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/trees.c Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; Modified: trunk/OpenMPT/include/zlib/zconf.h ============================================================================== --- trunk/OpenMPT/include/zlib/zconf.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/zconf.h Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have Modified: trunk/OpenMPT/include/zlib/zlib.h ============================================================================== --- trunk/OpenMPT/include/zlib/zlib.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/zlib.h Sat Mar 2 20:37:37 2024 (r20165) @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); Modified: trunk/OpenMPT/include/zlib/zutil.h ============================================================================== --- trunk/OpenMPT/include/zlib/zutil.h Sat Mar 2 20:31:56 2024 (r20164) +++ trunk/OpenMPT/include/zlib/zutil.h Sat Mar 2 20:37:37 2024 (r20165) @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 |
From: <sv...@op...> - 2024-03-02 19:32:03
|
Author: manx Date: Sat Mar 2 20:31:56 2024 New Revision: 20164 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20164 Log: [Fix] zlib: Fix minor mis-merge of zlib 1.3. Modified: trunk/OpenMPT/include/zlib/contrib/minizip/iowin32.c Modified: trunk/OpenMPT/include/zlib/contrib/minizip/iowin32.c ============================================================================== --- trunk/OpenMPT/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 19:53:53 2024 (r20163) +++ trunk/OpenMPT/include/zlib/contrib/minizip/iowin32.c Sat Mar 2 20:31:56 2024 (r20164) @@ -28,12 +28,12 @@ #if (_WIN32_WINNT >= 0x0602) // OpenMPT // see Include/shared/winapifamily.h in the Windows Kit +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if !defined(WINAPI_FAMILY_ONE_PARTITION) #define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) #endif -#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if 1 // OpenMPT #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) // OpenMPT #define IOWIN32_USING_WINRT_API 1 // OpenMPT |
From: <sv...@op...> - 2024-03-02 18:54:02
|
Author: manx Date: Sat Mar 2 19:53:53 2024 New Revision: 20163 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20163 Log: Merged revision(s) 20159 from trunk/OpenMPT: [Doc] Update IRC channel from EsperNet to Libera.Chat due to <https://gist.github.com/mrflea/5bc585d2b49182be0f9006d20f364471>. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/doc/contributing.md Modified: branches/OpenMPT-1.28/doc/contributing.md ============================================================================== --- branches/OpenMPT-1.28/doc/contributing.md Sat Mar 2 19:53:27 2024 (r20162) +++ branches/OpenMPT-1.28/doc/contributing.md Sat Mar 2 19:53:53 2024 (r20163) @@ -15,7 +15,7 @@ reports or bug fixes and feature development discussion * [Forum](https://forum.openmpt.org/), preferred for long-term discussion of new features or specific questions about development - * [IRC channel (`EsperNET/#modplug`)](irc://irc.esper.net:5555/#modplug), + * [IRC channel (`Libera.Chat/#openmpt`)](ircs://irc.libera.chat:6697/#openmpt), preferred for shorter questions * [GitHub pull requests](https://github.com/OpenMPT/openmpt/pulls), please only use for rather tiny fixes, see below |
From: <sv...@op...> - 2024-03-02 18:53:38
|
Author: manx Date: Sat Mar 2 19:53:27 2024 New Revision: 20162 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20162 Log: Merged revision(s) 20159 from trunk/OpenMPT: [Doc] Update IRC channel from EsperNet to Libera.Chat due to <https://gist.github.com/mrflea/5bc585d2b49182be0f9006d20f364471>. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/doc/contributing.md Modified: branches/OpenMPT-1.29/doc/contributing.md ============================================================================== --- branches/OpenMPT-1.29/doc/contributing.md Sat Mar 2 19:53:01 2024 (r20161) +++ branches/OpenMPT-1.29/doc/contributing.md Sat Mar 2 19:53:27 2024 (r20162) @@ -15,7 +15,7 @@ reports or bug fixes and feature development discussion * [Forum](https://forum.openmpt.org/), preferred for long-term discussion of new features or specific questions about development - * [IRC channel (`EsperNET/#modplug`)](irc://irc.esper.net:5555/#modplug), + * [IRC channel (`Libera.Chat/#openmpt`)](ircs://irc.libera.chat:6697/#openmpt), preferred for shorter questions * [GitHub pull requests](https://github.com/OpenMPT/openmpt/pulls), please only use for rather tiny fixes, see below |
From: <sv...@op...> - 2024-03-02 18:53:13
|
Author: manx Date: Sat Mar 2 19:53:01 2024 New Revision: 20161 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20161 Log: Merged revision(s) 20159 from trunk/OpenMPT: [Doc] Update IRC channel from EsperNet to Libera.Chat due to <https://gist.github.com/mrflea/5bc585d2b49182be0f9006d20f364471>. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/doc/contributing.md Modified: branches/OpenMPT-1.30/doc/contributing.md ============================================================================== --- branches/OpenMPT-1.30/doc/contributing.md Sat Mar 2 19:52:37 2024 (r20160) +++ branches/OpenMPT-1.30/doc/contributing.md Sat Mar 2 19:53:01 2024 (r20161) @@ -15,7 +15,7 @@ reports or bug fixes and feature development discussion * [Forum](https://forum.openmpt.org/), preferred for long-term discussion of new features or specific questions about development - * [IRC channel (`EsperNET/#modplug`)](irc://irc.esper.net:5555/#modplug), + * [IRC channel (`Libera.Chat/#openmpt`)](ircs://irc.libera.chat:6697/#openmpt), preferred for shorter questions * [GitHub pull requests](https://github.com/OpenMPT/openmpt/pulls), please only use for rather tiny fixes, see below |
From: <sv...@op...> - 2024-03-02 18:52:44
|
Author: manx Date: Sat Mar 2 19:52:37 2024 New Revision: 20160 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20160 Log: Merged revision(s) 20159 from trunk/OpenMPT: [Doc] Update IRC channel from EsperNet to Libera.Chat due to <https://gist.github.com/mrflea/5bc585d2b49182be0f9006d20f364471>. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/doc/contributing.md Modified: branches/OpenMPT-1.31/doc/contributing.md ============================================================================== --- branches/OpenMPT-1.31/doc/contributing.md Sat Mar 2 19:52:07 2024 (r20159) +++ branches/OpenMPT-1.31/doc/contributing.md Sat Mar 2 19:52:37 2024 (r20160) @@ -15,7 +15,7 @@ reports or bug fixes and feature development discussion * [Forum](https://forum.openmpt.org/), preferred for long-term discussion of new features or specific questions about development - * [IRC channel (`EsperNET/#modplug`)](irc://irc.esper.net:5555/#modplug), + * [IRC channel (`Libera.Chat/#openmpt`)](ircs://irc.libera.chat:6697/#openmpt), preferred for shorter questions * [GitHub pull requests](https://github.com/OpenMPT/openmpt/pulls), please only use for rather tiny fixes, see below |