Ignore:
Timestamp:
Jul 21, 2009, 11:13:11 AM (16 years ago)
Author:
Adam Roben
Message:

Roll out r46153, r46154, and r46155

These changes were causing build failures and assertion failures on
Windows.

JavaScriptCore:

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • runtime/JSArray.cpp:
  • runtime/StringPrototype.cpp:
  • runtime/UString.cpp:
  • runtime/UString.h:
  • wtf/FastMalloc.cpp:
  • wtf/FastMalloc.h:
  • wtf/Platform.h:
  • wtf/PossiblyNull.h: Removed.

WebCore:

  • ForwardingHeaders/wtf/PossiblyNull.h: Removed.
  • platform/graphics/cg/ImageBufferCG.cpp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UString.cpp

    r46153 r46180  
    6969static inline size_t maxUChars() { return std::numeric_limits<size_t>::max() / sizeof(UChar); }
    7070
    71 static inline PossiblyNull<UChar*> allocChars(size_t length)
     71static inline UChar* allocChars(size_t length)
    7272{
    7373    ASSERT(length);
    7474    if (length > maxUChars())
    7575        return 0;
    76     return tryFastMalloc(sizeof(UChar) * length);
    77 }
    78 
    79 static inline PossiblyNull<UChar*> reallocChars(UChar* buffer, size_t length)
     76    return static_cast<UChar*>(tryFastMalloc(sizeof(UChar) * length));
     77}
     78
     79static inline UChar* reallocChars(UChar* buffer, size_t length)
    8080{
    8181    ASSERT(length);
    8282    if (length > maxUChars())
    8383        return 0;
    84     return tryFastRealloc(buffer, sizeof(UChar) * length);
     84    return static_cast<UChar*>(tryFastRealloc(buffer, sizeof(UChar) * length));
    8585}
    8686
     
    481481        size_t newCapacity = expandedSize(requiredLength, base->preCapacity);
    482482        UChar* oldBuf = base->buf;
    483         if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) {
     483        base->buf = reallocChars(base->buf, newCapacity);
     484        if (!base->buf) {
    484485            base->buf = oldBuf;
    485486            return false;
     
    512513    size_t newCapacity = expandedSize(capacity, base->preCapacity);
    513514    UChar* oldBuf = base->buf;
    514     if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) {
     515    base->buf = reallocChars(base->buf, newCapacity);
     516    if (!base->buf) {
    515517        base->buf = oldBuf;
    516518        return false;
     
    539541        int delta = newCapacity - base->capacity - base->preCapacity;
    540542
    541         UChar* newBuf;
    542         if (!allocChars(newCapacity).getValue(newBuf)) {
     543        UChar* newBuf = allocChars(newCapacity);
     544        if (!newBuf) {
    543545            makeNull();
    544546            return;
     
    565567
    566568    size_t length = strlen(c);
    567     UChar* d;
    568     if (!allocChars(length).getValue(d))
     569    UChar* d = allocChars(length);
     570    if (!d)
    569571        return &UString::Rep::null();
    570572    else {
     
    655657        // This is shared in some way that prevents us from modifying base, so we must make a whole new string.
    656658        size_t newCapacity = expandedSize(length, 0);
    657         UChar* d;
    658         if (!allocChars(newCapacity).getValue(d))
     659        UChar* d = allocChars(newCapacity);
     660        if (!d)
    659661            rep = &UString::Rep::null();
    660662        else {
     
    711713        // This is shared in some way that prevents us from modifying base, so we must make a whole new string.
    712714        size_t newCapacity = expandedSize(length, 0);
    713         UChar* d;
    714         if (!allocChars(newCapacity).getValue(d))
     715        UChar* d = allocChars(newCapacity);
     716        if (!d)
    715717            rep = &UString::Rep::null();
    716718        else {
     
    799801    // a does not qualify for append, and b does not qualify for prepend, gotta make a whole new string
    800802    size_t newCapacity = expandedSize(length, 0);
    801     UChar* d;
    802     if (!allocChars(newCapacity).getValue(d))
     803    UChar* d = allocChars(newCapacity);
     804    if (!d)
    803805        return 0;
    804806    copyChars(d, a->data(), aSize);
     
    10751077        return "";
    10761078
    1077     UChar* buffer;
    1078     if (!allocChars(totalLength).getValue(buffer))
     1079    UChar* buffer = allocChars(totalLength);
     1080    if (!buffer)
    10791081        return null();
    10801082
     
    11041106        return "";
    11051107
    1106     UChar* buffer;
    1107     if (!allocChars(totalLength).getValue(buffer))
     1108    UChar* buffer = allocChars(totalLength);
     1109    if (!buffer)
    11081110        return null();
    11091111
     
    11521154        // This is shared in some way that prevents us from modifying base, so we must make a whole new string.
    11531155        size_t newCapacity = expandedSize(length, 0);
    1154         UChar* d;
    1155         if (!allocChars(newCapacity).getValue(d))
     1156        UChar* d = allocChars(newCapacity);
     1157        if (!d)
    11561158            makeNull();
    11571159        else {
     
    12051207        // this is empty - must make a new m_rep because we don't want to pollute the shared empty one
    12061208        size_t newCapacity = expandedSize(1, 0);
    1207         UChar* d;
    1208         if (!allocChars(newCapacity).getValue(d))
     1209        UChar* d = allocChars(newCapacity);
     1210        if (!d)
    12091211            makeNull();
    12101212        else {
     
    12331235        // This is shared in some way that prevents us from modifying base, so we must make a whole new string.
    12341236        size_t newCapacity = expandedSize(length + 1, 0);
    1235         UChar* d;
    1236         if (!allocChars(newCapacity).getValue(d))
     1237        UChar* d = allocChars(newCapacity);
     1238        if (!d)
    12371239            makeNull();
    12381240        else {
     
    13121314        m_rep->len = l;
    13131315    } else {
    1314         if (!allocChars(l).getValue(d)) {
     1316        d = allocChars(l);
     1317        if (!d) {
    13151318            makeNull();
    13161319            return *this;
Note: See TracChangeset for help on using the changeset viewer.