MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / escapeAttribute

Method escapeAttribute

src/common/IntlUtil.cpp:707–739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705
706
707string IntlUtil::escapeAttribute(Jrd::CharSet* cs, const string& s)
708{
709 string ret;
710 const UCHAR* p = (const UCHAR*)s.begin();
711 const UCHAR* end = (const UCHAR*)s.end();
712 ULONG size = 0;
713
714 while (readOneChar(cs, &p, end, &size))
715 {
716 ULONG l;
717 UCHAR* uc = (UCHAR*)(&l);
718
719 const ULONG uSize = cs->getConvToUnicode().convert(size, p, sizeof(l), uc);
720
721 if (uSize == 2)
722 {
723 if (*(USHORT*) uc == '\\' || *(USHORT*) uc == '=' || *(USHORT*) uc == ';')
724 {
725 *(USHORT*) uc = '\\';
726 UCHAR bytes[sizeof(ULONG)];
727
728 ULONG bytesSize = cs->getConvFromUnicode().convert(
729 sizeof(USHORT), uc, sizeof(bytes), bytes);
730
731 ret.append(string((const char*)bytes, bytesSize));
732 }
733 }
734
735 ret.append(string((const char*)p, size));
736 }
737
738 return ret;
739}
740
741
742string IntlUtil::unescapeAttribute(Jrd::CharSet* cs, const string& s)

Callers

nothing calls this directly

Calls 6

getConvToUnicodeMethod · 0.80
getConvFromUnicodeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
convertMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected