您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ uprv_memset函数代码示例

51自学网 2021-06-03 09:16:39
  C++
这篇教程C++ uprv_memset函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中uprv_memset函数的典型用法代码示例。如果您正苦于以下问题:C++ uprv_memset函数的具体用法?C++ uprv_memset怎么用?C++ uprv_memset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了uprv_memset函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _HZOpen

static void _HZOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){    UConverter *gbConverter;    if(pArgs->onlyTestIsLoadable) {        ucnv_canCreateConverter("GBK", errorCode);  /* errorCode carries result */        return;    }    gbConverter = ucnv_open("GBK", errorCode);    if(U_FAILURE(*errorCode)) {        return;    }    cnv->toUnicodeStatus = 0;    cnv->fromUnicodeStatus= 0;    cnv->mode=0;    cnv->fromUChar32=0x0000;    cnv->extraInfo = uprv_malloc(sizeof(UConverterDataHZ));    if(cnv->extraInfo != NULL){        uprv_memset(cnv->extraInfo, 0, sizeof(UConverterDataHZ));        ((UConverterDataHZ*)cnv->extraInfo)->gbConverter = gbConverter;    }    else {        ucnv_close(gbConverter);        *errorCode = U_MEMORY_ALLOCATION_ERROR;        return;    }}
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:26,


示例2: u_locbund_init

U_CAPI ULocaleBundle *u_locbund_init(ULocaleBundle *result, const char *loc){    int32_t len;    if(result == 0)        return 0;    if (loc == NULL) {        loc = uloc_getDefault();    }    uprv_memset(result, 0, sizeof(ULocaleBundle));    len = (int32_t)strlen(loc);    result->fLocale = (char*) uprv_malloc(len + 1);    if(result->fLocale == 0) {        return 0;    }    uprv_strcpy(result->fLocale, loc);    result->isInvariantLocale = uprv_strcmp(result->fLocale, "en_US_POSIX") == 0;    return result;}
开发者ID:icu-project,项目名称:icu4c,代码行数:26,


示例3: initConvData

static voidinitConvData(ConvData *data) {    uprv_memset(data, 0, sizeof(ConvData));    data->sharedData.structSize=sizeof(UConverterSharedData);    data->staticData.structSize=sizeof(UConverterStaticData);    data->sharedData.staticData=&data->staticData;}
开发者ID:0omega,项目名称:platform_external_icu4c,代码行数:7,


示例4: text_open

static UBooltext_open(TestText *tt) {  FILE *f;  char *s;  int32_t length;  uprv_memset(tt, 0, sizeof(TestText));  f = fopenOrError("ConverterSelectorTestUTF8.txt");  if(!f) {    return FALSE;  }  fseek(f, 0, SEEK_END);  length = (int32_t)ftell(f);  fseek(f, 0, SEEK_SET);  tt->text = (char *)uprv_malloc(length + 1);  if (tt->text == NULL) {    fclose(f);    return FALSE;  }  if (length != fread(tt->text, 1, length, f)) {    log_err("error reading %ld bytes from test text file/n", (long)length);    length = 0;    uprv_free(tt->text);  }  fclose(f);  tt->textLimit = tt->text + length;  *tt->textLimit = 0;  /* replace all Unicode '#' (U+0023) with NUL */  for(s = tt->text; (s = uprv_strchr(s, 0x23)) != NULL; *s++ = 0) {}  text_reset(tt);  return TRUE;}
开发者ID:MIPS,项目名称:external-icu,代码行数:31,


示例5: uprv_getUTCtime

