MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / b32h_decode

Function b32h_decode

dds/DCPS/FileSystemStorage.cpp:902–927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900}
901
902ACE_TString b32h_decode(const ACE_TCHAR* encoded)
903{
904 // #before first '=' -> #output
905 static const size_t dec[] = {0, 0, 1, 0, 2, 3, 0, 4, 0};
906 ACE_TString decoded;
907
908 for (; *encoded; encoded += 8) {
909 ACE_UINT64 chunk = 0;
910 size_t i = 0;
911
912 for (; i < 8 && encoded[i] != ACE_TEXT('='); ++i) {
913 char idx = (encoded[i] <= ACE_TEXT('9'))
914 ? (encoded[i] - ACE_TEXT('0'))
915 : (10 + encoded[i] - ACE_TEXT('A'));
916 chunk |= static_cast<ACE_UINT64>(idx) << ((7 - i) * 5);
917 }
918
919 size_t limit = (encoded[i] == ACE_TEXT('=')) ? dec[i] : 5;
920
921 for (size_t j(0); j < limit; ++j) {
922 decoded += static_cast<ACE_TCHAR>(chunk >>((4 - j) * 8)) & 0xFF;
923 }
924 }
925
926 return decoded;
927}
928
929} // namespace FileSystemStorage
930} // namespace OpenDDS

Callers 2

scan_dirMethod · 0.85
encode_testFunction · 0.85

Calls

no outgoing calls

Tested by 1

encode_testFunction · 0.68