Changeset 17700 in webkit


Ignore:
Timestamp:
Nov 9, 2006 9:17:06 PM (17 years ago)
Author:
mjs
Message:

Reviewed by Oliver.

  • rename String::sprintf and DeprecatedString::sprintf to ...::format to avoid needlessly tweaking a search for insecure functions. Neither of these has risk of buffer overruns since they calculate the buffer size for you and use vsnprintf.
  • bindings/js/kjs_window.cpp: (KJS::Window::isSafeScript):
  • css/cssparser.cpp: (WebCore::CSSParser::parseColorFromValue):
  • dom/StyledElement.cpp: (WebCore::StyledElement::addCSSColor):
  • dom/XMLTokenizer.cpp: (WebCore::XMLTokenizer::handleError):
  • ksvg2/css/SVGCSSParser.cpp: (WebCore::CSSParser::parseSVGPaint): (WebCore::CSSParser::parseSVGColor):
  • ksvg2/svg/SVGPathSegArc.h: (WebCore::SVGPathSegArcAbs::toString): (WebCore::SVGPathSegArcRel::toString):
  • ksvg2/svg/SVGPathSegCurvetoCubic.h: (WebCore::SVGPathSegCurvetoCubicAbs::toString): (WebCore::SVGPathSegCurvetoCubicRel::toString):
  • ksvg2/svg/SVGPathSegCurvetoCubicSmooth.h: (WebCore::SVGPathSegCurvetoCubicSmoothAbs::toString): (WebCore::SVGPathSegCurvetoCubicSmoothRel::toString):
  • ksvg2/svg/SVGPathSegCurvetoQuadratic.h: (WebCore::SVGPathSegCurvetoQuadraticAbs::toString): (WebCore::SVGPathSegCurvetoQuadraticRel::toString):
  • ksvg2/svg/SVGPathSegCurvetoQuadraticSmooth.h: (WebCore::SVGPathSegCurvetoQuadraticSmoothAbs::toString): (WebCore::SVGPathSegCurvetoQuadraticSmoothRel::toString):
  • ksvg2/svg/SVGPathSegLineto.h: (WebCore::SVGPathSegLinetoAbs::toString): (WebCore::SVGPathSegLinetoRel::toString):
  • ksvg2/svg/SVGPathSegLinetoHorizontal.h: (WebCore::SVGPathSegLinetoHorizontalAbs::toString): (WebCore::SVGPathSegLinetoHorizontalRel::toString):
  • ksvg2/svg/SVGPathSegLinetoVertical.h: (WebCore::SVGPathSegLinetoVerticalAbs::toString): (WebCore::SVGPathSegLinetoVerticalRel::toString):
  • ksvg2/svg/SVGPathSegMoveto.h: (WebCore::SVGPathSegMovetoAbs::toString): (WebCore::SVGPathSegMovetoRel::toString):
  • ksvg2/svg/SVGPolyElement.cpp: (WebCore::SVGPolyElement::notifyAttributeChange):
  • ksvg2/svg/SVGUseElement.cpp: (WebCore::SVGUseElement::closeRenderer):
  • loader/icon/IconDatabase.cpp: (WebCore::IconDatabase::forgetIconForIconURLFromDatabase):
  • loader/icon/SQLDatabase.cpp: (WebCore::SQLDatabase::setSynchronous):
  • platform/Color.cpp: (WebCore::Color::name):
  • platform/DeprecatedString.cpp: (WebCore::DeprecatedString::setNum): (WebCore::DeprecatedString::format):
  • platform/DeprecatedString.h:
  • platform/PlatformString.h:
  • platform/String.cpp: (WebCore::String::format): (WebCore::String::number):
  • platform/mac/KeyEventMac.mm: (WebCore::keyIdentifierForKeyEvent):
  • platform/win/KeyEventWin.cpp: (WebCore::keyIdentifierForWindowsKeyCode):
  • rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::calcMinMaxWidth):
