/[packages]/cauldron/icu/current/SOURCES/icu-4.4.1-pkgdata.patch
ViewVC logotype

Annotation of /cauldron/icu/current/SOURCES/icu-4.4.1-pkgdata.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1497 - (hide annotations) (download)
Sun Jan 9 02:31:09 2011 UTC (10 years, 8 months ago) by blino
File size: 2316 byte(s)
imported package icu
1 blino 1497 https://bugs.icu-project.org/trac/ticket/7663
2     https://bugs.icu-project.org/trac/changeset/28002
3     https://bugs.icu-project.org/trac/ticket/7680
4     https://bugs.icu-project.org/trac/changeset/28124
5    
6     --- source/tools/pkgdata/pkgdata.cpp
7     +++ source/tools/pkgdata/pkgdata.cpp
8     @@ -98,6 +98,7 @@
9     #endif
10    
11     #define LARGE_BUFFER_MAX_SIZE 2048
12     +#define MEDIUM_BUFFER_MAX_SIZE 1024
13     #define SMALL_BUFFER_MAX_SIZE 512
14    
15     static void loadLists(UPKGOptions *o, UErrorCode *status);
16     @@ -472,29 +473,48 @@
17     }
18    
19     static int runCommand(const char* command, UBool specialHandling) {
20     - char cmd[SMALL_BUFFER_MAX_SIZE];
21     + char *cmd = NULL;
22     + char cmdBuffer[SMALL_BUFFER_MAX_SIZE];
23     + int32_t len = strlen(command);
24     +
25     + if (len == 0) {
26     + return 0;
27     + }
28    
29     if (!specialHandling) {
30     +#if defined(USING_CYGWIN) || defined(OS400)
31     +#define CMD_PADDING_SIZE 20
32     + if ((len + CMD_PADDING_SIZE) >= SMALL_BUFFER_MAX_SIZE) {
33     + cmd = (char *)uprv_malloc(len + CMD_PADDING_SIZE);
34     + } else {
35     + cmd = cmdBuffer;
36     + }
37     #ifdef USING_CYGWIN
38     sprintf(cmd, "bash -c \"%s\"", command);
39    
40     #elif defined(OS400)
41     sprintf(cmd, "QSH CMD('%s')", command);
42     +#endif
43     #else
44     goto normal_command_mode;
45     #endif
46     } else {
47     normal_command_mode:
48     - sprintf(cmd, "%s", command);
49     + cmd = (char *)command;
50     }
51     -
52     +
53     printf("pkgdata: %s\n", cmd);
54     int result = system(cmd);
55     - if (result != 0) {
56     - printf("-- return status = %d\n", result);
57     + if (result != 0) {
58     + printf("-- return status = %d\n", result);
59     }
60     - return result;
61     -}
62     +
63     + if (cmd != cmdBuffer && cmd != command) {
64     + uprv_free(cmd);
65     + }
66     +
67     + return result;
68     +}
69    
70     #define LN_CMD "ln -s"
71     #define RM_CMD "rm -f"
72     @@ -586,7 +606,7 @@
73     pkgDataFlags = (char**)uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE);
74     if (pkgDataFlags != NULL) {
75     for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
76     - pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * SMALL_BUFFER_MAX_SIZE);
77     + pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * MEDIUM_BUFFER_MAX_SIZE);
78     if (pkgDataFlags[i] != NULL) {
79     pkgDataFlags[i][0] = 0;
80     } else {

  ViewVC Help
Powered by ViewVC 1.1.28