Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 326021
Collapse All | Expand All

(-)icu.orig/source/tools/pkgdata/pkgdata.cpp (-28 / +39 lines)
Lines 601-642 static int32_t pkg_executeOptions(UPKGOp Link Here
601
            char gencFilePath[SMALL_BUFFER_MAX_SIZE] = "";
601
            char gencFilePath[SMALL_BUFFER_MAX_SIZE] = "";
602
            char version_major[10] = "";
602
            char version_major[10] = "";
603
            UBool reverseExt = FALSE;
603
            UBool reverseExt = FALSE;
604
            unsigned currentBufferSize = MEDIUM_BUFFER_MAX_SIZE;
604
605
605
            /* Initialize pkgdataFlags */
606
            /* Initialize pkgdataFlags */
606
            pkgDataFlags = (char**)uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE);
607
            pkgDataFlags = (char**)uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE);
607
            if (pkgDataFlags != NULL) {
608
#if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
608
                for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
609
            /* If we run out of space, allocate more */
609
                    pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * MEDIUM_BUFFER_MAX_SIZE);
610
            do {
610
                    if (pkgDataFlags[i] != NULL) {
611
#endif
611
                        pkgDataFlags[i][0] = 0;
612
                if (pkgDataFlags != NULL) {
612
                    } else {
613
                    for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
613
                        fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
614
                        pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * currentBufferSize);
614
                        return -1;
615
                        if (pkgDataFlags[i] != NULL) {
616
                            pkgDataFlags[i][0] = 0;
617
                        } else {
618
                            fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
619
                            return -1;
620
                        }
615
                    }
621
                    }
622
                } else {
623
                    fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
624
                    return -1;
616
                }
625
                }
617
            } else {
618
                fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
619
                return -1;
620
            }
621
626
622
            if(o->verbose) {
627
                if(o->verbose) {
623
              fprintf(stdout, "# pkgDataFlags=");
628
                  fprintf(stdout, "# pkgDataFlags=");
624
              for(int32_t i=0;i<PKGDATA_FLAGS_SIZE && pkgDataFlags[i][0];i++) {
629
                  for(int32_t i=0;i<PKGDATA_FLAGS_SIZE && pkgDataFlags[i][0];i++) {
625
                fprintf(stdout, "%c \"%s\"", (i>0)?',':' ',pkgDataFlags[i]);
630
                    fprintf(stdout, "%c \"%s\"", (i>0)?',':' ',pkgDataFlags[i]);
626
              }
631
                  }
627
              fprintf(stdout, "\n");
632
                  fprintf(stdout, "\n");
628
            }
633
                }
629
634
630
#if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
635
#if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
631
            /* Read in options file. */
636
                /* Read in options file. */
632
            if(o->verbose) {
637
                if(o->verbose) {
633
              fprintf(stdout, "# Reading options file %s\n", o->options);
638
                  fprintf(stdout, "# Reading options file %s\n", o->options);
634
            }
639
                }
635
            parseFlagsFile(o->options, pkgDataFlags, SMALL_BUFFER_MAX_SIZE, (int32_t)PKGDATA_FLAGS_SIZE, &status);
640
                parseFlagsFile(o->options, pkgDataFlags, currentBufferSize, (int32_t)PKGDATA_FLAGS_SIZE, &status);
636
            if (U_FAILURE(status)) {
641
                if (status == U_BUFFER_OVERFLOW_ERROR) {
637
                fprintf(stderr,"Unable to open or read \"%s\" option file. status = %s\n", o->options, u_errorName(status));
642
                    for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
638
                return -1;
643
                        uprv_free(pkgDataFlags[i]);
639
            }
644
                    }
645
                    currentBufferSize *= 2;
646
                } else if (U_FAILURE(status)) {
647
                    fprintf(stderr,"Unable to open or read \"%s\" option file. status = %s\n", o->options, u_errorName(status));
648
                    return -1;
649
                }
650
            } while (status == U_BUFFER_OVERFLOW_ERROR);
640
651
641
            /* Get the version major number. */
652
            /* Get the version major number. */
642
            if (o->version != NULL) {
653
            if (o->version != NULL) {

Return to bug 326021