mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-19 17:11:12 +02:00
Remove trailing spaces.
This commit is contained in:
@@ -27,7 +27,7 @@ XMLFileReader::XMLFileReader()
|
||||
mParser = XML_ParserCreate(NULL);
|
||||
XML_SetUserData(mParser, (void *)this);
|
||||
XML_SetElementHandler(mParser, startElement, endElement);
|
||||
XML_SetCharacterDataHandler(mParser, charHandler);
|
||||
XML_SetCharacterDataHandler(mParser, charHandler);
|
||||
mBaseHandler = NULL;
|
||||
mMaxDepth = 128;
|
||||
mHandler = new XMLTagHandler*[mMaxDepth];
|
||||
|
@@ -16,7 +16,7 @@
|
||||
using XML files.
|
||||
|
||||
\class XMLValueChecker
|
||||
\brief XMLValueChecker implements static bool methods for checking
|
||||
\brief XMLValueChecker implements static bool methods for checking
|
||||
input values from XML files.
|
||||
|
||||
*//*******************************************************************/
|
||||
@@ -52,7 +52,7 @@ bool XMLValueChecker::IsGoodString(const wxString str)
|
||||
bool XMLValueChecker::IsGoodFileName(const wxString strFileName, const wxString strDirName /* = "" */)
|
||||
{
|
||||
// Test strFileName.
|
||||
if (!IsGoodFileString(strFileName) ||
|
||||
if (!IsGoodFileString(strFileName) ||
|
||||
(strDirName.Length() + 1 + strFileName.Length() > PLATFORM_MAX_PATH))
|
||||
return false;
|
||||
|
||||
@@ -63,24 +63,24 @@ bool XMLValueChecker::IsGoodFileName(const wxString strFileName, const wxString
|
||||
|
||||
bool XMLValueChecker::IsGoodFileString(wxString str)
|
||||
{
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
|
||||
// FILENAME_MAX is 260 in MSVC, but inconsistent across platforms,
|
||||
// FILENAME_MAX is 260 in MSVC, but inconsistent across platforms,
|
||||
// sometimes huge, but we use 260 for all platforms.
|
||||
(str.Length() <= 260) &&
|
||||
(str.Length() <= 260) &&
|
||||
|
||||
(str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters.
|
||||
(str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters.
|
||||
}
|
||||
|
||||
bool XMLValueChecker::IsGoodSubdirName(const wxString strSubdirName, const wxString strDirName /* = "" */)
|
||||
{
|
||||
// Test strSubdirName.
|
||||
// Note this prevents path separators, and relative path to parents (strDirName),
|
||||
// so fixes vulnerability #3 in the NGS report for UmixIt,
|
||||
// Test strSubdirName.
|
||||
// Note this prevents path separators, and relative path to parents (strDirName),
|
||||
// so fixes vulnerability #3 in the NGS report for UmixIt,
|
||||
// where an attacker could craft an AUP file with relative pathnames to get to system files, for example.
|
||||
if (!IsGoodFileString(strSubdirName) ||
|
||||
(strSubdirName == wxT(".")) || (strSubdirName == wxT("..")) ||
|
||||
if (!IsGoodFileString(strSubdirName) ||
|
||||
(strSubdirName == wxT(".")) || (strSubdirName == wxT("..")) ||
|
||||
(strDirName.Length() + 1 + strSubdirName.Length() > PLATFORM_MAX_PATH))
|
||||
return false;
|
||||
|
||||
@@ -98,8 +98,8 @@ bool XMLValueChecker::IsGoodPathName(const wxString strPathName)
|
||||
|
||||
bool XMLValueChecker::IsGoodPathString(wxString str)
|
||||
{
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
(str.Length() <= PLATFORM_MAX_PATH));
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ bool XMLValueChecker::IsGoodInt(const wxString strInt)
|
||||
for (i = 0; i < lenMAXABS; i++)
|
||||
if (strInt[i+1] < '0' || strInt[i+1] > '9')
|
||||
return false; // not a digit
|
||||
|
||||
|
||||
for (i = 0; i < lenMAXABS; i++)
|
||||
if (strInt[i+1] - '0' < digitsMAXABS[i])
|
||||
return true; // number is small enough
|
||||
@@ -165,7 +165,7 @@ bool XMLValueChecker::IsGoodInt64(const wxString strInt)
|
||||
for (i = 0; i < lenMAXABS; i++)
|
||||
if (strInt[i+1] < '0' || strInt[i+1] > '9')
|
||||
return false; // not a digit
|
||||
|
||||
|
||||
for (i = 0; i < lenMAXABS; i++)
|
||||
if (strInt[i+1] - '0' < digitsMAXABS[i])
|
||||
return true; // number is small enough
|
||||
@@ -214,7 +214,7 @@ bool XMLTagHandler::ReadXMLTag(const char *tag, const char **attrs)
|
||||
|
||||
// JKC: Previously the next line was:
|
||||
// const char **out_attrs = new char (const char *)[tmp_attrs.GetCount()+1];
|
||||
// however MSVC doesn't like the constness in this position, so this is now
|
||||
// however MSVC doesn't like the constness in this position, so this is now
|
||||
// added by a cast after creating the array of pointers-to-non-const chars.
|
||||
const wxChar **out_attrs = (const wxChar**)new wxChar *[tmp_attrs.GetCount()+1];
|
||||
for (size_t i=0; i<tmp_attrs.GetCount(); i++) {
|
||||
|
@@ -11,7 +11,7 @@
|
||||
classes which wish to be able to load and save themselves
|
||||
using XML files.
|
||||
|
||||
The XMLValueChecker class implements static bool methods for checking
|
||||
The XMLValueChecker class implements static bool methods for checking
|
||||
input values from XML files.
|
||||
|
||||
**********************************************************************/
|
||||
@@ -27,7 +27,7 @@ class XMLValueChecker
|
||||
{
|
||||
public:
|
||||
// "Good" means well-formed and for the file-related functions, names an existing file or folder.
|
||||
// These are used in HandleXMLTag and BuildFomXML methods to check the input for
|
||||
// These are used in HandleXMLTag and BuildFomXML methods to check the input for
|
||||
// security vulnerabilites, per the NGS report for UmixIt.
|
||||
static bool IsGoodString(const wxString str);
|
||||
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
* @return true if the string is convertable, false if not
|
||||
*/
|
||||
static bool IsGoodInt64(const wxString strInt);
|
||||
|
||||
static bool IsValidChannel(const int nValue);
|
||||
|
||||
static bool IsValidChannel(const int nValue);
|
||||
#ifdef USE_MIDI
|
||||
static bool IsValidVisibleChannels(const int nValue);
|
||||
#endif
|
||||
|
@@ -38,7 +38,7 @@ the general functionality for creating XML in UTF8 encoding.
|
||||
//table for xml encoding compatibility with expat decoding
|
||||
//see wxWidgets-2.8.12/src/expat/lib/xmltok_impl.h
|
||||
//and wxWidgets-2.8.12/src/expat/lib/asciitab.h
|
||||
static int charXMLCompatiblity[] =
|
||||
static int charXMLCompatiblity[] =
|
||||
{
|
||||
|
||||
/* 0x00 */ 0, 0, 0, 0,
|
||||
@@ -74,7 +74,7 @@ void XMLWriter::StartTag(const wxString &name)
|
||||
Write(wxT(">\n"));
|
||||
mInTag = false;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < mDepth; i++) {
|
||||
Write(wxT("\t"));
|
||||
}
|
||||
@@ -98,7 +98,7 @@ void XMLWriter::EndTag(const wxString &name)
|
||||
if (mInTag) {
|
||||
Write(wxT("/>\n"));
|
||||
}
|
||||
else {
|
||||
else {
|
||||
for (i = 0; i < mDepth - 1; i++) {
|
||||
Write(wxT("\t"));
|
||||
}
|
||||
@@ -296,7 +296,7 @@ wxString XMLWriter::XMLEsc(const wxString & s)
|
||||
//see xmltok.c in expat checkCharRefNumber() to see how expat bails on these chars.
|
||||
//also see wxWidgets-2.8.12/src/expat/lib/asciitab.h to see which characters are nonxml compatible
|
||||
//post decode (we can still encode '&' and '<' with this table, but it prevents us from encoding eot)
|
||||
//everything is compatible past ascii 0x20, so we don't check higher than this.
|
||||
//everything is compatible past ascii 0x20, so we don't check higher than this.
|
||||
if(c> 0x1F || charXMLCompatiblity[c]!=0)
|
||||
result += wxString::Format(wxT("&#x%04x;"), c);
|
||||
}
|
||||
@@ -346,7 +346,7 @@ void XMLFileWriter::CloseWithoutEndingTags()
|
||||
if (!wxFFile::Flush())
|
||||
{
|
||||
wxFFile::Close();
|
||||
/* i18n-hint: 'flushing' means writing any remaining queued up changes
|
||||
/* i18n-hint: 'flushing' means writing any remaining queued up changes
|
||||
* to disk that have not yet been written.*/
|
||||
throw new XMLFileWriterException(_("Error Flushing File"));
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ class AUDACITY_DLL_API XMLFileWriter:public wxFFile, public XMLWriter {
|
||||
|
||||
/// Open the file. Might throw XMLFileWriterException.
|
||||
void Open(const wxString &name, const wxString &mode);
|
||||
|
||||
|
||||
/// Close file. Might throw XMLFileWriterException.
|
||||
void Close();
|
||||
|
||||
|
Reference in New Issue
Block a user