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

Side by Side Diff: tools/skdiff_utils.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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
« no previous file with comments | « tools/skdiff_main.cpp ('k') | tools/skimage_main.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 2012 Google Inc. 2 * Copyright 2012 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 #include "skdiff.h" 7 #include "skdiff.h"
8 #include "skdiff_utils.h" 8 #include "skdiff_utils.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 /// 96 ///
97 /// TODO: If we like this, we should move it into the core SkString implementati on, 97 /// TODO: If we like this, we should move it into the core SkString implementati on,
98 /// adding more checks and ample test cases, and paying more attention to effici ency. 98 /// adding more checks and ample test cases, and paying more attention to effici ency.
99 static SkString replace_all(const SkString &input, 99 static SkString replace_all(const SkString &input,
100 const char oldSubstring[], const char newSubstring[] ) { 100 const char oldSubstring[], const char newSubstring[] ) {
101 SkString output; 101 SkString output;
102 const char *input_cstr = input.c_str(); 102 const char *input_cstr = input.c_str();
103 const char *first_char = input_cstr; 103 const char *first_char = input_cstr;
104 const char *match_char; 104 const char *match_char;
105 size_t oldSubstringLen = strlen(oldSubstring); 105 size_t oldSubstringLen = strlen(oldSubstring);
106 while (NULL != (match_char = strstr(first_char, oldSubstring))) { 106 while ((match_char = strstr(first_char, oldSubstring))) {
107 output.append(first_char, (match_char - first_char)); 107 output.append(first_char, (match_char - first_char));
108 output.append(newSubstring); 108 output.append(newSubstring);
109 first_char = match_char + oldSubstringLen; 109 first_char = match_char + oldSubstringLen;
110 } 110 }
111 output.append(first_char); 111 output.append(first_char);
112 return output; 112 return output;
113 } 113 }
114 114
115 static SkString filename_to_derived_filename(const SkString& filename, const cha r *suffix) { 115 static SkString filename_to_derived_filename(const SkString& filename, const cha r *suffix) {
116 SkString diffName (filename); 116 SkString diffName (filename);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status; 175 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status;
176 } 176 }
177 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) { 177 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) {
178 drp->fWhite.fStatus = DiffResource::kExists_Status; 178 drp->fWhite.fStatus = DiffResource::kExists_Status;
179 } else { 179 } else {
180 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status; 180 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status;
181 } 181 }
182 } 182 }
183 } 183 }
184 } 184 }
OLDNEW
« no previous file with comments | « tools/skdiff_main.cpp ('k') | tools/skimage_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698