* Convert C style \a, \b, \f, \n, \r, \t, \v, \xhh and \uhhhh into their indicated characters. */
| 1911 | * Convert C style \a, \b, \f, \n, \r, \t, \v, \xhh and \uhhhh into their indicated characters. |
| 1912 | */ |
| 1913 | unsigned int UnSlash ( char *s, UINT cpEdit ) |
| 1914 | { |
| 1915 | char *sStart = s; |
| 1916 | char *o = s; |
| 1917 | while ( *s ) { |
| 1918 | if ( *s == '\\' ) { |
| 1919 | s++; |
| 1920 | if ( *s == 'a' ) { |
| 1921 | *o = '\a'; |
| 1922 | } else if ( *s == 'b' ) { |
| 1923 | *o = '\b'; |
| 1924 | } else if ( *s == 'f' ) { |
| 1925 | *o = '\f'; |
| 1926 | } else if ( *s == 'n' ) { |
| 1927 | *o = '\n'; |
| 1928 | } else if ( *s == 'r' ) { |
| 1929 | *o = '\r'; |
| 1930 | } else if ( *s == 't' ) { |
| 1931 | *o = '\t'; |
| 1932 | } else if ( *s == 'v' ) { |
| 1933 | *o = '\v'; |
| 1934 | } else if ( *s == 'x' || *s == 'u' ) { |
| 1935 | BOOL bShort = ( *s == 'x' ); |
| 1936 | char ch[8]; |
| 1937 | char *pch = ch; |
| 1938 | WCHAR val[2] = L""; |
| 1939 | int hex; |
| 1940 | val[0] = 0; |
| 1941 | hex = GetHexDigit ( * ( s + 1 ) ); |
| 1942 | if ( hex >= 0 ) { |
| 1943 | s++; |
| 1944 | val[0] = hex; |
| 1945 | hex = GetHexDigit ( * ( s + 1 ) ); |
| 1946 | if ( hex >= 0 ) { |
| 1947 | s++; |
| 1948 | val[0] *= 16; |
| 1949 | val[0] += hex; |
| 1950 | if ( !bShort ) { |
| 1951 | hex = GetHexDigit ( * ( s + 1 ) ); |
| 1952 | if ( hex >= 0 ) { |
| 1953 | s++; |
| 1954 | val[0] *= 16; |
| 1955 | val[0] += hex; |
| 1956 | hex = GetHexDigit ( * ( s + 1 ) ); |
| 1957 | if ( hex >= 0 ) { |
| 1958 | s++; |
| 1959 | val[0] *= 16; |
| 1960 | val[0] += hex; |
| 1961 | } |
| 1962 | } |
| 1963 | } |
| 1964 | } |
| 1965 | if ( val[0] ) { |
| 1966 | val[1] = 0; |
| 1967 | WideCharToMultiByte ( cpEdit, 0, val, -1, ch, COUNTOF ( ch ), NULL, NULL ); |
| 1968 | *o = *pch++; |
| 1969 | while ( *pch ) { |
| 1970 | *++o = *pch++; |
no test coverage detected