84241e9499
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
94 lines
2.7 KiB
Diff
94 lines
2.7 KiB
Diff
|
|
A combination of issue & patches from...
|
|
|
|
https://bugs.icu-project.org/trac/ticket/7680
|
|
https://bugs.icu-project.org/trac/changeset/28002
|
|
https://bugs.icu-project.org/trac/changeset/28124
|
|
|
|
Enlarged buffers more since include files for pkgdata can grow
|
|
significantly when cross-compiling.
|
|
This ONLY affects building.
|
|
|
|
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
|
|
|
diff -Nura icu.orig/source/tools/pkgdata/pkgdata.cpp icu/source/tools/pkgdata/pkgdata.cpp
|
|
--- icu.orig/source/tools/pkgdata/pkgdata.cpp 2010-09-29 15:37:28.000000000 -0300
|
|
+++ icu/source/tools/pkgdata/pkgdata.cpp 2010-12-21 15:53:30.252554924 -0300
|
|
@@ -97,8 +97,9 @@
|
|
#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING
|
|
#endif
|
|
|
|
-#define LARGE_BUFFER_MAX_SIZE 2048
|
|
-#define SMALL_BUFFER_MAX_SIZE 512
|
|
+#define LARGE_BUFFER_MAX_SIZE 8192
|
|
+#define MEDIUM_BUFFER_MAX_SIZE 4096
|
|
+#define SMALL_BUFFER_MAX_SIZE 2048
|
|
|
|
static void loadLists(UPKGOptions *o, UErrorCode *status);
|
|
|
|
@@ -472,29 +473,48 @@
|
|
}
|
|
|
|
static int runCommand(const char* command, UBool specialHandling) {
|
|
- char cmd[SMALL_BUFFER_MAX_SIZE];
|
|
+ char *cmd = NULL;
|
|
+ char cmdBuffer[SMALL_BUFFER_MAX_SIZE];
|
|
+ int32_t len = strlen(command);
|
|
+
|
|
+ if (len == 0) {
|
|
+ return 0;
|
|
+ }
|
|
|
|
if (!specialHandling) {
|
|
+#if defined(USING_CYGWIN) || defined(OS400)
|
|
+#define CMD_PADDING_SIZE 20
|
|
+ if ((len + CMD_PADDING_SIZE) >= SMALL_BUFFER_MAX_SIZE) {
|
|
+ cmd = (char *)uprv_malloc(len + CMD_PADDING_SIZE);
|
|
+ } else {
|
|
+ cmd = cmdBuffer;
|
|
+ }
|
|
#ifdef USING_CYGWIN
|
|
sprintf(cmd, "bash -c \"%s\"", command);
|
|
|
|
#elif defined(OS400)
|
|
sprintf(cmd, "QSH CMD('%s')", command);
|
|
+#endif
|
|
#else
|
|
goto normal_command_mode;
|
|
#endif
|
|
} else {
|
|
normal_command_mode:
|
|
- sprintf(cmd, "%s", command);
|
|
+ cmd = (char *)command;
|
|
}
|
|
-
|
|
+
|
|
printf("pkgdata: %s\n", cmd);
|
|
int result = system(cmd);
|
|
- if (result != 0) {
|
|
- printf("-- return status = %d\n", result);
|
|
+ if (result != 0) {
|
|
+ printf("-- return status = %d\n", result);
|
|
+ }
|
|
+
|
|
+ if (cmd != cmdBuffer && cmd != command) {
|
|
+ uprv_free(cmd);
|
|
}
|
|
- return result;
|
|
-}
|
|
+
|
|
+ return result;
|
|
+}
|
|
|
|
#define LN_CMD "ln -s"
|
|
#define RM_CMD "rm -f"
|
|
@@ -586,7 +606,7 @@
|
|
pkgDataFlags = (char**)uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE);
|
|
if (pkgDataFlags != NULL) {
|
|
for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
|
|
- pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * SMALL_BUFFER_MAX_SIZE);
|
|
+ pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * MEDIUM_BUFFER_MAX_SIZE);
|
|
if (pkgDataFlags[i] != NULL) {
|
|
pkgDataFlags[i][0] = 0;
|
|
} else {
|