| 1251 | |
| 1252 | |
| 1253 | static bool allSpaces(CharSet* charSet, const BYTE* ptr, ULONG len, ULONG offset) |
| 1254 | { |
| 1255 | /************************************** |
| 1256 | * |
| 1257 | * a l l _ s p a c e s |
| 1258 | * |
| 1259 | ************************************** |
| 1260 | * |
| 1261 | * Functional description |
| 1262 | * determine if the string at ptr[offset] ... ptr[len] is entirely |
| 1263 | * spaces, as per the space definition of (charset). |
| 1264 | * The binary representation of a Space is character-set dependent. |
| 1265 | * (0x20 for Ascii, 0x0020 for Unicode, 0x20 for SJIS, but must watch for |
| 1266 | * 0x??20, which is NOT a space. |
| 1267 | **************************************/ |
| 1268 | fb_assert(ptr != NULL); |
| 1269 | |
| 1270 | // We are assuming offset points to the first byte which was not |
| 1271 | // consumed in a conversion. And that offset is pointing |
| 1272 | // to a character boundary |
| 1273 | |
| 1274 | // Single-octet character sets are optimized here |
| 1275 | |
| 1276 | if (charSet->getSpaceLength() == 1) |
| 1277 | { |
| 1278 | const BYTE* p = &ptr[offset]; |
| 1279 | const BYTE* const end = &ptr[len]; |
| 1280 | while (p < end) |
| 1281 | { |
| 1282 | if (*p++ != *charSet->getSpace()) |
| 1283 | return false; |
| 1284 | } |
| 1285 | } |
| 1286 | else |
| 1287 | { |
| 1288 | const BYTE* p = &ptr[offset]; |
| 1289 | const BYTE* const end = &ptr[len]; |
| 1290 | const unsigned char* space = charSet->getSpace(); |
| 1291 | const unsigned char* const end_space = &space[charSet->getSpaceLength()]; |
| 1292 | while (p < end) |
| 1293 | { |
| 1294 | space = charSet->getSpace(); |
| 1295 | while (p < end && space < end_space) |
| 1296 | { |
| 1297 | if (*p++ != *space++) |
| 1298 | return false; |
| 1299 | } |
| 1300 | } |
| 1301 | } |
| 1302 | |
| 1303 | return true; |
| 1304 | } |
| 1305 | |
| 1306 | |
| 1307 | static int blocking_ast_collation(void* ast_object) |
no test coverage detected