/* Return UTC (GMT) time measured in milliseconds since 0:00 on 1/1/70.*/U_CAPI UDate U_EXPORT2uprv_getUTCtime(){#ifdef XP_MAC    time_t t, t1, t2;    struct tm tmrec;    uprv_memset( &tmrec, 0, sizeof(tmrec) );    tmrec.tm_year = 70;    tmrec.tm_mon = 0;    tmrec.tm_mday = 1;    t1 = mktime(&tmrec);    /* seconds of 1/1/1970*/    time(&t);    uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );    t2 = mktime(&tmrec);    /* seconds of current GMT*/    return (UDate)(t2 - t1) * U_MILLIS_PER_SECOND;         /* GMT (or UTC) in seconds since 1970*/#elif defined(U_WINDOWS)    FileTimeConversion winTime;    GetSystemTimeAsFileTime(&winTime.fileTime);    return (UDate)((winTime.int64 - EPOCH_BIAS) / HECTONANOSECOND_PER_MILLISECOND);#else/*    struct timeval posixTime;    gettimeofday(&posixTime, NULL);    return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000));*/    time_t epochtime;    time(&epochtime);    return (UDate)epochtime * U_MILLIS_PER_SECOND;#endif}
开发者ID:mathtexts,项目名称:uimacpp,代码行数:34,


示例6: _openProps

/* open uprops.icu */static void_openProps(UCharProps *ucp, UErrorCode *pErrorCode) {    const uint32_t *p;    int32_t length;    ucp->propsData=udata_openChoice(NULL, DATA_TYPE, DATA_NAME, isAcceptable, NULL, pErrorCode);    if(U_FAILURE(*pErrorCode)) {        return;    }    ucp->pData32=p=(const uint32_t *)udata_getMemory(ucp->propsData);    /* unserialize the trie; it is directly after the int32_t indexes[UPROPS_INDEX_COUNT] */    length=(int32_t)p[UPROPS_PROPS32_INDEX]*4;    length=utrie_unserialize(&ucp->propsTrie, (const uint8_t *)(p+UPROPS_INDEX_COUNT), length-64, pErrorCode);    if(U_FAILURE(*pErrorCode)) {        return;    }    /* unserialize the properties vectors trie */    length=(int32_t)(p[UPROPS_ADDITIONAL_VECTORS_INDEX]-p[UPROPS_ADDITIONAL_TRIE_INDEX])*4;    if(length>0) {        length=utrie_unserialize(&ucp->propsVectorsTrie, (const uint8_t *)(p+p[UPROPS_ADDITIONAL_TRIE_INDEX]), length, pErrorCode);    }    if(length<=0 || U_FAILURE(*pErrorCode)) {        /*         * length==0:         * Allow the properties vectors trie to be missing -         * also requires propsVectorsColumns=indexes[UPROPS_ADDITIONAL_VECTORS_COLUMNS_INDEX]         * to be zero so that this trie is never accessed.         */        uprv_memset(&ucp->propsVectorsTrie, 0, sizeof(ucp->propsVectorsTrie));    }}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:35,


示例7: uprv_cnttab_open

U_CAPI CntTable*  U_EXPORT2/*uprv_cnttab_open(CompactEIntArray *mapping, UErrorCode *status) {*/uprv_cnttab_open(UNewTrie *mapping, UErrorCode *status) {    if(U_FAILURE(*status)) {        return 0;    }    CntTable *tbl = (CntTable *)uprv_malloc(sizeof(CntTable));    if(tbl == NULL) {        *status = U_MEMORY_ALLOCATION_ERROR;        return NULL;    }    tbl->mapping = mapping;    tbl->elements = (ContractionTable **)uprv_malloc(INIT_EXP_TABLE_SIZE*sizeof(ContractionTable *));    if(tbl->elements == NULL) {        *status = U_MEMORY_ALLOCATION_ERROR;        uprv_free(tbl);        return NULL;    }    tbl->capacity = INIT_EXP_TABLE_SIZE;    uprv_memset(tbl->elements, 0, INIT_EXP_TABLE_SIZE*sizeof(ContractionTable *));    tbl->size = 0;    tbl->position = 0;    tbl->CEs = NULL;    tbl->codePoints = NULL;    tbl->offsets = NULL;    tbl->currentTag = NOT_FOUND_TAG;    return tbl;}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:28,


示例8: TZEnumeration

    TZEnumeration(int32_t rawOffset) : map(NULL), len(0), pos(0) {        if (!getOlsonMeta()) {            return;        }        // Allocate more space than we'll need.  The end of the array will        // be blank.        map = (int32_t*)uprv_malloc(OLSON_ZONE_COUNT * sizeof(int32_t));        if (map == 0) {            return;        }        uprv_memset(map, 0, sizeof(int32_t) * OLSON_ZONE_COUNT);        UnicodeString s;        for (int32_t i=0; i<OLSON_ZONE_COUNT; ++i) {            if (getID(i)) {                // This is VERY inefficient.                TimeZone* z = TimeZone::createTimeZone(unistr);                // Make sure we get back the ID we wanted (if the ID is                // invalid we get back GMT).                if (z != 0 && z->getID(s) == unistr &&                    z->getRawOffset() == rawOffset) {                    map[len++] = i;                }                delete z;            }        }    }
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:29,


示例9: ubidi_invertMap

U_CAPI void U_EXPORT2ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length) {    if(srcMap!=NULL && destMap!=NULL && length>0) {        const int32_t *pi;        int32_t destLength=-1, count=0;        /* find highest value and count positive indexes in srcMap */        pi=srcMap+length;        while(pi>srcMap) {            if(*--pi>destLength) {                destLength=*pi;            }            if(*pi>=0) {                count++;            }        }        destLength++;           /* add 1 for origin 0 */        if(count<destLength) {            /* we must fill unmatched destMap entries with -1 */            uprv_memset(destMap, 0xFF, destLength*sizeof(int32_t));        }        pi=srcMap+length;        while(length>0) {            if(*--pi>=0) {                destMap[*pi]=--length;            } else {                --length;            }        }    }}
开发者ID:CucasLoon,项目名称:in-the-box,代码行数:30,


示例10: u_fstropen

U_CAPI UFILE* U_EXPORT2u_fstropen(UChar *stringBuf,           int32_t      capacity,           const char  *locale){    UFILE *result;    if (capacity < 0) {        return NULL;    }    result = (UFILE*) uprv_malloc(sizeof(UFILE));    /* Null pointer test */    if (result == NULL) {    	return NULL; /* Just get out. */    }    uprv_memset(result, 0, sizeof(UFILE));    result->str.fBuffer = stringBuf;    result->str.fPos    = stringBuf;    result->str.fLimit  = stringBuf+capacity;#if !UCONFIG_NO_FORMATTING    /* if locale is 0, use the default */    if(u_locbund_init(&result->str.fBundle, locale) == 0) {        /* DO NOT FCLOSE HERE! */        uprv_free(result);        return 0;    }#endif    return result;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:32,


示例11: desiredLocale

UCollator*Collator::createUCollator(const char *loc,                          UErrorCode *status){    UCollator *result = 0;    if (status && U_SUCCESS(*status) && hasService()) {        Locale desiredLocale(loc);        Collator *col = (Collator*)gService->get(desiredLocale, *status);        RuleBasedCollator *rbc;        if (col && (rbc = dynamic_cast<RuleBasedCollator *>(col))) {            if (!rbc->dataIsOwned) {                result = ucol_safeClone(rbc->ucollator, NULL, NULL, status);            } else {                result = rbc->ucollator;                rbc->ucollator = NULL; // to prevent free on delete            }        } else {          // should go in a function- ucol_initDelegate(delegate)          result = (UCollator *)uprv_malloc(sizeof(UCollator));          if(result == NULL) {            *status = U_MEMORY_ALLOCATION_ERROR;          } else {            uprv_memset(result, 0, sizeof(UCollator));            result->delegate = col;            result->freeOnClose = TRUE; // do free on close.            col = NULL; // to prevent free on delete.          }        }        delete col;    }    return result;}
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:32,


示例12: getWindowsTimeZoneInfo

static UBool getWindowsTimeZoneInfo(TIME_ZONE_INFORMATION *zoneInfo, const UChar *icuid, int32_t length) {    UBool result = FALSE;    UnicodeString id = UnicodeString(icuid, length);    TimeZone *tz = TimeZone::createTimeZone(id);        if (tz != NULL) {        int32_t bias;        int32_t daylightBias;        int32_t standardBias;        SYSTEMTIME daylightDate;        SYSTEMTIME standardDate;        if (getSystemTimeInformation(tz, daylightDate, standardDate, bias, daylightBias, standardBias)) {            uprv_memset(zoneInfo, 0, sizeof(TIME_ZONE_INFORMATION)); // We do not set standard/daylight names, so nullify first.            zoneInfo->Bias          = bias;            zoneInfo->DaylightBias  = daylightBias;            zoneInfo->StandardBias  = standardBias;            zoneInfo->DaylightDate  = daylightDate;            zoneInfo->StandardDate  = standardDate;            result = TRUE;        }    }    return result;}
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:26,


示例13: reset

// Spoof Data constructor for use from data builder.//   Initializes a new, empty data area that will be populated later.SpoofData::SpoofData(UErrorCode &status) {    reset();    if (U_FAILURE(status)) {        return;    }    fDataOwned = true;    fRefCount = 1;    // The spoof header should already be sized to be a multiple of 16 bytes.    // Just in case it's not, round it up.    uint32_t initialSize = (sizeof(SpoofDataHeader) + 15) & ~15;    U_ASSERT(initialSize == sizeof(SpoofDataHeader));        fRawData = static_cast<SpoofDataHeader *>(uprv_malloc(initialSize));    fMemLimit = initialSize;    if (fRawData == NULL) {        status = U_MEMORY_ALLOCATION_ERROR;        return;    }    uprv_memset(fRawData, 0, initialSize);    fRawData->fMagic = USPOOF_MAGIC;    fRawData->fFormatVersion[0] = 1;    fRawData->fFormatVersion[1] = 0;    fRawData->fFormatVersion[2] = 0;    fRawData->fFormatVersion[3] = 0;    initPtrs(status);}
开发者ID:Abocer,项目名称:android-4.2_r1,代码行数:30,


示例14: ucol_normalizeShortDefinitionString

U_CAPI int32_t U_EXPORT2ucol_normalizeShortDefinitionString(const char *definition,                                    char *destination,                                    int32_t capacity,                                    UParseError *parseError,                                    UErrorCode *status){    if(U_FAILURE(*status)) {        return 0;    }    if(destination) {        uprv_memset(destination, 0, capacity*sizeof(char));    }    UParseError pe;    if(!parseError) {        parseError = &pe;    }    // validate    CollatorSpec s;    ucol_sit_initCollatorSpecs(&s);    ucol_sit_readSpecs(&s, definition, parseError, status);    return ucol_sit_dumpSpecs(&s, destination, capacity, status);}
开发者ID:119120119,项目名称:node,代码行数:27,


示例15: getID

/*get ID for each element. ID is globally unique.*/static char* getID(const char* id, const char* curKey, char* result) {    if(curKey == NULL) {        result = (char *)uprv_malloc(sizeof(char)*uprv_strlen(id) + 1);        uprv_memset(result, 0, sizeof(char)*uprv_strlen(id) + 1);        uprv_strcpy(result, id);    } else {        result = (char *)uprv_malloc(sizeof(char)*(uprv_strlen(id) + 1 + uprv_strlen(curKey)) + 1);        uprv_memset(result, 0, sizeof(char)*(uprv_strlen(id) + 1 + uprv_strlen(curKey)) + 1);        if(id[0]!='/0'){            uprv_strcpy(result, id);            uprv_strcat(result, "_");        }        uprv_strcat(result, curKey);    }    return result;}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:17,


示例16: timeZone_cleanup

U_CDECL_BEGINstatic UBool U_CALLCONV timeZone_cleanup(void){#ifdef U_USE_TIMEZONE_OBSOLETE_2_8    delete []OLSON_IDS;    OLSON_IDS = 0;#endif    delete DEFAULT_ZONE;    DEFAULT_ZONE = NULL;    delete _GMT;    _GMT = NULL;    uprv_memset(TZDATA_VERSION, 0, sizeof(TZDATA_VERSION));    TZDataVersionInitialized = FALSE;    if (LOCK) {        umtx_destroy(&LOCK);        LOCK = NULL;    }    if (TZSET_LOCK) {        umtx_destroy(&TZSET_LOCK);        TZSET_LOCK = NULL;    }    return TRUE;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:28,


示例17: ucol_prepareShortStringOpen

U_CAPI void U_EXPORT2ucol_prepareShortStringOpen( const char *definition,                          UBool,                          UParseError *parseError,                          UErrorCode *status){    if(U_FAILURE(*status)) return;    UParseError internalParseError;    if(!parseError) {        parseError = &internalParseError;    }    parseError->line = 0;    parseError->offset = 0;    parseError->preContext[0] = 0;    parseError->postContext[0] = 0;    // first we want to pick stuff out of short string.    // we'll end up with an UCA version, locale and a bunch of    // settings    // analyse the string in order to get everything we need.    CollatorSpec s;    ucol_sit_initCollatorSpecs(&s);    ucol_sit_readSpecs(&s, definition, parseError, status);    ucol_sit_calculateWholeLocale(&s);    char buffer[internalBufferSize];    uprv_memset(buffer, 0, internalBufferSize);    uloc_canonicalize(s.locale, buffer, internalBufferSize, status);    UResourceBundle *b = ures_open(U_ICUDATA_COLL, buffer, status);    /* we try to find stuff from keyword */    UResourceBundle *collations = ures_getByKey(b, "collations", NULL, status);    UResourceBundle *collElem = NULL;    char keyBuffer[256];    // if there is a keyword, we pick it up and try to get elements    if(!uloc_getKeywordValue(buffer, "collation", keyBuffer, 256, status)) {      // no keyword. we try to find the default setting, which will give us the keyword value      UResourceBundle *defaultColl = ures_getByKeyWithFallback(collations, "default", NULL, status);      if(U_SUCCESS(*status)) {        int32_t defaultKeyLen = 0;        const UChar *defaultKey = ures_getString(defaultColl, &defaultKeyLen, status);        u_UCharsToChars(defaultKey, keyBuffer, defaultKeyLen);        keyBuffer[defaultKeyLen] = 0;      } else {        *status = U_INTERNAL_PROGRAM_ERROR;        return;      }      ures_close(defaultColl);    }    collElem = ures_getByKeyWithFallback(collations, keyBuffer, collElem, status);    ures_close(collElem);    ures_close(collations);    ures_close(b);}
开发者ID:119120119,项目名称:node,代码行数:58,


示例18: fRules

U_NAMESPACE_BEGIN//----------------------------------------------------------------------------------------////  Constructor.////----------------------------------------------------------------------------------------RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString   &rules,                                       UParseError     *parseErr,                                       UErrorCode      &status) : fRules(rules){    fStatus = &status; // status is checked below    fParseError = parseErr;    fDebugEnv   = NULL;#ifdef RBBI_DEBUG    fDebugEnv   = getenv("U_RBBIDEBUG");#endif    fForwardTree        = NULL;    fReverseTree        = NULL;    fSafeFwdTree        = NULL;    fSafeRevTree        = NULL;    fDefaultTree        = &fForwardTree;    fForwardTables      = NULL;    fReverseTables      = NULL;    fSafeFwdTables      = NULL;    fSafeRevTables      = NULL;    fRuleStatusVals     = NULL;    fChainRules         = FALSE;    fLBCMNoChain        = FALSE;    fLookAheadHardBreak = FALSE;    fUSetNodes          = NULL;    fRuleStatusVals     = NULL;    fScanner            = NULL;    fSetBuilder         = NULL;    if (parseErr) {        uprv_memset(parseErr, 0, sizeof(UParseError));    }    if (U_FAILURE(status)) {        return;    }    fUSetNodes          = new UVector(status); // bcos status gets overwritten here    fRuleStatusVals     = new UVector(status);    fScanner            = new RBBIRuleScanner(this);    fSetBuilder         = new RBBISetBuilder(this);    if (U_FAILURE(status)) {        return;    }    if(fSetBuilder == 0 || fScanner == 0 || fUSetNodes == 0 || fRuleStatusVals == 0) {        status = U_MEMORY_ALLOCATION_ERROR;    }}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:57,


示例19: utm_allocN

U_CAPI void * U_EXPORT2utm_allocN(UToolMemory *mem, int32_t n) {    char *p=(char *)mem->array+mem->index*mem->size;    int32_t newIndex=mem->index+n;    if(utm_hasCapacity(mem, newIndex)) {        mem->index=newIndex;        uprv_memset(p, 0, n*mem->size);    }    return p;}
开发者ID:andrewleech,项目名称:firebird,代码行数:10,


示例20: ucnv_io_cleanup

static UBool U_CALLCONV ucnv_io_cleanup(void) {    if (gAliasData) {        udata_close(gAliasData);        gAliasData = NULL;    }    uprv_memset(&gMainTable, 0, sizeof(gMainTable));    return TRUE;                   /* Everything was cleaned up */}
开发者ID:mathtexts,项目名称:uimacpp,代码行数:10,


示例21: uprv_mapFile

    UBool    uprv_mapFile(         UDataMemory *pData,    /* Fill in with info on the result doing the mapping. */                                /*   Output only; any original contents are cleared.  */         const char *path       /* File path to be opened/mapped                      */         )    {        HANDLE map;        HANDLE file;        SECURITY_ATTRIBUTES mappingAttributes;        SECURITY_ATTRIBUTES *mappingAttributesPtr = NULL;        SECURITY_DESCRIPTOR securityDesc;        UDataMemory_init(pData); /* Clear the output struct.        */        /* open the input file */        file=CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL,            OPEN_EXISTING,            FILE_ATTRIBUTE_NORMAL|FILE_FLAG_RANDOM_ACCESS, NULL);        if(file==INVALID_HANDLE_VALUE) {            return FALSE;        }        /* Declare and initialize a security descriptor.           This is required for multiuser systems on Windows 2000 SP4 and beyond */        if (InitializeSecurityDescriptor(&securityDesc, SECURITY_DESCRIPTOR_REVISION)) {            /* give the security descriptor a Null Dacl done using the  "TRUE, (PACL)NULL" here	*/            if (SetSecurityDescriptorDacl(&securityDesc, TRUE, (PACL)NULL, FALSE)) {                /* Make the security attributes point to the security descriptor */                uprv_memset(&mappingAttributes, 0, sizeof(mappingAttributes));                mappingAttributes.nLength = sizeof(mappingAttributes);                mappingAttributes.lpSecurityDescriptor = &securityDesc;                mappingAttributes.bInheritHandle = FALSE; /* object uninheritable */                mappingAttributesPtr = &mappingAttributes;            }        }        /* else creating security descriptors can fail when we are on Windows 98,           and mappingAttributesPtr == NULL for that case. */        /* create an unnamed Windows file-mapping object for the specified file */        map=CreateFileMapping(file, mappingAttributesPtr, PAGE_READONLY, 0, 0, NULL);        CloseHandle(file);        if(map==NULL) {            return FALSE;        }        /* map a view of the file into our address space */        pData->pHeader=(const DataHeader *)MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);        if(pData->pHeader==NULL) {            CloseHandle(map);            return FALSE;        }        pData->map=map;        return TRUE;    }
开发者ID:mathtexts,项目名称:uimacpp,代码行数:55,


示例22: uprv_memset

/** * Implements {@link Transliterator#handleTransliterate}. */void CaseMapTransliterator::handleTransliterate(Replaceable& text,                                 UTransPosition& offsets,                                  UBool isIncremental) const{    if (offsets.start >= offsets.limit) {        return;    }    UCaseContext csc;    uprv_memset(&csc, 0, sizeof(csc));    csc.p = &text;    csc.start = offsets.contextStart;    csc.limit = offsets.contextLimit;    UnicodeString tmp;    const UChar *s;    UChar32 c;    int32_t textPos, delta, result, locCache=0;    for(textPos=offsets.start; textPos<offsets.limit;) {        csc.cpStart=textPos;        c=text.char32At(textPos);        csc.cpLimit=textPos+=U16_LENGTH(c);        result=fMap(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, "", &locCache);        if(csc.b1 && isIncremental) {            // fMap() tried to look beyond the context limit            // wait for more input            offsets.start=csc.cpStart;            return;        }        if(result>=0) {            // replace the current code point with its full case mapping result            // see UCASE_MAX_STRING_LENGTH            if(result<=UCASE_MAX_STRING_LENGTH) {                // string s[result]                tmp.setTo(FALSE, s, result);                delta=result-U16_LENGTH(c);            } else {                // single code point                tmp.setTo(result);                delta=tmp.length()-U16_LENGTH(c);            }            text.handleReplaceBetween(csc.cpStart, textPos, tmp);            if(delta!=0) {                textPos+=delta;                csc.limit=offsets.contextLimit+=delta;                offsets.limit+=delta;            }        }    }    offsets.start=textPos;}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:58,


示例23: upvec_open

U_CAPI UPropsVectors * U_EXPORT2upvec_open(int32_t columns, UErrorCode *pErrorCode) {    UPropsVectors *pv;    uint32_t *v, *row;    uint32_t cp;    if(U_FAILURE(*pErrorCode)) {        return NULL;    }    if(columns<1) {        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;        return NULL;    }    columns+=2; /* count range start and limit columns */    pv=(UPropsVectors *)uprv_malloc(sizeof(UPropsVectors));    v=(uint32_t *)uprv_malloc(UPVEC_INITIAL_ROWS*columns*4);    if(pv==NULL || v==NULL) {        uprv_free(pv);        uprv_free(v);        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;        return NULL;    }    uprv_memset(pv, 0, sizeof(UPropsVectors));    pv->v=v;    pv->columns=columns;    pv->maxRows=UPVEC_INITIAL_ROWS;    pv->rows=2+(UPVEC_MAX_CP-UPVEC_FIRST_SPECIAL_CP);    /* set the all-Unicode row and the special-value rows */    row=pv->v;    uprv_memset(row, 0, pv->rows*columns*4);    row[0]=0;    row[1]=0x110000;    row+=columns;    for(cp=UPVEC_FIRST_SPECIAL_CP; cp<=UPVEC_MAX_CP; ++cp) {        row[0]=cp;        row[1]=cp+1;        row+=columns;    }    return pv;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:42,


示例24: getResultsManually

static UBool *getResultsManually(const char** encodings, int32_t num_encodings,                   const char *utf8, int32_t length,                   const USet* excludedCodePoints, const UConverterUnicodeSet whichSet) {  UBool* resultsManually;  int32_t i;  resultsManually = (UBool*) uprv_malloc(gCountAvailable);  uprv_memset(resultsManually, 0, gCountAvailable);  for(i = 0 ; i < num_encodings ; i++) {    UErrorCode status = U_ZERO_ERROR;    /* get unicode set for that converter */    USet* set;    UConverter* test_converter;    UChar32 cp;    int32_t encIndex, offset;    set = uset_openEmpty();    test_converter = ucnv_open(encodings[i], &status);    ucnv_getUnicodeSet(test_converter, set,                       whichSet, &status);    if (excludedCodePoints != NULL) {      uset_addAll(set, excludedCodePoints);    }    uset_freeze(set);    offset = 0;    cp = 0;    encIndex = findIndex(encodings[i]);    /*     * The following is almost, but not entirely, the same as     * resultsManually[encIndex] =     *   (UBool)(uset_spanUTF8(set, utf8, length, USET_SPAN_SIMPLE) == length);     * They might be different if the set contains strings,     * or if the utf8 string contains an illegal sequence.     *     * The UConverterSelector does not currently handle strings that can be     * converted, and it treats an illegal sequence as convertible     * while uset_spanUTF8() treats it like U+FFFD which may not be convertible.     */    resultsManually[encIndex] = TRUE;    while(offset<length) {      U8_NEXT(utf8, offset, length, cp);      if (cp >= 0 && !uset_contains(set, cp)) {        resultsManually[encIndex] = FALSE;        break;      }    }    uset_close(set);    ucnv_close(test_converter);  }  return resultsManually;}
开发者ID:winlibs,项目名称:icu4c,代码行数:54,


示例25: ucol_sit_initCollatorSpecs

staticvoid ucol_sit_initCollatorSpecs(CollatorSpec *spec){    // reset everything    uprv_memset(spec, 0, sizeof(CollatorSpec));    // set collation options to default    int32_t i = 0;    for(i = 0; i < UCOL_ATTRIBUTE_COUNT; i++) {        spec->options[i] = UCOL_DEFAULT;    }}
开发者ID:cran,项目名称:stringi,代码行数:11,


示例26: pTrie

BiDiPropsBuilder::BiDiPropsBuilder(UErrorCode &errorCode)        : pTrie(NULL),          mirrorTop(0) {    // This builder encodes the following properties.    relevantProps.        add(UCHAR_BIDI_CONTROL).        add(UCHAR_BIDI_MIRRORED).        add(UCHAR_BIDI_CLASS).        add(UCHAR_BIDI_MIRRORING_GLYPH).        add(UCHAR_JOIN_CONTROL).        add(UCHAR_JOINING_GROUP).        add(UCHAR_JOINING_TYPE);    pTrie=utrie2_open(0, 0, &errorCode);    if(U_FAILURE(errorCode)) {        fprintf(stderr, "genprops error: bidipropsbuilder utrie2_open() failed - %s/n",                u_errorName(errorCode));    }    uprv_memset(jgArray, U_JG_NO_JOINING_GROUP, sizeof(jgArray));    uprv_memset(jgArray2, U_JG_NO_JOINING_GROUP, sizeof(jgArray2));}
开发者ID:icu-project,项目名称:icu-tools,代码行数:20,


示例27: finit_owner

static UFILE*finit_owner(FILE         *f,              const char *locale,              const char *codepage,              UBool       takeOwnership              ){    UErrorCode status = U_ZERO_ERROR;    UFILE     *result;    if(f == NULL) {        return 0;    }    result = (UFILE*) uprv_malloc(sizeof(UFILE));    if(result == NULL) {        return 0;    }    uprv_memset(result, 0, sizeof(UFILE));    result->fFileno = fileno(f);    result->fFile = f;    result->str.fBuffer = result->fUCBuffer;    result->str.fPos    = result->fUCBuffer;    result->str.fLimit  = result->fUCBuffer;#if !UCONFIG_NO_FORMATTING        /* if locale is 0, use the default */        if(u_locbund_init(&result->str.fBundle, locale) == 0) {            /* DO NOT FCLOSE HERE! */            uprv_free(result);            return 0;        }#endif    /* If the codepage is not "" use the ucnv_open default behavior */    if(codepage == NULL || *codepage != '/0') {        result->fConverter = ucnv_open(codepage, &status);    }    /* else result->fConverter is already memset'd to NULL. */    if(U_SUCCESS(status)) {        result->fOwnFile = takeOwnership;    }    else {#if !UCONFIG_NO_FORMATTING        u_locbund_close(&result->str.fBundle);#endif        /* DO NOT fclose here!!!!!! */        uprv_free(result);        result = NULL;    }    return result;}
开发者ID:bammons,项目名称:node,代码行数:54,


示例28: utm_alloc

U_CAPI void * U_EXPORT2utm_alloc(UToolMemory *mem) {    char *p=NULL;    int32_t oldIndex=mem->idx;    int32_t newIndex=oldIndex+1;    if(utm_hasCapacity(mem, newIndex)) {        p=(char *)mem->array+oldIndex*mem->size;        mem->idx=newIndex;        uprv_memset(p, 0, mem->size);    }    return p;}
开发者ID:00zhengfu00,项目名称:third_party,代码行数:12,



注:本文中的uprv_memset函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ uprv_strcat函数代码示例
C++ uprv_memcmp函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。