Changeset 27191 in webkit for trunk/JavaScriptCore/kjs/function.cpp
- Timestamp:
- Oct 28, 2007, 3:50:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r27178 r27191 890 890 } 891 891 892 UString escapeStringForPrettyPrinting(const UString& s)893 {894 UString escapedString;895 896 for (int i = 0; i < s.size(); i++) {897 unsigned short c = s.data()[i].unicode();898 899 switch (c) {900 case '\"':901 escapedString += "\\\"";902 break;903 case '\n':904 escapedString += "\\n";905 break;906 case '\r':907 escapedString += "\\r";908 break;909 case '\t':910 escapedString += "\\t";911 break;912 case '\\':913 escapedString += "\\\\";914 break;915 default:916 if (c < 128 && isPrintableChar(c))917 escapedString.append(c);918 else {919 char hexValue[7];920 921 #if PLATFORM(WIN_OS)922 _snprintf(hexValue, 7, "\\u%04x", c);923 #else924 snprintf(hexValue, 7, "\\u%04x", c);925 #endif926 escapedString += hexValue;927 }928 }929 }930 931 return escapedString;932 }933 934 892 } // namespace
Note:
See TracChangeset
for help on using the changeset viewer.