mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-14 17:14:07 +01:00
Use standard library style members of wxArrayString (and wxString) ...
... which will make it easier to change the types of those containers to std::vectors of other string-like classes for wxString, IsEmpty => empty Clear => clear Alloc => reserve for wxArrayString, Count => size GetCount => size IsEmpty => empty Add => push_back Clear => clear Empty => clear Sort => std::sort (only with default comparator) SetCount => resize Last => back Item => operator [] Alloc => reserve
This commit is contained in:
@@ -74,7 +74,7 @@ bool XMLValueChecker::IsGoodFileName(const wxString & strFileName, const wxStrin
|
||||
bool XMLValueChecker::IsGoodFileString(const wxString &str)
|
||||
{
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
!str.empty() &&
|
||||
|
||||
// FILENAME_MAX is 260 in MSVC, but inconsistent across platforms,
|
||||
// sometimes huge, but we use 260 for all platforms.
|
||||
@@ -109,7 +109,7 @@ bool XMLValueChecker::IsGoodPathName(const wxString & strPathName)
|
||||
bool XMLValueChecker::IsGoodPathString(const wxString &str)
|
||||
{
|
||||
return (IsGoodString(str) &&
|
||||
!str.IsEmpty() &&
|
||||
!str.empty() &&
|
||||
(str.Length() <= PLATFORM_MAX_PATH));
|
||||
}
|
||||
|
||||
@@ -193,18 +193,18 @@ bool XMLTagHandler::ReadXMLTag(const char *tag, const char **attrs)
|
||||
|
||||
while (*attrs) {
|
||||
const char *s = *attrs++;
|
||||
tmp_attrs.Add(UTF8CTOWX(s));
|
||||
tmp_attrs.push_back(UTF8CTOWX(s));
|
||||
}
|
||||
|
||||
// JKC: Previously the next line was:
|
||||
// const char **out_attrs = NEW char (const char *)[tmp_attrs.GetCount()+1];
|
||||
// const char **out_attrs = NEW char (const char *)[tmp_attrs.size()+1];
|
||||
// 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.
|
||||
auto out_attrs = std::make_unique<const wxChar *[]>(tmp_attrs.GetCount() + 1);
|
||||
for (size_t i=0; i<tmp_attrs.GetCount(); i++) {
|
||||
auto out_attrs = std::make_unique<const wxChar *[]>(tmp_attrs.size() + 1);
|
||||
for (size_t i=0; i<tmp_attrs.size(); i++) {
|
||||
out_attrs[i] = tmp_attrs[i];
|
||||
}
|
||||
out_attrs[tmp_attrs.GetCount()] = 0;
|
||||
out_attrs[tmp_attrs.size()] = 0;
|
||||
|
||||
bool result = HandleXMLTag(UTF8CTOWX(tag), out_attrs.get());
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ void XMLWriter::EndTag(const wxString &name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (mTagstack.GetCount() > 0) {
|
||||
if (mTagstack.size() > 0) {
|
||||
if (mTagstack[0] == name) {
|
||||
if (mHasKids[1]) { // There will always be at least 2 at this point
|
||||
if (mInTag) {
|
||||
@@ -349,7 +349,7 @@ void XMLFileWriter::Commit()
|
||||
void XMLFileWriter::PreCommit()
|
||||
// may throw
|
||||
{
|
||||
while (mTagstack.GetCount()) {
|
||||
while (mTagstack.size()) {
|
||||
EndTag(mTagstack[0]);
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ XMLStringWriter::XMLStringWriter(size_t initialSize)
|
||||
{
|
||||
if (initialSize)
|
||||
{
|
||||
Alloc(initialSize);
|
||||
reserve(initialSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user