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

Side by Side Diff: Source/wtf/text/StringConcatenate.h

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/text/StringBuilder.h ('k') | Source/wtf/text/WTFString.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 (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 template<typename StringType1, typename StringType2> 398 template<typename StringType1, typename StringType2>
399 PassRefPtr<StringImpl> makeString(StringType1 string1, StringType2 string2) 399 PassRefPtr<StringImpl> makeString(StringType1 string1, StringType2 string2)
400 { 400 {
401 StringTypeAdapter<StringType1> adapter1(string1); 401 StringTypeAdapter<StringType1> adapter1(string1);
402 StringTypeAdapter<StringType2> adapter2(string2); 402 StringTypeAdapter<StringType2> adapter2(string2);
403 403
404 bool overflow = false; 404 bool overflow = false;
405 unsigned length = adapter1.length(); 405 unsigned length = adapter1.length();
406 sumWithOverflow(length, adapter2.length(), overflow); 406 sumWithOverflow(length, adapter2.length(), overflow);
407 if (overflow) 407 if (overflow)
408 return 0; 408 return nullptr;
409 409
410 if (adapter1.is8Bit() && adapter2.is8Bit()) { 410 if (adapter1.is8Bit() && adapter2.is8Bit()) {
411 LChar* buffer; 411 LChar* buffer;
412 RefPtr<StringImpl> resultImpl = StringImpl::createUninitialized(length, buffer); 412 RefPtr<StringImpl> resultImpl = StringImpl::createUninitialized(length, buffer);
413 if (!resultImpl) 413 if (!resultImpl)
414 return 0; 414 return nullptr;
415 415
416 LChar* result = buffer; 416 LChar* result = buffer;
417 adapter1.writeTo(result); 417 adapter1.writeTo(result);
418 result += adapter1.length(); 418 result += adapter1.length();
419 adapter2.writeTo(result); 419 adapter2.writeTo(result);
420 420
421 return resultImpl.release(); 421 return resultImpl.release();
422 } 422 }
423 423
424 UChar* buffer; 424 UChar* buffer;
425 RefPtr<StringImpl> resultImpl = StringImpl::createUninitialized(length, buff er); 425 RefPtr<StringImpl> resultImpl = StringImpl::createUninitialized(length, buff er);
426 if (!resultImpl) 426 if (!resultImpl)
427 return 0; 427 return nullptr;
428 428
429 UChar* result = buffer; 429 UChar* result = buffer;
430 adapter1.writeTo(result); 430 adapter1.writeTo(result);
431 result += adapter1.length(); 431 result += adapter1.length();
432 adapter2.writeTo(result); 432 adapter2.writeTo(result);
433 433
434 return resultImpl.release(); 434 return resultImpl.release();
435 } 435 }
436 436
437 } // namespace WTF 437 } // namespace WTF
438 438
439 #include "wtf/text/StringOperators.h" 439 #include "wtf/text/StringOperators.h"
440 #endif 440 #endif
OLDNEW
« no previous file with comments | « Source/wtf/text/StringBuilder.h ('k') | Source/wtf/text/WTFString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698