backend update from Raze
* moving large allocations off the stack * use proper printf formatters for size_t and ptrdiff_t. * adding some missing 'noexcept'.
This commit is contained in:
parent
df9b2cd9bf
commit
83aa9388ca
29 changed files with 117 additions and 109 deletions
|
|
@ -465,19 +465,16 @@ const FSoundFontInfo *FSoundFontManager::FindSoundFont(const char *name, int all
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed)
|
||||
FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *const name, int allowed)
|
||||
{
|
||||
|
||||
if (name == nullptr) return nullptr;
|
||||
// First check if the given name is inside the loaded resources.
|
||||
// To avoid clashes this will only be done if the name has the '.cfg' extension.
|
||||
// Sound fonts cannot be loaded this way.
|
||||
if (name != nullptr)
|
||||
const char *p = name + strlen(name) - 4;
|
||||
if (p > name && !stricmp(p, ".cfg") && fileSystem.CheckNumForFullName(name) >= 0)
|
||||
{
|
||||
const char *p = name + strlen(name) - 4;
|
||||
if (p > name && !stricmp(p, ".cfg") && fileSystem.CheckNumForFullName(name) >= 0)
|
||||
{
|
||||
return new FLumpPatchSetReader(name);
|
||||
}
|
||||
return new FLumpPatchSetReader(name);
|
||||
}
|
||||
|
||||
// Next check if the file is a .sf file
|
||||
|
|
|
|||
|
|
@ -432,14 +432,14 @@ static FString ReplayGainHash(ZMusicCustomReader* reader, int flength, int playe
|
|||
{
|
||||
std::string playparam = _playparam;
|
||||
|
||||
uint8_t buffer[50000]; // for performance reasons only hash the start of the file. If we wanted to do this to large waveform songs it'd cause noticable lag.
|
||||
TArray<uint8_t> buffer(50000, true); // for performance reasons only hash the start of the file. If we wanted to do this to large waveform songs it'd cause noticable lag.
|
||||
uint8_t digest[16];
|
||||
char digestout[33];
|
||||
auto length = reader->read(reader, buffer, 50000);
|
||||
auto length = reader->read(reader, buffer.data(), 50000);
|
||||
reader->seek(reader, 0, SEEK_SET);
|
||||
MD5Context md5;
|
||||
md5.Init();
|
||||
md5.Update(buffer, (int)length);
|
||||
md5.Update(buffer.data(), (int)length);
|
||||
md5.Final(digest);
|
||||
|
||||
for (size_t j = 0; j < sizeof(digest); ++j)
|
||||
|
|
@ -448,7 +448,7 @@ static FString ReplayGainHash(ZMusicCustomReader* reader, int flength, int playe
|
|||
}
|
||||
digestout[32] = 0;
|
||||
|
||||
auto type = ZMusic_IdentifyMIDIType((uint32_t*)buffer, 32);
|
||||
auto type = ZMusic_IdentifyMIDIType((uint32_t*)buffer.data(), 32);
|
||||
if (type == MIDI_NOTMIDI) return FStringf("%d:%s", flength, digestout);
|
||||
|
||||
// get the default for MIDI synth
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue