1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00
This commit is contained in:
Roger Dannenberg 2021-03-27 13:24:22 -04:00
commit 4dda3505bb
3 changed files with 66 additions and 10 deletions

View File

@ -691,7 +691,9 @@ bool ProjectFileIO::DeleteBlocks(const BlockIDs &blockids, bool complement)
rc = sqlite3_create_function(db, "inset", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, const_cast<void*>(p), InSet, nullptr, nullptr);
if (rc != SQLITE_OK)
{
wxLogDebug(wxT("Unable to add 'inset' function"));
/* i18n-hint: An error message. Don't translate inset or blockids.*/
SetError(XO("Unable to add 'inset' function (can't verify blockids)"));
wxLogWarning(GetLastError().Translation());
return false;
}
@ -702,7 +704,33 @@ bool ProjectFileIO::DeleteBlocks(const BlockIDs &blockids, bool complement)
rc = sqlite3_exec(db, sql, nullptr, nullptr, nullptr);
if (rc != SQLITE_OK)
{
wxLogWarning(XO("Cleanup of orphan blocks failed").Translation());
// we give the string 'error' to get the default url for read project errors.
if( rc==SQLITE_READONLY)
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("Project is read only\n(can't clean orphan blockfiles)"), XO("error"));
else if( rc==SQLITE_LOCKED)
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("Project is locked\n(can't clean orphan blockfiles)"), XO("error"));
else if( rc==SQLITE_BUSY)
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("Project is busy\n(can't clean orphan blockfiles)"), XO("error"));
else if( rc==SQLITE_CORRUPT)
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("Project is corrupt\n(can't clean orphan blockfiles)"), XO("error"));
else if( rc==SQLITE_PERM)
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("Some permissions issue\n(can't clean orphan blockfiles)"), XO("error"));
else if( rc==SQLITE_IOERR)
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("A disk I/O error\n(can't clean orphan blockfiles)"), XO("error"));
else if( rc==SQLITE_AUTH)
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("Not authorized\n(can't clean orphan blockfiles)"), XO("error"));
else
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
SetError(XO("Cleanup of orphan blocks failed"), XO("error"));
wxLogWarning(GetLastError().Translation());
return false;
}
@ -1755,7 +1783,7 @@ bool ProjectFileIO::LoadProject(const FilePath &fileName, bool ignoreAutosave)
XMLFileReader xmlFile;
// Load 'er up
success = xmlFile.ParseString(this, project.ToUTF8());
success = xmlFile.ParseString(this, project);
if (!success)
{
SetError(

View File

@ -194,27 +194,52 @@ bool FileConfig::Flush(bool WXUNUSED(bCurrentOnly))
bool FileConfig::RenameEntry(const wxString& oldName, const wxString& newName)
{
return mConfig->RenameEntry(oldName, newName);
auto res = mConfig->RenameEntry(oldName, newName);
if (res)
{
mDirty = true;
}
return res;
}
bool FileConfig::RenameGroup(const wxString& oldName, const wxString& newName)
{
return mConfig->RenameGroup(oldName, newName);
auto res = mConfig->RenameGroup(oldName, newName);
if (res)
{
mDirty = true;
}
return res;
}
bool FileConfig::DeleteEntry(const wxString& key, bool bDeleteGroupIfEmpty)
{
return mConfig->DeleteEntry(key, bDeleteGroupIfEmpty);
auto res = mConfig->DeleteEntry(key, bDeleteGroupIfEmpty);
if (res)
{
mDirty = true;
}
return res;
}
bool FileConfig::DeleteGroup(const wxString& key)
{
return mConfig->DeleteGroup(key);
auto res = mConfig->DeleteGroup(key);
if (res)
{
mDirty = true;
}
return res;
}
bool FileConfig::DeleteAll()
{
return mConfig->DeleteAll();
auto res = mConfig->DeleteAll();
if (res)
{
mDirty = true;
}
return res;
}
bool FileConfig::DoReadString(const wxString& key, wxString *pStr) const

View File

@ -135,8 +135,9 @@ bool XMLFileReader::Parse(XMLTagHandler *baseHandler,
bool XMLFileReader::ParseString(XMLTagHandler *baseHandler,
const wxString &xmldata)
{
const char *buffer = xmldata.mb_str().data();
int len = xmldata.mbc_str().length();
auto utf8 = xmldata.ToUTF8();
const char *buffer = utf8.data();
int len = utf8.length();
mBaseHandler = baseHandler;
@ -156,6 +157,8 @@ bool XMLFileReader::ParseString(XMLTagHandler *baseHandler,
(long unsigned int)XML_GetCurrentLineNumber(mParser)
);
wxLogMessage(wxT("ParseString error: %s\n===begin===%s\n===end==="), mErrorStr.Debug(), buffer);
return false;
}