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

Side by Side Diff: src/xml/SkDOM.cpp

Issue 1510903005: another null src, memcpy -> sk_careful_memcpy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « no previous file | 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 "SkDOM.h" 10 #include "SkDOM.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 else // this adds siblings in reverse order. gets corrected in onEndE lement() 234 else // this adds siblings in reverse order. gets corrected in onEndE lement()
235 { 235 {
236 SkDOM::Node* parent = fParentStack.top(); 236 SkDOM::Node* parent = fParentStack.top();
237 SkASSERT(fRoot && parent); 237 SkASSERT(fRoot && parent);
238 node->fNextSibling = parent->fFirstChild; 238 node->fNextSibling = parent->fFirstChild;
239 parent->fFirstChild = node; 239 parent->fFirstChild = node;
240 } 240 }
241 *fParentStack.push() = node; 241 *fParentStack.push() = node;
242 242
243 memcpy(node->attrs(), fAttrs.begin(), attrCount * sizeof(SkDOM::Attr)); 243 sk_careful_memcpy(node->attrs(), fAttrs.begin(), attrCount * sizeof(SkDO M::Attr));
244 fAttrs.reset(); 244 fAttrs.reset();
245 245
246 } 246 }
247 247
248 bool onStartElement(const char elem[]) override { 248 bool onStartElement(const char elem[]) override {
249 this->startCommon(elem, SkDOM::kElement_Type); 249 this->startCommon(elem, SkDOM::kElement_Type);
250 return false; 250 return false;
251 } 251 }
252 252
253 bool onAddAttribute(const char name[], const char value[]) override { 253 bool onAddAttribute(const char name[], const char value[]) override {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 SkASSERT(v == nullptr); 506 SkASSERT(v == nullptr);
507 507
508 SkASSERT(dom.getFirstChild(root, "elem1")); 508 SkASSERT(dom.getFirstChild(root, "elem1"));
509 SkASSERT(!dom.getFirstChild(root, "subelem1")); 509 SkASSERT(!dom.getFirstChild(root, "subelem1"));
510 510
511 dom.dump(); 511 dom.dump();
512 #endif 512 #endif
513 } 513 }
514 514
515 #endif 515 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698