MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / util_GetEscapeValueOfChar

Function util_GetEscapeValueOfChar

src/twparser/parserhelper.cpp:964–1014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

962}
963
964int util_GetEscapeValueOfChar(char ch)
965{
966 int iValue = -1;
967
968 switch (ch)
969 {
970 case 'n':
971 iValue = 10;
972 break;
973 case 't':
974 iValue = 9;
975 break;
976 case 'v':
977 iValue = 11;
978 break;
979 case 'b':
980 iValue = 8;
981 break;
982 case 'r':
983 iValue = 13;
984 break;
985 case 'f':
986 iValue = 12;
987 break;
988 case 'a':
989 iValue = 7;
990 break;
991 case '\\':
992 iValue = 92;
993 break;
994 case '\?':
995 iValue = 63;
996 break;
997 case '\'':
998 iValue = 39;
999 break;
1000 case '\"':
1001 iValue = 34;
1002 break;
1003 default:
1004 {
1005 // unrecognized escape char: just return character
1006 iValue = static_cast<int>(ch);
1007 }
1008 break;
1009 }
1010
1011 ASSERT(iValue != -1); //should have *some* value at this point
1012
1013 return (iValue);
1014}
1015
1016
1017// -1 means recurse all levels

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected