Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: source/tools/toolutil/package.cpp

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/tools/toolutil/package.h ('k') | source/tools/toolutil/pkg_genc.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * 3 *
4 * Copyright (C) 1999-2013, International Business Machines 4 * Copyright (C) 1999-2014, International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ******************************************************************************* 7 *******************************************************************************
8 * file name: package.cpp 8 * file name: package.cpp
9 * encoding: US-ASCII 9 * encoding: US-ASCII
10 * tab size: 8 (not used) 10 * tab size: 8 (not used)
11 * indentation:4 11 * indentation:4
12 * 12 *
13 * created on: 2005aug25 13 * created on: 2005aug25
14 * created by: Markus W. Scherer 14 * created by: Markus W. Scherer
(...skipping 20 matching lines...) Expand all
35 35
36 #include <stdio.h> 36 #include <stdio.h>
37 #include <stdlib.h> 37 #include <stdlib.h>
38 #include <string.h> 38 #include <string.h>
39 39
40 40
41 static const int32_t kItemsChunk = 256; /* How much to increase the filesarray b y each time */ 41 static const int32_t kItemsChunk = 256; /* How much to increase the filesarray b y each time */
42 42
43 // general definitions ----------------------------------------------------- *** 43 // general definitions ----------------------------------------------------- ***
44 44
45 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
46
47 /* UDataInfo cf. udata.h */ 45 /* UDataInfo cf. udata.h */
48 static const UDataInfo dataInfo={ 46 static const UDataInfo dataInfo={
49 (uint16_t)sizeof(UDataInfo), 47 (uint16_t)sizeof(UDataInfo),
50 0, 48 0,
51 49
52 U_IS_BIG_ENDIAN, 50 U_IS_BIG_ENDIAN,
53 U_CHARSET_FAMILY, 51 U_CHARSET_FAMILY,
54 (uint8_t)sizeof(UChar), 52 (uint8_t)sizeof(UChar),
55 0, 53 0,
56 54
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 // Use the first entry's prefix. Must be a new-style package. 585 // Use the first entry's prefix. Must be a new-style package.
588 const char *prefixLimit=strchr(s, U_TREE_ENTRY_SEP_CHAR); 586 const char *prefixLimit=strchr(s, U_TREE_ENTRY_SEP_CHAR);
589 if(prefixLimit==NULL) { 587 if(prefixLimit==NULL) {
590 fprintf(stderr, 588 fprintf(stderr,
591 "icupkg: --auto_toc_prefix[_with_type] but " 589 "icupkg: --auto_toc_prefix[_with_type] but "
592 "the first entry \"%s\" does not contain a '%c'\n", 590 "the first entry \"%s\" does not contain a '%c'\n",
593 s, U_TREE_ENTRY_SEP_CHAR); 591 s, U_TREE_ENTRY_SEP_CHAR);
594 exit(U_INVALID_FORMAT_ERROR); 592 exit(U_INVALID_FORMAT_ERROR);
595 } 593 }
596 prefixLength=(int32_t)(prefixLimit-s); 594 prefixLength=(int32_t)(prefixLimit-s);
597 if(prefixLength==0 || prefixLength>=LENGTHOF(pkgPrefix)) { 595 if(prefixLength==0 || prefixLength>=UPRV_LENGTHOF(pkgPrefix)) {
598 fprintf(stderr, 596 fprintf(stderr,
599 "icupkg: --auto_toc_prefix[_with_type] but " 597 "icupkg: --auto_toc_prefix[_with_type] but "
600 "the prefix of the first entry \"%s\" is empty or too lo ng\n", 598 "the prefix of the first entry \"%s\" is empty or too lo ng\n",
601 s); 599 s);
602 exit(U_INVALID_FORMAT_ERROR); 600 exit(U_INVALID_FORMAT_ERROR);
603 } 601 }
604 if(prefixEndsWithType && s[prefixLength-1]!=type) { 602 if(prefixEndsWithType && s[prefixLength-1]!=type) {
605 fprintf(stderr, 603 fprintf(stderr,
606 "icupkg: --auto_toc_prefix_with_type but " 604 "icupkg: --auto_toc_prefix_with_type but "
607 "the prefix of the first entry \"%s\" does not end with '%c'\n", 605 "the prefix of the first entry \"%s\" does not end with '%c'\n",
608 s, type); 606 s, type);
609 exit(U_INVALID_FORMAT_ERROR); 607 exit(U_INVALID_FORMAT_ERROR);
610 } 608 }
611 memcpy(pkgPrefix, s, prefixLength); 609 memcpy(pkgPrefix, s, prefixLength);
610 pkgPrefix[prefixLength]=0;
612 memcpy(prefix, s, ++prefixLength); // include the / 611 memcpy(prefix, s, ++prefixLength); // include the /
613 } else { 612 } else {
614 // Use the package basename as prefix. 613 // Use the package basename as prefix.
615 int32_t inPkgNameLength=strlen(inPkgName); 614 int32_t inPkgNameLength=strlen(inPkgName);
616 memcpy(prefix, inPkgName, inPkgNameLength); 615 memcpy(prefix, inPkgName, inPkgNameLength);
617 prefixLength=inPkgNameLength; 616 prefixLength=inPkgNameLength;
618 617
619 if( (int32_t)strlen(s)>=(inPkgNameLength+2) && 618 if( (int32_t)strlen(s)>=(inPkgNameLength+2) &&
620 0==memcmp(s, inPkgName, inPkgNameLength) && 619 0==memcmp(s, inPkgName, inPkgNameLength) &&
621 s[inPkgNameLength]=='_' 620 s[inPkgNameLength]=='_'
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 } 1303 }
1305 1304
1306 void Package::ensureItemCapacity() 1305 void Package::ensureItemCapacity()
1307 { 1306 {
1308 if((itemCount+1)>itemMax) { 1307 if((itemCount+1)>itemMax) {
1309 setItemCapacity(itemCount+kItemsChunk); 1308 setItemCapacity(itemCount+kItemsChunk);
1310 } 1309 }
1311 } 1310 }
1312 1311
1313 U_NAMESPACE_END 1312 U_NAMESPACE_END
OLDNEW
« no previous file with comments | « source/tools/toolutil/package.h ('k') | source/tools/toolutil/pkg_genc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698