| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |