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

Side by Side Diff: src/ports/SkXMLParser_tinyxml.cpp

Issue 12834012: Update code to use helper function for better readability/searching. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « src/ports/SkXMLParser_expat.cpp ('k') | src/ports/SkXMLPullParser_expat.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkXMLParser.h" 10 #include "SkXMLParser.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 printf("tinyxml error: <%s> row[%d] col[%d]\n", doc.ErrorDesc(), doc.Err orRow(), doc.ErrorCol()); 51 printf("tinyxml error: <%s> row[%d] col[%d]\n", doc.ErrorDesc(), doc.Err orRow(), doc.ErrorCol());
52 return false; 52 return false;
53 } 53 }
54 54
55 walk_elem(parser, doc.RootElement()); 55 walk_elem(parser, doc.RootElement());
56 return true; 56 return true;
57 } 57 }
58 58
59 bool SkXMLParser::parse(SkStream& stream) 59 bool SkXMLParser::parse(SkStream& stream)
60 { 60 {
61 size_t size = stream.read(NULL, 0); 61 size_t size = stream.getLength();
62 62
63 SkAutoMalloc buffer(size + 1); 63 SkAutoMalloc buffer(size + 1);
64 char* buf = (char*)buffer.get(); 64 char* buf = (char*)buffer.get();
65 65
66 stream.read(buf, size); 66 stream.read(buf, size);
67 buf[size] = 0; 67 buf[size] = 0;
68 68
69 return load_buf(this, buf); 69 return load_buf(this, buf);
70 } 70 }
71 71
72 bool SkXMLParser::parse(const char doc[], size_t len) 72 bool SkXMLParser::parse(const char doc[], size_t len)
73 { 73 {
74 SkAutoMalloc buffer(len + 1); 74 SkAutoMalloc buffer(len + 1);
75 char* buf = (char*)buffer.get(); 75 char* buf = (char*)buffer.get();
76 76
77 memcpy(buf, doc, len); 77 memcpy(buf, doc, len);
78 buf[len] = 0; 78 buf[len] = 0;
79 79
80 return load_buf(this, buf); 80 return load_buf(this, buf);
81 } 81 }
82 82
83 void SkXMLParser::GetNativeErrorString(int error, SkString* str) 83 void SkXMLParser::GetNativeErrorString(int error, SkString* str)
84 { 84 {
85 if (str) 85 if (str)
86 str->set("GetNativeErrorString not implemented for TinyXml"); 86 str->set("GetNativeErrorString not implemented for TinyXml");
87 } 87 }
OLDNEW
« no previous file with comments | « src/ports/SkXMLParser_expat.cpp ('k') | src/ports/SkXMLPullParser_expat.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698