- switch (cpx_query_type) {
- case SQ_CPX_TYPE_ARRAY: {
- sl_array_t *sl_arrary = talloc_zero(query, sl_array_t);
- EC_NEG1_LOG( offset = spotlight_dissect_loop(sl_arrary, buf, offset + 8, cpx_query_count, toc_offset, encoding) );
- dalloc_add(query, sl_arrary, sl_array_t);
- break;
- }
-
- case SQ_CPX_TYPE_DICT: {
- sl_dict_t *sl_dict = talloc_zero(query, sl_dict_t);
- EC_NEG1_LOG( offset = spotlight_dissect_loop(sl_dict, buf, offset + 8, cpx_query_count, toc_offset, encoding) );
- dalloc_add(query, sl_dict, sl_dict_t);
- break;
- }
- case SQ_CPX_TYPE_STRING:
- query_data64 = sl_unpack_uint64(buf, offset + 8, encoding);
- query_length += (query_data64 & 0xffff) * 8;
- if ((padding = 8 - (query_data64 >> 32)) < 0)
- EC_FAIL;
- if ((slen = query_length - 16 - padding) < 1)
- EC_FAIL;
- p = talloc_strndup(query, buf + offset + 16, slen);
- dalloc_add(query, &p, char *);
- break;
-
- case SQ_CPX_TYPE_UTF16_STRING:
- query_data64 = sl_unpack_uint64(buf, offset + 8, encoding);
- query_length += (query_data64 & 0xffff) * 8;
- if ((padding = 8 - (query_data64 >> 32)) < 0)
- EC_FAIL;
- if ((slen = query_length - 16 - padding) < 1)
- EC_FAIL;
-
- unicode_encoding = spotlight_get_utf16_string_encoding(buf, offset + 16, slen, encoding);
- mark_exists = (unicode_encoding & SL_ENC_UTF_16);
- unicode_encoding &= ~SL_ENC_UTF_16;
-
- EC_NEG1( convert_string_allocate(CH_UCS2, CH_UTF8, buf + offset + (mark_exists ? 18 : 16), slen, &p) );
- dalloc_add(query, &p, char *);
- break;
-
- case SQ_CPX_TYPE_FILEMETA:
- query_data64 = sl_unpack_uint64(buf, offset + 8, encoding);
- query_length += (query_data64 & 0xffff) * 8;
-
- if (query_length <= 8) {
- EC_FAIL_LOG("SQ_CPX_TYPE_FILEMETA: query_length <= 8%s", "");
- } else {
- EC_NEG1_LOG( sl_unpack(query, buf + offset + 16) );
- }
- break;
-
- case SQ_CPX_TYPE_CNIDS:
- query_data64 = sl_unpack_uint64(buf, offset + 8, encoding);
- query_length += (query_data64 & 0xffff) * 8;
- EC_NEG1_LOG( sl_unpack_CNID(query, buf, offset + 16, query_length, encoding) );
- break;
- } /* switch (cpx_query_type) */
-