OLD | NEW |
1 /****************************************************************************** | 1 /****************************************************************************** |
2 * Copyright (C) 2008-2013, International Business Machines | 2 * Copyright (C) 2008-2014, International Business Machines |
3 * Corporation and others. All Rights Reserved. | 3 * Corporation and others. All Rights Reserved. |
4 ******************************************************************************* | 4 ******************************************************************************* |
5 */ | 5 */ |
6 #include "unicode/utypes.h" | 6 #include "unicode/utypes.h" |
7 #include "unicode/putil.h" | 7 #include "unicode/putil.h" |
8 #include "cstring.h" | 8 #include "cstring.h" |
9 #include "toolutil.h" | 9 #include "toolutil.h" |
10 #include "uoptions.h" | 10 #include "uoptions.h" |
11 #include "uparse.h" | 11 #include "uparse.h" |
12 #include "package.h" | 12 #include "package.h" |
13 #include "pkg_icu.h" | 13 #include "pkg_icu.h" |
14 | 14 |
15 #include <stdio.h> | 15 #include <stdio.h> |
16 #include <stdlib.h> | 16 #include <stdlib.h> |
17 #include <string.h> | 17 #include <string.h> |
18 | 18 |
19 | |
20 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
21 | |
22 // read a file list -------------------------------------------------------- *** | 19 // read a file list -------------------------------------------------------- *** |
23 | 20 |
24 U_NAMESPACE_USE | 21 U_NAMESPACE_USE |
25 | 22 |
26 static const struct { | 23 static const struct { |
27 const char *suffix; | 24 const char *suffix; |
28 int32_t length; | 25 int32_t length; |
29 } listFileSuffixes[]={ | 26 } listFileSuffixes[]={ |
30 { ".txt", 4 }, | 27 { ".txt", 4 }, |
31 { ".lst", 4 }, | 28 { ".lst", 4 }, |
32 { ".tmp", 4 } | 29 { ".tmp", 4 } |
33 }; | 30 }; |
34 | 31 |
35 /* check for multiple text file suffixes to see if this list name is a text file
name */ | 32 /* check for multiple text file suffixes to see if this list name is a text file
name */ |
36 static UBool | 33 static UBool |
37 isListTextFile(const char *listname) { | 34 isListTextFile(const char *listname) { |
38 const char *listNameEnd=strchr(listname, 0); | 35 const char *listNameEnd=strchr(listname, 0); |
39 const char *suffix; | 36 const char *suffix; |
40 int32_t i, length; | 37 int32_t i, length; |
41 for(i=0; i<LENGTHOF(listFileSuffixes); ++i) { | 38 for(i=0; i<UPRV_LENGTHOF(listFileSuffixes); ++i) { |
42 suffix=listFileSuffixes[i].suffix; | 39 suffix=listFileSuffixes[i].suffix; |
43 length=listFileSuffixes[i].length; | 40 length=listFileSuffixes[i].length; |
44 if((listNameEnd-listname)>length && 0==memcmp(listNameEnd-length, suffix
, length)) { | 41 if((listNameEnd-listname)>length && 0==memcmp(listNameEnd-length, suffix
, length)) { |
45 return TRUE; | 42 return TRUE; |
46 } | 43 } |
47 } | 44 } |
48 return FALSE; | 45 return FALSE; |
49 } | 46 } |
50 | 47 |
51 /* | 48 /* |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 pkg->writePackage(outFilename, outType, outComment); | 172 pkg->writePackage(outFilename, outType, outComment); |
176 | 173 |
177 if (pkgDelete) { | 174 if (pkgDelete) { |
178 delete pkg; | 175 delete pkg; |
179 delete addListPkg; | 176 delete addListPkg; |
180 } | 177 } |
181 | 178 |
182 return 0; | 179 return 0; |
183 } | 180 } |
184 | 181 |
OLD | NEW |