intl/icu/source/common/ucnv_set.c

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /*
     2 *******************************************************************************
     3 *
     4 *   Copyright (C) 2003-2007, International Business Machines
     5 *   Corporation and others.  All Rights Reserved.
     6 *
     7 *******************************************************************************
     8 *   file name:  ucnv_set.c
     9 *   encoding:   US-ASCII
    10 *   tab size:   8 (not used)
    11 *   indentation:4
    12 *
    13 *   created on: 2004sep07
    14 *   created by: Markus W. Scherer
    15 *
    16 *   Conversion API functions using USet (ucnv_getUnicodeSet())
    17 *   moved here from ucnv.c for removing the dependency of other ucnv_
    18 *   implementation functions on the USet implementation.
    19 */
    21 #include "unicode/utypes.h"
    22 #include "unicode/uset.h"
    23 #include "unicode/ucnv.h"
    24 #include "ucnv_bld.h"
    25 #include "uset_imp.h"
    27 #if !UCONFIG_NO_CONVERSION
    29 U_CAPI void U_EXPORT2
    30 ucnv_getUnicodeSet(const UConverter *cnv,
    31                    USet *setFillIn,
    32                    UConverterUnicodeSet whichSet,
    33                    UErrorCode *pErrorCode) {
    34     /* argument checking */
    35     if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
    36         return;
    37     }
    38     if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
    39         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
    40         return;
    41     }
    43     /* does this converter support this function? */
    44     if(cnv->sharedData->impl->getUnicodeSet==NULL) {
    45         *pErrorCode=U_UNSUPPORTED_ERROR;
    46         return;
    47     }
    49     {
    50         USetAdder sa={
    51             NULL,
    52             uset_add,
    53             uset_addRange,
    54             uset_addString,
    55             uset_remove,
    56             uset_removeRange
    57         };
    58         sa.set=setFillIn;
    60         /* empty the set */
    61         uset_clear(setFillIn);
    63         /* call the converter to add the code points it supports */
    64         cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode);
    65     }
    66 }
    68 #endif

mercurial