Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: chrome/common/libxml_utils.cc

Issue 464064: Add StringPrintV, fix libxml_utils.cc to use it (Closed)
Patch Set: remove wstring version of StringPrintV Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/string_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/libxml_utils.h" 5 #include "chrome/common/libxml_utils.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 10
(...skipping 17 matching lines...) Expand all
28 if (reader_) 28 if (reader_)
29 xmlFreeTextReader(reader_); 29 xmlFreeTextReader(reader_);
30 } 30 }
31 31
32 // static 32 // static
33 void XmlReader::GenericErrorCallback(void* context, const char* msg, ...) { 33 void XmlReader::GenericErrorCallback(void* context, const char* msg, ...) {
34 va_list args; 34 va_list args;
35 va_start(args, msg); 35 va_start(args, msg);
36 36
37 XmlReader* reader = static_cast<XmlReader*>(context); 37 XmlReader* reader = static_cast<XmlReader*>(context);
38 reader->errors_.append(StringPrintf(msg, args)); 38 reader->errors_.append(StringPrintV(msg, args));
39 va_end(args);
39 } 40 }
40 41
41 bool XmlReader::Load(const std::string& input) { 42 bool XmlReader::Load(const std::string& input) {
42 const int kParseOptions = XML_PARSE_RECOVER | // recover on errors 43 const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
43 XML_PARSE_NONET; // forbid network access 44 XML_PARSE_NONET; // forbid network access
44 // TODO(evanm): Verify it's OK to pass NULL for the URL and encoding. 45 // TODO(evanm): Verify it's OK to pass NULL for the URL and encoding.
45 // The libxml code allows for these, but it's unclear what effect is has. 46 // The libxml code allows for these, but it's unclear what effect is has.
46 reader_ = xmlReaderForMemory(input.data(), static_cast<int>(input.size()), 47 reader_ = xmlReaderForMemory(input.data(), static_cast<int>(input.size()),
47 NULL, NULL, kParseOptions); 48 NULL, NULL, kParseOptions);
48 return reader_ != NULL; 49 return reader_ != NULL;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 writer_ = xmlNewTextWriterMemory(buffer_, 0); 134 writer_ = xmlNewTextWriterMemory(buffer_, 0);
134 xmlTextWriterSetIndent(writer_, 1); 135 xmlTextWriterSetIndent(writer_, 1);
135 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL); 136 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL);
136 } 137 }
137 138
138 void XmlWriter::StopWriting() { 139 void XmlWriter::StopWriting() {
139 xmlTextWriterEndDocument(writer_); 140 xmlTextWriterEndDocument(writer_);
140 xmlFreeTextWriter(writer_); 141 xmlFreeTextWriter(writer_);
141 writer_ = NULL; 142 writer_ = NULL;
142 } 143 }
OLDNEW
« no previous file with comments | « base/string_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698