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

Method parseSpecificAttributes

src/common/IntlUtil.cpp:128–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126
127
128bool IntlUtil::parseSpecificAttributes(Jrd::CharSet* cs, ULONG len, const UCHAR* s,
129 SpecificAttributesMap* map)
130{
131 // Note that the map isn't cleared.
132 // Old attributes will be combined with the new ones.
133
134 const UCHAR* p = s;
135 const UCHAR* const end = s + len;
136 ULONG size = 0;
137
138 readAttributeChar(cs, &p, end, &size, true);
139
140 while (p < end)
141 {
142 while (p < end && size == cs->getSpaceLength() &&
143 memcmp(p, cs->getSpace(), cs->getSpaceLength()) == 0)
144 {
145 if (!readAttributeChar(cs, &p, end, &size, true))
146 return true;
147 }
148
149 const UCHAR* start = p;
150
151 UCHAR uc[sizeof(ULONG)];
152 ULONG uSize;
153
154 while (p < end)
155 {
156 uSize = cs->getConvToUnicode().convert(size, p, sizeof(uc), uc);
157
158 if (uSize == 2 &&
159 ((*(USHORT*) uc >= 'A' && *(USHORT*) uc <= 'Z') ||
160 (*(USHORT*) uc >= 'a' && *(USHORT*) uc <= 'z') ||
161 *(USHORT*) uc == '-' || *(USHORT*) uc == '_'))
162 {
163 if (!readAttributeChar(cs, &p, end, &size, true))
164 return false;
165 }
166 else
167 break;
168 }
169
170 if (p - start == 0)
171 return false;
172
173 string name((const char*) start, p - start);
174 name = unescapeAttribute(cs, name);
175
176 while (p < end && size == cs->getSpaceLength() &&
177 memcmp(p, cs->getSpace(), cs->getSpaceLength()) == 0)
178 {
179 if (!readAttributeChar(cs, &p, end, &size, true))
180 return false;
181 }
182
183 uSize = cs->getConvToUnicode().convert(size, p, sizeof(uc), uc);
184
185 if (uSize != 2 || *(USHORT*)uc != '=')

Callers

nothing calls this directly

Calls 7

getSpaceLengthMethod · 0.80
getConvToUnicodeMethod · 0.80
getSpaceMethod · 0.45
convertMethod · 0.45
isEmptyMethod · 0.45
removeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected