Lines Matching refs:sel

227 ucnvsel_close(UConverterSelector *sel) {
228 if (!sel) {
231 if (sel->ownEncodingStrings) {
232 uprv_free(sel->encodings[0]);
234 uprv_free(sel->encodings);
235 if (sel->ownPv) {
236 uprv_free(sel->pv);
238 utrie2_close(sel->trie);
239 uprv_free(sel->swapped);
240 uprv_free(sel);
280 ucnvsel_serialize(const UConverterSelector* sel,
295 int32_t serializedTrieSize = utrie2_serialize(sel->trie, NULL, 0, status);
310 sel->pvCount,
311 sel->encodingsCount,
312 sel->encodingStrLength
319 sel->pvCount * 4 +
320 sel->encodingStrLength;
336 utrie2_serialize(sel->trie, p, serializedTrieSize, status);
339 length = sel->pvCount * 4;
340 uprv_memcpy(p, sel->pv, length);
343 uprv_memcpy(p, sel->encodings[0], sel->encodingStrLength);
344 p += sel->encodingStrLength;
548 UConverterSelector* sel = (UConverterSelector*)uprv_malloc(sizeof(UConverterSelector));
552 if (sel == NULL || encodings == NULL) {
554 uprv_free(sel);
559 uprv_memset(sel, 0, sizeof(UConverterSelector));
560 sel->pvCount = indexes[UCNVSEL_INDEX_PV_COUNT];
561 sel->encodings = encodings;
562 sel->encodingsCount = indexes[UCNVSEL_INDEX_NAMES_COUNT];
563 sel->encodingStrLength = indexes[UCNVSEL_INDEX_NAMES_LENGTH];
564 sel->swapped = swapped;
566 sel->trie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS,
571 ucnvsel_close(sel);
575 sel->pv = (uint32_t *)p;
576 p += sel->pvCount * 4;
579 for (int32_t i = 0; i < sel->encodingsCount; ++i) {
580 sel->encodings[i] = s;
583 p += sel->encodingStrLength;
585 return sel;
594 const UConverterSelector* sel;
626 const UConverterSelector* sel;
631 sel = ((Enumerator*)(enumerator->context))->sel;
632 result = sel->encodings[((Enumerator*)(enumerator->context))->index[cur] ];
690 static UEnumeration *selectForMask(const UConverterSelector* sel,
702 result->sel = sel;
715 int32_t columns = (sel->encodingsCount+31)/32;
725 for (i = 0 ; i < 32 && k < sel->encodingsCount; i++, k++) {
740 ucnvsel_selectForString(const UConverterSelector* sel,
747 if (sel == NULL || (s == NULL && length != 0)) {
752 int32_t columns = (sel->encodingsCount+31)/32;
771 UTRIE2_U16_NEXT16(sel->trie, s, limit, c, pvIndex);
772 if (intersectMasks(mask, sel->pv+pvIndex, columns)) {
777 return selectForMask(sel, mask, status);
782 ucnvsel_selectForUTF8(const UConverterSelector* sel,
789 if (sel == NULL || (s == NULL && length != 0)) {
794 int32_t columns = (sel->encodingsCount+31)/32;
811 UTRIE2_U8_NEXT16(sel->trie, s, limit, pvIndex);
812 if (intersectMasks(mask, sel->pv+pvIndex, columns)) {
817 return selectForMask(sel, mask, status);