mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-19 17:11:12 +02:00
more progress on bug 113
better handling of error conditions in PCMAliasBlockFile::BuildFromXML so that DirManager::ProjectFSCK can report cases of missing PCMAliasBlockFile files on opening projects where missing files were not corrected
This commit is contained in:
@@ -65,6 +65,18 @@ bool XMLValueChecker::IsGoodFileName(const wxString strFileName, const wxString
|
||||
return (fileName.IsOk() && fileName.FileExists());
|
||||
}
|
||||
|
||||
bool XMLValueChecker::IsGoodFileString(wxString str)
|
||||
{
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
|
||||
// FILENAME_MAX is 260 in MSVC, but inconsistent across platforms,
|
||||
// sometimes huge, but we use 260 for all platforms.
|
||||
(str.Length() <= 260) &&
|
||||
|
||||
(str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters.
|
||||
}
|
||||
|
||||
bool XMLValueChecker::IsGoodSubdirName(const wxString strSubdirName, const wxString strDirName /* = "" */)
|
||||
{
|
||||
// Test strSubdirName.
|
||||
@@ -91,14 +103,18 @@ bool XMLValueChecker::IsGoodPathName(const wxString strPathName)
|
||||
return XMLValueChecker::IsGoodFileName(fileName.GetFullName(), fileName.GetPath(wxPATH_GET_VOLUME));
|
||||
}
|
||||
|
||||
bool XMLValueChecker::IsGoodFileString(wxString str)
|
||||
bool XMLValueChecker::IsGoodPathString(wxString str)
|
||||
{
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
(str.Length() <= 260) && // FILENAME_MAX is 260 in MSVC, but inconsistent across platforms, sometimes huge.
|
||||
(str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters.
|
||||
!str.IsEmpty()
|
||||
|
||||
#ifdef _WIN32
|
||||
&& (str.Length() <= MAX_PATH)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool XMLValueChecker::IsGoodInt(const wxString strInt)
|
||||
{
|
||||
if (!IsGoodString(strInt))
|
||||
@@ -189,15 +205,3 @@ XMLTagHandler *XMLTagHandler::ReadXMLChild(const char *tag)
|
||||
{
|
||||
return HandleXMLChild(UTF8CTOWX(tag).c_str());
|
||||
}
|
||||
|
||||
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
|
||||
// version control system. Please do not modify past this point.
|
||||
//
|
||||
// Local Variables:
|
||||
// c-basic-offset: 3
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vim: et sts=3 sw=3
|
||||
// arch-tag: 6aabae58-19bd-4b3a-aa6c-08432a7e106e
|
||||
|
||||
|
@@ -32,8 +32,10 @@ public:
|
||||
static bool IsGoodString(const wxString str);
|
||||
|
||||
static bool IsGoodFileName(const wxString strFileName, const wxString strDirName = wxEmptyString);
|
||||
static bool IsGoodFileString(wxString str);
|
||||
static bool IsGoodSubdirName(const wxString strSubdirName, const wxString strDirName = wxEmptyString);
|
||||
static bool IsGoodPathName(const wxString strPathName);
|
||||
static bool IsGoodPathString(wxString str);
|
||||
|
||||
// Note that because wxString::ToLong does additional testing, IsGoodInt doesn't duplicate
|
||||
// that testing, so use wxString::ToLong after IsGoodInt, not just atoi.
|
||||
@@ -41,8 +43,6 @@ public:
|
||||
|
||||
static bool IsValidChannel(const int nValue);
|
||||
static bool IsValidSampleFormat(const int nValue); // true if nValue is one sampleFormat enum values
|
||||
|
||||
static bool IsGoodFileString(wxString str);
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user