Location:
trunk/WebCore
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r17699 r17700  
     12006-11-09  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Oliver.
     4
     5        - rename String::sprintf and DeprecatedString::sprintf to ...::format to avoid needlessly tweaking a search
     6        for insecure functions. Neither of these has risk of buffer overruns since they calculate the buffer size
     7        for you and use vsnprintf.
     8
     9        * bindings/js/kjs_window.cpp:
     10        (KJS::Window::isSafeScript):
     11        * css/cssparser.cpp:
     12        (WebCore::CSSParser::parseColorFromValue):
     13        * dom/StyledElement.cpp:
     14        (WebCore::StyledElement::addCSSColor):
     15        * dom/XMLTokenizer.cpp:
     16        (WebCore::XMLTokenizer::handleError):
     17        * ksvg2/css/SVGCSSParser.cpp:
     18        (WebCore::CSSParser::parseSVGPaint):
     19        (WebCore::CSSParser::parseSVGColor):
     20        * ksvg2/svg/SVGPathSegArc.h:
     21        (WebCore::SVGPathSegArcAbs::toString):
     22        (WebCore::SVGPathSegArcRel::toString):
     23        * ksvg2/svg/SVGPathSegCurvetoCubic.h:
     24        (WebCore::SVGPathSegCurvetoCubicAbs::toString):
     25        (WebCore::SVGPathSegCurvetoCubicRel::toString):
     26        * ksvg2/svg/SVGPathSegCurvetoCubicSmooth.h:
     27        (WebCore::SVGPathSegCurvetoCubicSmoothAbs::toString):
     28        (WebCore::SVGPathSegCurvetoCubicSmoothRel::toString):
     29        * ksvg2/svg/SVGPathSegCurvetoQuadratic.h:
     30        (WebCore::SVGPathSegCurvetoQuadraticAbs::toString):
     31        (WebCore::SVGPathSegCurvetoQuadraticRel::toString):
     32        * ksvg2/svg/SVGPathSegCurvetoQuadraticSmooth.h:
     33        (WebCore::SVGPathSegCurvetoQuadraticSmoothAbs::toString):
     34        (WebCore::SVGPathSegCurvetoQuadraticSmoothRel::toString):
     35        * ksvg2/svg/SVGPathSegLineto.h:
     36        (WebCore::SVGPathSegLinetoAbs::toString):
     37        (WebCore::SVGPathSegLinetoRel::toString):
     38        * ksvg2/svg/SVGPathSegLinetoHorizontal.h:
     39        (WebCore::SVGPathSegLinetoHorizontalAbs::toString):
     40        (WebCore::SVGPathSegLinetoHorizontalRel::toString):
     41        * ksvg2/svg/SVGPathSegLinetoVertical.h:
     42        (WebCore::SVGPathSegLinetoVerticalAbs::toString):
     43        (WebCore::SVGPathSegLinetoVerticalRel::toString):
     44        * ksvg2/svg/SVGPathSegMoveto.h:
     45        (WebCore::SVGPathSegMovetoAbs::toString):
     46        (WebCore::SVGPathSegMovetoRel::toString):
     47        * ksvg2/svg/SVGPolyElement.cpp:
     48        (WebCore::SVGPolyElement::notifyAttributeChange):
     49        * ksvg2/svg/SVGUseElement.cpp:
     50        (WebCore::SVGUseElement::closeRenderer):
     51        * loader/icon/IconDatabase.cpp:
     52        (WebCore::IconDatabase::forgetIconForIconURLFromDatabase):
     53        * loader/icon/SQLDatabase.cpp:
     54        (WebCore::SQLDatabase::setSynchronous):
     55        * platform/Color.cpp:
     56        (WebCore::Color::name):
     57        * platform/DeprecatedString.cpp:
     58        (WebCore::DeprecatedString::setNum):
     59        (WebCore::DeprecatedString::format):
     60        * platform/DeprecatedString.h:
     61        * platform/PlatformString.h:
     62        * platform/String.cpp:
     63        (WebCore::String::format):
     64        (WebCore::String::number):
     65        * platform/mac/KeyEventMac.mm:
     66        (WebCore::keyIdentifierForKeyEvent):
     67        * platform/win/KeyEventWin.cpp:
     68        (WebCore::keyIdentifierForWindowsKeyCode):
     69        * rendering/RenderListMarker.cpp:
     70        (WebCore::RenderListMarker::calcMinMaxWidth):
     71
    1722006-11-09  Maciej Stachowiak  <mjs@apple.com>
    273
  • trunk/WebCore/bindings/js/kjs_window.cpp

    r17678 r17700  
    12141214             targetDocument->URL().latin1(), originDocument->URL().latin1());
    12151215    }
    1216     String message = String::sprintf("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n",
     1216    String message = String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n",
    12171217                  targetDocument->URL().latin1(), originDocument->URL().latin1());
    12181218    targetFrame->addMessageToConsole(message, 1, String()); //fixme: provide a real line number and sourceurl
     
    12741274             thisDocument->URL().latin1(), actDocument->URL().latin1());
    12751275  }
    1276   String message = String::sprintf("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n",
     1276  String message = String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n",
    12771277                  thisDocument->URL().latin1(), actDocument->URL().latin1());
    12781278  m_frame->addMessageToConsole(message, 1, String());
  • trunk/WebCore/css/cssparser.cpp

    r17652 r17700  
    24402440        value->fValue >= 0. && value->fValue < 1000000.) {
    24412441        DeprecatedString str;
    2442         str.sprintf("%06d", (int)(value->fValue+.5));
     2442        str.format("%06d", (int)(value->fValue+.5));
    24432443        if (!CSSParser::parseColor(str, c))
    24442444            return 0;
  • trunk/WebCore/dom/StyledElement.cpp

    r14433 r17700  
    385385            // assert(colors[0] < 0x100 && colors[1] < 0x100 && colors[2] < 0x100);
    386386           
    387             color = String::sprintf("#%02x%02x%02x", colors[0], colors[1], colors[2]);
     387            color = String::format("#%02x%02x%02x", colors[0], colors[1], colors[2]);
    388388            if (attr->decl()->setProperty(id, color, false))
    389389                return;
  • trunk/WebCore/dom/XMLTokenizer.cpp

    r17652 r17700  
    903903        switch (type) {
    904904            case warning:
    905                 m_errorMessages += String::sprintf("warning on line %d at column %d: %s", lineNumber, columnNumber, m);
     905                m_errorMessages += String::format("warning on line %d at column %d: %s", lineNumber, columnNumber, m);
    906906                break;
    907907            case fatal:
    908908            case nonFatal:
    909                 m_errorMessages += String::sprintf("error on line %d at column %d: %s", lineNumber, columnNumber, m);
     909                m_errorMessages += String::format("error on line %d at column %d: %s", lineNumber, columnNumber, m);
    910910        }
    911911       
  • trunk/WebCore/ksvg2/css/SVGCSSParser.cpp

    r17597 r17700  
    352352    if (!strict && value->unit == CSSPrimitiveValue::CSS_NUMBER &&
    353353       value->fValue >= 0. && value->fValue < 1000000.) {
    354         String str = String::sprintf("%06d", (int)(value->fValue+.5));
     354        String str = String::format("%06d", (int)(value->fValue+.5));
    355355        return new SVGPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, String(), str);
    356356    } else if (value->unit == CSSPrimitiveValue::CSS_RGBCOLOR) {
     
    385385        b = max(0, min(255, b));
    386386       
    387         return new SVGPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, String(), String::sprintf("rgb(%d, %d, %d)", r, g, b).impl());
     387        return new SVGPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, String(), String::format("rgb(%d, %d, %d)", r, g, b).impl());
    388388    }
    389389    else
     
    397397    Value* value = valueList->current();
    398398    if (!strict && value->unit == CSSPrimitiveValue::CSS_NUMBER && value->fValue >= 0. && value->fValue < 1000000.)
    399         return new SVGColor(String::sprintf("%06d", (int)(value->fValue+.5)).impl());
     399        return new SVGColor(String::format("%06d", (int)(value->fValue+.5)).impl());
    400400    else if (value->unit == CSSPrimitiveValue::CSS_RGBCOLOR) {
    401401        String str = "#" + domString(value->string);
     
    427427        b = max(0, min(255, b));
    428428       
    429         return new SVGColor(String::sprintf("rgb(%d, %d, %d)", r, g, b).impl());
     429        return new SVGColor(String::format("rgb(%d, %d, %d)", r, g, b).impl());
    430430    }
    431431    else
  • trunk/WebCore/ksvg2/svg/SVGPathSegArc.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_ARC_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "A"; }
    39         virtual String toString() const { return String::sprintf("A %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y); }
     39        virtual String toString() const { return String::format("A %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y); }
    4040
    4141        void setX(double x);
     
    7979        virtual unsigned short pathSegType() const { return PATHSEG_ARC_REL; }
    8080        virtual String pathSegTypeAsLetter() const { return "a"; }
    81         virtual String toString() const { return String::sprintf("a %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y); }
     81        virtual String toString() const { return String::format("a %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y); }
    8282
    8383        void setX(double x);
  • trunk/WebCore/ksvg2/svg/SVGPathSegCurvetoCubic.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "C"; }
    39         virtual String toString() const { return String::sprintf("C %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y); }
     39        virtual String toString() const { return String::format("C %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y); }
    4040
    4141        void setX(double);
     
    7474        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_REL; }
    7575        virtual String pathSegTypeAsLetter() const { return "c"; }
    76         virtual String toString() const { return String::sprintf("c %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y); }
     76        virtual String toString() const { return String::format("c %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y); }
    7777
    7878        void setX(double);
  • trunk/WebCore/ksvg2/svg/SVGPathSegCurvetoCubicSmooth.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "S"; }
    39         virtual String toString() const { return String::sprintf("S %.6lg %.6lg %.6lg %.6lg", m_x2, m_y2, m_x, m_y); }
     39        virtual String toString() const { return String::format("S %.6lg %.6lg %.6lg %.6lg", m_x2, m_y2, m_x, m_y); }
    4040
    4141        void setX(double);
     
    6666        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_REL; }
    6767        virtual String pathSegTypeAsLetter() const { return "s"; }
    68         virtual String toString() const { return String::sprintf("s %.6lg %.6lg %.6lg %.6lg", m_x2, m_y2, m_x, m_y); }
     68        virtual String toString() const { return String::format("s %.6lg %.6lg %.6lg %.6lg", m_x2, m_y2, m_x, m_y); }
    6969
    7070        void setX(double);
  • trunk/WebCore/ksvg2/svg/SVGPathSegCurvetoQuadratic.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "Q"; }
    39         virtual String toString() const { return String::sprintf("Q %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x, m_y); }
     39        virtual String toString() const { return String::format("Q %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x, m_y); }
    4040
    4141        void setX(double);
     
    6666        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_REL; }
    6767        virtual String pathSegTypeAsLetter() const { return "q"; }
    68         virtual String toString() const { return String::sprintf("q %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x, m_y); }
     68        virtual String toString() const { return String::format("q %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x, m_y); }
    6969 
    7070        void setX(double);
  • trunk/WebCore/ksvg2/svg/SVGPathSegCurvetoQuadraticSmooth.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "T"; }
    39         virtual String toString() const { return String::sprintf("T %.6lg %.6lg", m_x, m_y); }
     39        virtual String toString() const { return String::format("T %.6lg %.6lg", m_x, m_y); }
    4040
    4141        void setX(double);
     
    5858        virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL; }
    5959        virtual String pathSegTypeAsLetter() const { return "t"; }
    60         virtual String toString() const { return String::sprintf("t %.6lg %.6lg", m_x, m_y); }
     60        virtual String toString() const { return String::format("t %.6lg %.6lg", m_x, m_y); }
    6161
    6262        void setX(double);
  • trunk/WebCore/ksvg2/svg/SVGPathSegLineto.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_LINETO_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "L"; }
    39         virtual String toString() const { return String::sprintf("L %.6lg %.6lg", m_x, m_y); }
     39        virtual String toString() const { return String::format("L %.6lg %.6lg", m_x, m_y); }
    4040
    4141        void setX(double);
     
    5858        virtual unsigned short pathSegType() const { return PATHSEG_LINETO_REL; }
    5959        virtual String pathSegTypeAsLetter() const { return "l"; }
    60         virtual String toString() const { return String::sprintf("l %.6lg %.6lg", m_x, m_y); }
     60        virtual String toString() const { return String::format("l %.6lg %.6lg", m_x, m_y); }
    6161
    6262        void setX(double);
  • trunk/WebCore/ksvg2/svg/SVGPathSegLinetoHorizontal.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_LINETO_HORIZONTAL_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "H"; }
    39         virtual String toString() const { return String::sprintf("H %.6lg", m_x); }
     39        virtual String toString() const { return String::format("H %.6lg", m_x); }
    4040
    4141        void setX(double);
     
    5454        virtual unsigned short pathSegType() const { return PATHSEG_LINETO_HORIZONTAL_REL; }
    5555        virtual String pathSegTypeAsLetter() const { return "h"; }
    56         virtual String toString() const { return String::sprintf("h %.6lg", m_x); }
     56        virtual String toString() const { return String::format("h %.6lg", m_x); }
    5757
    5858        void setX(double);
  • trunk/WebCore/ksvg2/svg/SVGPathSegLinetoVertical.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_LINETO_VERTICAL_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "V"; }
    39         virtual String toString() const { return String::sprintf("V %.6lg", m_y); }
     39        virtual String toString() const { return String::format("V %.6lg", m_y); }
    4040
    4141        void setY(double);
     
    5454        virtual unsigned short pathSegType() const { return PATHSEG_LINETO_VERTICAL_REL; }
    5555        virtual String pathSegTypeAsLetter() const { return "v"; }
    56         virtual String toString() const { return String::sprintf("v %.6lg", m_y); }
     56        virtual String toString() const { return String::format("v %.6lg", m_y); }
    5757
    5858        void setY(double);
  • trunk/WebCore/ksvg2/svg/SVGPathSegMoveto.h

    r16920 r17700  
    3737        virtual unsigned short pathSegType() const { return PATHSEG_MOVETO_ABS; }
    3838        virtual String pathSegTypeAsLetter() const { return "M"; }
    39         virtual String toString() const { return String::sprintf("M %.6lg %.6lg", m_x, m_y); }
     39        virtual String toString() const { return String::format("M %.6lg %.6lg", m_x, m_y); }
    4040
    4141        void setX(double);
     
    5858        virtual unsigned short pathSegType() const { return PATHSEG_MOVETO_REL; }
    5959        virtual String pathSegTypeAsLetter() const { return "m"; }
    60         virtual String toString() const { return String::sprintf("m %.6lg %.6lg", m_x, m_y); }
     60        virtual String toString() const { return String::format("m %.6lg %.6lg", m_x, m_y); }
    6161
    6262        void setX(double);
  • trunk/WebCore/ksvg2/svg/SVGPolyElement.cpp

    r16918 r17700  
    9393    for (int i = 0; i < len; ++i) {
    9494        FloatPoint p = points()->getItem(i, ec);
    95         _points += String::sprintf("%.6lg %.6lg ", p.x(), p.y());
     95        _points += String::format("%.6lg %.6lg ", p.x(), p.y());
    9696    }
    9797
  • trunk/WebCore/ksvg2/svg/SVGUseElement.cpp

    r17027 r17700  
    101101   
    102102    ExceptionCode ec = 0;
    103     String trans = String::sprintf("translate(%f, %f)", _x, _y);
     103    String trans = String::format("translate(%f, %f)", _x, _y);
    104104    if (target->hasTagName(SVGNames::symbolTag)) {
    105105        RefPtr<SVGElement> dummy = new SVGSVGElement(SVGNames::svgTag, document());
  • trunk/WebCore/loader/icon/IconDatabase.cpp

    r17636 r17700  
    611611    }
    612612   
    613     if (!m_currentDB->executeCommand(String::sprintf("DELETE FROM Icon WHERE Icon.iconID = %lli;", iconID)))
     613    if (!m_currentDB->executeCommand(String::format("DELETE FROM Icon WHERE Icon.iconID = %lli;", iconID)))
    614614        LOG_ERROR("Unable to drop Icon for IconURL", iconURL.ascii().data());
    615     if (!m_currentDB->executeCommand(String::sprintf("DELETE FROM PageURL WHERE PageURL.iconID = %lli", iconID)))
     615    if (!m_currentDB->executeCommand(String::format("DELETE FROM PageURL WHERE PageURL.iconID = %lli", iconID)))
    616616        LOG_ERROR("Unable to drop all PageURL for IconURL", iconURL.ascii().data());
    617617}
  • trunk/WebCore/loader/icon/SQLDatabase.cpp

    r16189 r17700  
    8585void SQLDatabase::setSynchronous(SynchronousPragma sync)
    8686{
    87     executeCommand(String::sprintf("PRAGMA synchronous = %i", sync));
     87    executeCommand(String::format("PRAGMA synchronous = %i", sync));
    8888}
    8989
  • trunk/WebCore/platform/Color.cpp

    r15774 r17700  
    144144{
    145145    if (alpha() < 0xFF)
    146         return String::sprintf("#%02X%02X%02X%02X", red(), green(), blue(), alpha());
    147     return String::sprintf("#%02X%02X%02X", red(), green(), blue());
     146        return String::format("#%02X%02X%02X%02X", red(), green(), blue(), alpha());
     147    return String::format("#%02X%02X%02X", red(), green(), blue());
    148148}
    149149
  • trunk/WebCore/platform/DeprecatedString.cpp

    r16245 r17700  
    17371737DeprecatedString &DeprecatedString::setNum(short n)
    17381738{
    1739     return sprintf("%d", n);
     1739    return format("%d", n);
    17401740}
    17411741
    17421742DeprecatedString &DeprecatedString::setNum(unsigned short n)
    17431743{
    1744     return sprintf("%u", n);
     1744    return format("%u", n);
    17451745}
    17461746
    17471747DeprecatedString &DeprecatedString::setNum(int n)
    17481748{
    1749     return sprintf("%d", n);
     1749    return format("%d", n);
    17501750}
    17511751
    17521752DeprecatedString &DeprecatedString::setNum(unsigned n)
    17531753{
    1754     return sprintf("%u", n);
     1754    return format("%u", n);
    17551755}
    17561756
    17571757DeprecatedString &DeprecatedString::setNum(long n)
    17581758{
    1759     return sprintf("%ld", n);
     1759    return format("%ld", n);
    17601760}
    17611761
    17621762DeprecatedString &DeprecatedString::setNum(unsigned long n)
    17631763{
    1764     return sprintf("%lu", n);
     1764    return format("%lu", n);
    17651765}
    17661766
    17671767DeprecatedString &DeprecatedString::setNum(double n)
    17681768{
    1769     return sprintf("%.6lg", n);
    1770 }
    1771 
    1772 DeprecatedString &DeprecatedString::sprintf(const char *format, ...)
    1773 {
     1769    return format("%.6lg", n);
     1770}
     1771
     1772DeprecatedString &DeprecatedString::format(const char *format, ...)
     1773{
     1774    // FIXME: this needs the same windows compat fixes as String::format
     1775
    17741776    va_list args;
    17751777    va_start(args, format);
  • trunk/WebCore/platform/DeprecatedString.h

    r17427 r17700  
    349349    DeprecatedString &setNum(double);
    350350
    351     DeprecatedString &sprintf(const char *, ...)
     351    DeprecatedString& format(const char *, ...)
    352352#if __GNUC__
    353353    __attribute__ ((format (printf, 2, 3)))
  • trunk/WebCore/platform/PlatformString.h

    r17422 r17700  
    128128    static String number(double);
    129129   
    130     static String sprintf(const char *, ...)
     130    static String format(const char *, ...)
    131131#if __GNUC__
    132132        __attribute__ ((format (printf, 1, 2)))
  • trunk/WebCore/platform/String.cpp

    r16721 r17700  
    269269}
    270270
    271 String String::sprintf(const char *format, ...)
     271String String::format(const char *format, ...)
    272272{
    273273    va_list args;
     
    313313String String::number(int n)
    314314{
    315     return String::sprintf("%d", n);
     315    return String::format("%d", n);
    316316}
    317317
    318318String String::number(unsigned n)
    319319{
    320     return String::sprintf("%u", n);
     320    return String::format("%u", n);
    321321}
    322322
    323323String String::number(long n)
    324324{
    325     return String::sprintf("%ld", n);
     325    return String::format("%ld", n);
    326326}
    327327
    328328String String::number(unsigned long n)
    329329{
    330     return String::sprintf("%lu", n);
     330    return String::format("%lu", n);
    331331}
    332332
     
    334334{
    335335#if PLATFORM(WIN_OS)
    336     return String::sprintf("%I64i", n);
     336    return String::format("%I64i", n);
    337337#else
    338     return String::sprintf("%lli", n);
     338    return String::format("%lli", n);
    339339#endif
    340340}
     
    343343{
    344344#if PLATFORM(WIN_OS)
    345     return String::sprintf("%I64u", n);
     345    return String::format("%I64u", n);
    346346#else
    347     return String::sprintf("%llu", n);
     347    return String::format("%llu", n);
    348348#endif
    349349}
     
    351351String String::number(double n)
    352352{
    353     return String::sprintf("%.6lg", n);
     353    return String::format("%.6lg", n);
    354354}
    355355
  • trunk/WebCore/platform/mac/KeyEventMac.mm

    r17124 r17700  
    323323            // For now, just fall through to the default.
    324324        default:
    325             return String::sprintf("U+%06X", toupper(c));
     325            return String::format("U+%06X", toupper(c));
    326326    }
    327327}
  • trunk/WebCore/platform/win/KeyEventWin.cpp

    r17154 r17700  
    131131            return "U+00007F";
    132132        default:
    133             return String::sprintf("U+%06X", toupper(keyCode));
     133            return String::format("U+%06X", toupper(keyCode));
    134134    }
    135135}
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r17521 r17700  
    306306        // ### unsupported, we use decimal instead
    307307    case LDECIMAL:
    308         m_item.sprintf("%d", m_listItem->value());
     308        m_item.format("%d", m_listItem->value());
    309309        break;
    310310    case LOWER_ROMAN:
  • trunk/WebCore/rendering/RenderTreeAsText.cpp

    r17604 r17700  
    245245                DeprecatedString hex;
    246246                unsigned u = c;
    247                 hex.sprintf("\\x{%X}", u);
     247                hex.format("\\x{%X}", u);
    248248                result += hex;
    249249            }
Note: See TracChangeset for help on using the changeset viewer.