Changeset 27737 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Mar 26, 2010 1:12:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strformatrt.cpp
r27652 r27737 1051 1051 case 's': 1052 1052 { 1053 static const char s_sz AttrEscape[] = "\n\""; /* more? */1054 static const char s_sz ElemEscape[] = "<>&'\"";1055 const char * pszEscape = fAttr ? s_szAttrEscape: s_szElemEscape;1056 size_t cchEscape = fAttr ? RT_ELEMENTS(s_szAttrEscape) - 1 : RT_ELEMENTS(s_szElemEscape) - 1;1053 static const char s_szElemEscape[] = "<>&\"'"; 1054 static const char s_szAttrEscape[] = "<>&\"\n\r"; /* more? */ 1055 const char * const pszEscape = fAttr ? s_szAttrEscape : s_szElemEscape; 1056 size_t const cchEscape = (fAttr ? RT_ELEMENTS(s_szAttrEscape) : RT_ELEMENTS(s_szElemEscape)) - 1; 1057 1057 size_t cchOutput = 0; 1058 1058 const char *pszStr = va_arg(*pArgs, char *); … … 1078 1078 if (offLast < offCur) 1079 1079 cchOutput += pfnOutput(pvArgOutput, &pszStr[offLast], offCur - offLast); 1080 if (fAttr) 1081 switch (pszStr[offCur]) 1082 { 1083 case '\n': cchOutput += pfnOutput(pvArgOutput, "\\\n", 2); break; 1084 case '"': cchOutput += pfnOutput(pvArgOutput, "\\\"", 2); break; 1085 default: 1086 AssertFailed(); 1087 } 1088 else 1089 switch (pszStr[offCur]) 1090 { 1091 case '<': cchOutput += pfnOutput(pvArgOutput, "<", 4); break; 1092 case '>': cchOutput += pfnOutput(pvArgOutput, ">", 4); break; 1093 case '&': cchOutput += pfnOutput(pvArgOutput, "&", 5); break; 1094 case '\'': cchOutput += pfnOutput(pvArgOutput, "'", 6); break; 1095 case '"': cchOutput += pfnOutput(pvArgOutput, "&qout;", 6); break; 1096 default: 1097 AssertFailed(); 1098 } 1080 switch (pszStr[offCur]) 1081 { 1082 case '<': cchOutput += pfnOutput(pvArgOutput, "<", 4); break; 1083 case '>': cchOutput += pfnOutput(pvArgOutput, ">", 4); break; 1084 case '&': cchOutput += pfnOutput(pvArgOutput, "&", 5); break; 1085 case '\'': cchOutput += pfnOutput(pvArgOutput, "'", 6); break; 1086 case '"': cchOutput += pfnOutput(pvArgOutput, "&qout;", 6); break; 1087 case '\n': cchOutput += pfnOutput(pvArgOutput, "
", 5); break; 1088 case '\r': cchOutput += pfnOutput(pvArgOutput, "
", 5); break; 1089 default: 1090 AssertFailed(); 1091 } 1099 1092 offLast = offCur + 1; 1100 1093 }
Note:
See TracChangeset
for help on using the changeset viewer.