Decodes the given URI and writes it to `outPath`. The caller must ensure that the given URI is not malformed (typically with a prior call to `TryUriDecodeLen`). This function does not write any trailing null character.
| 985 | // not malformed (typically with a prior call to `TryUriDecodeLen`). This function does not write |
| 986 | // any trailing null character. |
| 987 | char* UriDecodeUnchecked(const char* fileUri, const char* fileUriEnd, char* outPath) { |
| 988 | while (fileUri != fileUriEnd) { |
| 989 | if (*fileUri != '%') { |
| 990 | *outPath++ = *fileUri++; |
| 991 | } else { |
| 992 | ++fileUri; |
| 993 | const char high_nibble = ParseHexUnchecked(*fileUri++); |
| 994 | const char low_nibble = ParseHexUnchecked(*fileUri++); |
| 995 | *outPath++ = (high_nibble << 4) | low_nibble; |
| 996 | } |
| 997 | } |
| 998 | return outPath; |
| 999 | } |
| 1000 | |
| 1001 | constexpr const char FILE_URI_PREFIX[] = "file://"; |
| 1002 | constexpr size_t FILE_URI_PREFIX_LEN = sizeof(FILE_URI_PREFIX) - 1; |
no test coverage detected