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

Side by Side Diff: src/ports/SkXMLPullParser_expat.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_tinyxml.cpp ('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 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 XML_Parser p = XML_ParserCreate(NULL); 145 XML_Parser p = XML_ParserCreate(NULL);
146 SkASSERT(p); 146 SkASSERT(p);
147 147
148 fImpl->fData.fParser = p; 148 fImpl->fData.fParser = p;
149 fImpl->fData.fCurr = &fCurr; 149 fImpl->fData.fCurr = &fCurr;
150 150
151 XML_SetElementHandler(p, start_proc, end_proc); 151 XML_SetElementHandler(p, start_proc, end_proc);
152 XML_SetCharacterDataHandler(p, text_proc); 152 XML_SetCharacterDataHandler(p, text_proc);
153 XML_SetUserData(p, &fImpl->fData); 153 XML_SetUserData(p, &fImpl->fData);
154 154
155 size_t len = fStream->read(NULL, 0); 155 size_t len = fStream->getLength();
156 fImpl->fBufferLen = len; 156 fImpl->fBufferLen = len;
157 fImpl->fBuffer = sk_malloc_throw(len); 157 fImpl->fBuffer = sk_malloc_throw(len);
158 fStream->rewind(); 158 fStream->rewind();
159 size_t len2 = fStream->read(fImpl->fBuffer, len); 159 size_t len2 = fStream->read(fImpl->fBuffer, len);
160 return len2 == len; 160 return len2 == len;
161 } 161 }
162 162
163 void SkXMLPullParser::onExit() 163 void SkXMLPullParser::onExit()
164 { 164 {
165 sk_free(fImpl->fBuffer); 165 sk_free(fImpl->fBuffer);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // return a start_tag, and clear the flag so we return end_tag next 204 // return a start_tag, and clear the flag so we return end_tag next
205 SkASSERT(SkXMLPullParser::END_TAG == fCurr.fEventType); 205 SkASSERT(SkXMLPullParser::END_TAG == fCurr.fEventType);
206 fImpl->fData.fState = Data::RETURN_END_TAG; 206 fImpl->fData.fState = Data::RETURN_END_TAG;
207 fImpl->fData.fEndTag = fCurr.fName; // save this pointer 207 fImpl->fData.fEndTag = fCurr.fName; // save this pointer
208 return SkXMLPullParser::START_TAG; 208 return SkXMLPullParser::START_TAG;
209 } 209 }
210 break; 210 break;
211 } 211 }
212 return fCurr.fEventType; 212 return fCurr.fEventType;
213 } 213 }
OLDNEW
« no previous file with comments | « src/ports/SkXMLParser_tinyxml.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698