MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / UriDecodeUnchecked

Function UriDecodeUnchecked

extern/nfd/nfd_portal.cpp:987–999  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

985// not malformed (typically with a prior call to `TryUriDecodeLen`). This function does not write
986// any trailing null character.
987char* 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
1001constexpr const char FILE_URI_PREFIX[] = "file://";
1002constexpr size_t FILE_URI_PREFIX_LEN = sizeof(FILE_URI_PREFIX) - 1;

Callers 2

AllocAndCopyFilePathFunction · 0.85

Calls 1

ParseHexUncheckedFunction · 0.85

Tested by

no test coverage detected