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

Side by Side Diff: src/core/SkPathRef.cpp

Issue 732643002: Don't pass null to memcmp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: loosen test when strlen == 0 Created 6 years, 1 month 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 | tests/PathTest.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkLazyPtr.h" 9 #include "SkLazyPtr.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 #ifdef SK_RELEASE 186 #ifdef SK_RELEASE
187 if (genIDMatch) { 187 if (genIDMatch) {
188 return true; 188 return true;
189 } 189 }
190 #endif 190 #endif
191 if (fPointCnt != ref.fPointCnt || 191 if (fPointCnt != ref.fPointCnt ||
192 fVerbCnt != ref.fVerbCnt) { 192 fVerbCnt != ref.fVerbCnt) {
193 SkASSERT(!genIDMatch); 193 SkASSERT(!genIDMatch);
194 return false; 194 return false;
195 } 195 }
196 if (ref.fVerbCnt == 0 && ref.fPointCnt == 0) {
reed1 2014/11/14 17:09:41 is it enough to just check fVerbCnt (and if it is
mtklein 2014/11/14 17:13:20 Yes (until we add pointless verbs :P). Done.
197 return true;
198 }
199 SkASSERT(this->verbsMemBegin() && ref.verbsMemBegin());
196 if (0 != memcmp(this->verbsMemBegin(), 200 if (0 != memcmp(this->verbsMemBegin(),
197 ref.verbsMemBegin(), 201 ref.verbsMemBegin(),
198 ref.fVerbCnt * sizeof(uint8_t))) { 202 ref.fVerbCnt * sizeof(uint8_t))) {
199 SkASSERT(!genIDMatch); 203 SkASSERT(!genIDMatch);
200 return false; 204 return false;
201 } 205 }
206 SkASSERT(this->points() && ref.points());
202 if (0 != memcmp(this->points(), 207 if (0 != memcmp(this->points(),
203 ref.points(), 208 ref.points(),
204 ref.fPointCnt * sizeof(SkPoint))) { 209 ref.fPointCnt * sizeof(SkPoint))) {
205 SkASSERT(!genIDMatch); 210 SkASSERT(!genIDMatch);
206 return false; 211 return false;
207 } 212 }
208 if (fConicWeights != ref.fConicWeights) { 213 if (fConicWeights != ref.fConicWeights) {
209 SkASSERT(!genIDMatch); 214 SkASSERT(!genIDMatch);
210 return false; 215 return false;
211 } 216 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 break; 488 break;
484 default: 489 default:
485 SkDEBUGFAIL("Unknown Verb"); 490 SkDEBUGFAIL("Unknown Verb");
486 break; 491 break;
487 } 492 }
488 } 493 }
489 SkASSERT(mask == fSegmentMask); 494 SkASSERT(mask == fSegmentMask);
490 #endif // SK_DEBUG_PATH 495 #endif // SK_DEBUG_PATH
491 } 496 }
492 #endif 497 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698