1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-22 07:28:03 +02:00

Bug 2697 - AUP3 projects not using the correct character size on "differently" configured wxWidgets

This commit is contained in:
Leland Lucius 2021-03-18 08:03:36 -05:00
parent 14b767b9eb
commit 1bbfd3db5e

View File

@ -206,9 +206,9 @@ ProjectSerializer::ProjectSerializer(size_t allocSize)
std::call_once(flag, []{ std::call_once(flag, []{
// Just once per run, store header information in the unique static // Just once per run, store header information in the unique static
// dictionary that will be written into each project that is saved. // dictionary that will be written into each project that is saved.
// Store the size of "wxChar" so we can convert during recovery in // Store the size of "wxStringCharType" so we can convert during recovery
// case the file is used on a system with a different character size. // in case the file is used on a system with a different character size.
char size = sizeof(wxChar); char size = sizeof(wxStringCharType);
mDict.AppendByte(FT_CharSize); mDict.AppendByte(FT_CharSize);
mDict.AppendData(&size, 1); mDict.AppendData(&size, 1);
}); });
@ -242,7 +242,7 @@ void ProjectSerializer::WriteAttr(const wxString & name, const wxString & value)
mBuffer.AppendByte(FT_String); mBuffer.AppendByte(FT_String);
WriteName(name); WriteName(name);
const Length len = value.length() * sizeof(wxChar); const Length len = value.length() * sizeof(wxStringCharType);
WriteLength( mBuffer, len ); WriteLength( mBuffer, len );
mBuffer.AppendData(value.wx_str(), len); mBuffer.AppendData(value.wx_str(), len);
} }
@ -309,7 +309,7 @@ void ProjectSerializer::WriteData(const wxString & value)
{ {
mBuffer.AppendByte(FT_Data); mBuffer.AppendByte(FT_Data);
Length len = value.length() * sizeof(wxChar); Length len = value.length() * sizeof(wxStringCharType);
WriteLength( mBuffer, len ); WriteLength( mBuffer, len );
mBuffer.AppendData(value.wx_str(), len); mBuffer.AppendData(value.wx_str(), len);
} }
@ -317,7 +317,7 @@ void ProjectSerializer::WriteData(const wxString & value)
void ProjectSerializer::Write(const wxString & value) void ProjectSerializer::Write(const wxString & value)
{ {
mBuffer.AppendByte(FT_Raw); mBuffer.AppendByte(FT_Raw);
Length len = value.length() * sizeof(wxChar); Length len = value.length() * sizeof(wxStringCharType);
WriteLength( mBuffer, len ); WriteLength( mBuffer, len );
mBuffer.AppendData(value.wx_str(), len); mBuffer.AppendData(value.wx_str(), len);
} }
@ -334,7 +334,7 @@ void ProjectSerializer::WriteSubTree(const ProjectSerializer & value)
void ProjectSerializer::WriteName(const wxString & name) void ProjectSerializer::WriteName(const wxString & name)
{ {
wxASSERT(name.length() * sizeof(wxChar) <= SHRT_MAX); wxASSERT(name.length() * sizeof(wxStringCharType) <= SHRT_MAX);
UShort id; UShort id;
auto nameiter = mNames.find(name); auto nameiter = mNames.find(name);
@ -346,7 +346,7 @@ void ProjectSerializer::WriteName(const wxString & name)
{ {
// mNames is static. This appends each name to static mDict only once // mNames is static. This appends each name to static mDict only once
// in each run. // in each run.
UShort len = name.length() * sizeof(wxChar); UShort len = name.length() * sizeof(wxStringCharType);
id = mNames.size(); id = mNames.size();
mNames[name] = id; mNames[name] = id;