mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-14 17:14:07 +01:00
Remove needless uses of wxString::c_str() in wxString::Format...
... and similar wx "variadics," which all treat wxString smartly enough that you don't need this. Don't need c_str either to convert wxString to const wxChar * because wxString has a conversion operator that does the same.
This commit is contained in:
@@ -43,7 +43,7 @@ bool XMLFileReader::Parse(XMLTagHandler *baseHandler,
|
||||
{
|
||||
wxFFile theXMLFile(fname, wxT("rb"));
|
||||
if (!theXMLFile.IsOpened()) {
|
||||
mErrorStr.Printf(_("Could not open file: \"%s\""), fname.c_str());
|
||||
mErrorStr.Printf(_("Could not open file: \"%s\""), fname);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ bool XMLFileReader::Parse(XMLTagHandler *baseHandler,
|
||||
if (mBaseHandler)
|
||||
return true;
|
||||
else {
|
||||
mErrorStr.Printf(_("Could not load file: \"%s\""), fname.c_str());
|
||||
mErrorStr.Printf(_("Could not load file: \"%s\""), fname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,18 +194,18 @@ bool XMLTagHandler::ReadXMLTag(const char *tag, const char **attrs)
|
||||
// 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++) {
|
||||
out_attrs[i] = tmp_attrs[i].c_str();
|
||||
out_attrs[i] = tmp_attrs[i];
|
||||
}
|
||||
out_attrs[tmp_attrs.GetCount()] = 0;
|
||||
|
||||
bool result = HandleXMLTag(UTF8CTOWX(tag).c_str(), out_attrs.get());
|
||||
bool result = HandleXMLTag(UTF8CTOWX(tag), out_attrs.get());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void XMLTagHandler::ReadXMLEndTag(const char *tag)
|
||||
{
|
||||
HandleXMLEndTag(UTF8CTOWX(tag).c_str());
|
||||
HandleXMLEndTag(UTF8CTOWX(tag));
|
||||
}
|
||||
|
||||
void XMLTagHandler::ReadXMLContent(const char *s, int len)
|
||||
@@ -215,5 +215,5 @@ void XMLTagHandler::ReadXMLContent(const char *s, int len)
|
||||
|
||||
XMLTagHandler *XMLTagHandler::ReadXMLChild(const char *tag)
|
||||
{
|
||||
return HandleXMLChild(UTF8CTOWX(tag).c_str());
|
||||
return HandleXMLChild(UTF8CTOWX(tag));
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ void XMLWriter::StartTag(const wxString &name)
|
||||
Write(wxT("\t"));
|
||||
}
|
||||
|
||||
Write(wxString::Format(wxT("<%s"), name.c_str()));
|
||||
Write(wxString::Format(wxT("<%s"), name));
|
||||
|
||||
mTagstack.Insert(name, 0);
|
||||
mHasKids[0] = true;
|
||||
@@ -113,7 +113,7 @@ void XMLWriter::EndTag(const wxString &name)
|
||||
for (i = 0; i < mDepth - 1; i++) {
|
||||
Write(wxT("\t"));
|
||||
}
|
||||
Write(wxString::Format(wxT("</%s>\n"), name.c_str()));
|
||||
Write(wxString::Format(wxT("</%s>\n"), name));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -132,8 +132,8 @@ void XMLWriter::WriteAttr(const wxString &name, const wxString &value)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%s\""),
|
||||
name.c_str(),
|
||||
XMLEsc(value).c_str()));
|
||||
name,
|
||||
XMLEsc(value)));
|
||||
}
|
||||
|
||||
void XMLWriter::WriteAttr(const wxString &name, const wxChar *value)
|
||||
@@ -146,7 +146,7 @@ void XMLWriter::WriteAttr(const wxString &name, int value)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%d\""),
|
||||
name.c_str(),
|
||||
name,
|
||||
value));
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ void XMLWriter::WriteAttr(const wxString &name, bool value)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%d\""),
|
||||
name.c_str(),
|
||||
name,
|
||||
value));
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ void XMLWriter::WriteAttr(const wxString &name, long value)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%ld\""),
|
||||
name.c_str(),
|
||||
name,
|
||||
value));
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ void XMLWriter::WriteAttr(const wxString &name, long long value)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%lld\""),
|
||||
name.c_str(),
|
||||
name,
|
||||
value));
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ void XMLWriter::WriteAttr(const wxString &name, size_t value)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%lld\""),
|
||||
name.c_str(),
|
||||
name,
|
||||
(long long) value));
|
||||
}
|
||||
|
||||
@@ -186,16 +186,16 @@ void XMLWriter::WriteAttr(const wxString &name, float value, int digits)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%s\""),
|
||||
name.c_str(),
|
||||
Internat::ToString(value, digits).c_str()));
|
||||
name,
|
||||
Internat::ToString(value, digits)));
|
||||
}
|
||||
|
||||
void XMLWriter::WriteAttr(const wxString &name, double value, int digits)
|
||||
// may throw from Write()
|
||||
{
|
||||
Write(wxString::Format(wxT(" %s=\"%s\""),
|
||||
name.c_str(),
|
||||
Internat::ToString(value, digits).c_str()));
|
||||
name,
|
||||
Internat::ToString(value, digits)));
|
||||
}
|
||||
|
||||
void XMLWriter::WriteData(const wxString &value)
|
||||
@@ -219,7 +219,7 @@ void XMLWriter::WriteSubTree(const wxString &value)
|
||||
mHasKids[0] = true;
|
||||
}
|
||||
|
||||
Write(value.c_str());
|
||||
Write(value);
|
||||
}
|
||||
|
||||
// See http://www.w3.org/TR/REC-xml for reference
|
||||
|
||||
Reference in New Issue
Block a user