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

Side by Side Diff: include/core/SkString.h

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo autoasciitolc Created 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkRefCnt.h ('k') | include/core/SkThread.h » ('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 /* 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 #ifndef SkString_DEFINED 10 #ifndef SkString_DEFINED
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void validate() const; 228 void validate() const;
229 #else 229 #else
230 void validate() const {} 230 void validate() const {}
231 #endif 231 #endif
232 232
233 static const Rec gEmptyRec; 233 static const Rec gEmptyRec;
234 static Rec* AllocRec(const char text[], size_t len); 234 static Rec* AllocRec(const char text[], size_t len);
235 static Rec* RefRec(Rec*); 235 static Rec* RefRec(Rec*);
236 }; 236 };
237 237
238 class SkAutoUCS2 {
239 public:
240 SkAutoUCS2(const char utf8[]);
241 ~SkAutoUCS2();
242
243 /** This returns the number of ucs2 characters
244 */
245 int count() const { return fCount; }
246
247 /** This returns a null terminated ucs2 string
248 */
249 const uint16_t* getUCS2() const { return fUCS2; }
250
251 private:
252 int fCount;
253 uint16_t* fUCS2;
254 };
255
256 /// Creates a new string and writes into it using a printf()-style format. 238 /// Creates a new string and writes into it using a printf()-style format.
257 SkString SkStringPrintf(const char* format, ...); 239 SkString SkStringPrintf(const char* format, ...);
258 240
259 // Specialized to take advantage of SkString's fast swap path. The unspecialized function is 241 // Specialized to take advantage of SkString's fast swap path. The unspecialized function is
260 // declared in SkTypes.h and called by SkTSort. 242 // declared in SkTypes.h and called by SkTSort.
261 template <> inline void SkTSwap(SkString& a, SkString& b) { 243 template <> inline void SkTSwap(SkString& a, SkString& b) {
262 a.swap(b); 244 a.swap(b);
263 } 245 }
264 246
265 #endif 247 #endif
OLDNEW
« no previous file with comments | « include/core/SkRefCnt.h ('k') | include/core/SkThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698