Changeset 5966 in vbox
- Timestamp:
- Dec 5, 2007 4:10:11 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/STAM.cpp
r5275 r5966 877 877 878 878 if (pThis->fWithDesc && pDesc->pszDesc) 879 return stamR3SnapshotPrintf(pThis, " desc=\"%s\"/>\n", pDesc->pszDesc); 879 { 880 /* 881 * The description is a bit tricky as it may include chars that 882 * xml requires to be escaped. 883 */ 884 const char *pszBadChar = strpbrk(pDesc->pszDesc, "&<>\"'"); 885 if (!pszBadChar) 886 return stamR3SnapshotPrintf(pThis, " desc=\"%s\"/>\n", pDesc->pszDesc); 887 888 stamR3SnapshotPrintf(pThis, " desc=\""); 889 const char *pszCur = pDesc->pszDesc; 890 do 891 { 892 stamR3SnapshotPrintf(pThis, "%.*s", pszBadChar - pszCur, pszCur); 893 switch (*pszBadChar) 894 { 895 case '&': stamR3SnapshotPrintf(pThis, "&"); break; 896 case '<': stamR3SnapshotPrintf(pThis, "<"); break; 897 case '>': stamR3SnapshotPrintf(pThis, ">"); break; 898 case '"': stamR3SnapshotPrintf(pThis, """); break; 899 case '\'': stamR3SnapshotPrintf(pThis, "'"); break; 900 default: AssertMsgFailed(("%c", *pszBadChar)); break; 901 } 902 pszCur = pszBadChar + 1; 903 pszBadChar = strpbrk(pszCur, "&<>\"'"); 904 } while (pszBadChar); 905 return stamR3SnapshotPrintf(pThis, "%s\"/>\n", pszCur); 906 } 880 907 return stamR3SnapshotPrintf(pThis, "/>\n"); 881 908 }
Note:
See TracChangeset
for help on using the changeset viewer.