summaryrefslogtreecommitdiff
path: root/icu/icu-58.1-iterator.patch
blob: 6f52375eb790b8767d808b8ccbe78d4b3a1cd07e (plain)
    1 source: http://bugs.icu-project.org/trac/changeset/39484/
    2 
    3 
    4 Index: icu/common/ulist.c
    5 ===================================================================
    6 --- icu/common/ulist.c	(revision 39483)
    7 +++ icu/common/ulist.c	(revision 39484)
    8 @@ -30,5 +30,4 @@
    9      
   10      int32_t size;
   11 -    int32_t currentIndex;
   12  };
   13  
   14 @@ -52,5 +51,4 @@
   15      newList->tail = NULL;
   16      newList->size = 0;
   17 -    newList->currentIndex = -1;
   18      
   19      return newList;
   20 @@ -81,6 +79,7 @@
   21          p->next->previous = p->previous;
   22      }
   23 -    list->curr = NULL;
   24 -    list->currentIndex = 0;
   25 +    if (p == list->curr) {
   26 +        list->curr = p->next;
   27 +    }
   28      --list->size;
   29      if (p->forceDelete) {
   30 @@ -151,5 +150,4 @@
   31          list->head->previous = newItem;
   32          list->head = newItem;
   33 -        list->currentIndex++;
   34      }
   35      
   36 @@ -194,5 +192,4 @@
   37      curr = list->curr;
   38      list->curr = curr->next;
   39 -    list->currentIndex++;
   40      
   41      return curr->data;
   42 @@ -210,5 +207,4 @@
   43      if (list != NULL) {
   44          list->curr = list->head;
   45 -        list->currentIndex = 0;
   46      }
   47  }
   48 @@ -273,3 +269,2 @@
   49      return (UList *)(en->context);
   50  }
   51 -
   52 Index: icu/i18n/ucol_res.cpp
   53 ===================================================================
   54 --- icu/i18n/ucol_res.cpp	(revision 39483)
   55 +++ icu/i18n/ucol_res.cpp	(revision 39484)
   56 @@ -681,4 +681,5 @@
   57      }
   58      memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
   59 +    ulist_resetList(sink.values);  // Initialize the iterator.
   60      en->context = sink.values;
   61      sink.values = NULL;  // Avoid deletion in the sink destructor.
   62 Index: icu/test/intltest/apicoll.cpp
   63 ===================================================================
   64 --- icu/test/intltest/apicoll.cpp	(revision 39483)
   65 +++ icu/test/intltest/apicoll.cpp	(revision 39484)
   66 @@ -82,14 +82,7 @@
   67      col = Collator::createInstance(Locale::getEnglish(), success);
   68      if (U_FAILURE(success)){
   69 -        errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success));
   70 -        return;
   71 -    }
   72 -
   73 -    StringEnumeration* kwEnum = col->getKeywordValuesForLocale("", Locale::getEnglish(),true,success);
   74 -    if (U_FAILURE(success)){
   75 -        errcheckln(success, "Get Keyword Values for Locale failed. - %s", u_errorName(success));
   76 -        return;
   77 -    }
   78 -    delete kwEnum;
   79 +        errcheckln(success, "English Collator creation failed. - %s", u_errorName(success));
   80 +        return;
   81 +    }
   82  
   83      col->getVersion(versionArray);
   84 @@ -230,4 +223,27 @@
   85      delete aFrCol;
   86      delete junk;
   87 +}
   88 +
   89 +void CollationAPITest::TestKeywordValues() {
   90 +    IcuTestErrorCode errorCode(*this, "TestKeywordValues");
   91 +    LocalPointer<Collator> col(Collator::createInstance(Locale::getEnglish(), errorCode));
   92 +    if (errorCode.logIfFailureAndReset("English Collator creation failed")) {
   93 +        return;
   94 +    }
   95 +
   96 +    LocalPointer<StringEnumeration> kwEnum(
   97 +        col->getKeywordValuesForLocale("collation", Locale::getEnglish(), TRUE, errorCode));
   98 +    if (errorCode.logIfFailureAndReset("Get Keyword Values for English Collator failed")) {
   99 +        return;
  100 +    }
  101 +    assertTrue("expect at least one collation tailoring for English", kwEnum->count(errorCode) > 0);
  102 +    const char *kw;
  103 +    UBool hasStandard = FALSE;
  104 +    while ((kw = kwEnum->next(NULL, errorCode)) != NULL) {
  105 +        if (strcmp(kw, "standard") == 0) {
  106 +            hasStandard = TRUE;
  107 +        }
  108 +    }
  109 +    assertTrue("expect at least the 'standard' collation tailoring for English", hasStandard);
  110  }
  111  
  112 @@ -2467,4 +2483,5 @@
  113      TESTCASE_AUTO_BEGIN;
  114      TESTCASE_AUTO(TestProperty);
  115 +    TESTCASE_AUTO(TestKeywordValues);
  116      TESTCASE_AUTO(TestOperators);
  117      TESTCASE_AUTO(TestDuplicate);
  118 Index: icu/test/intltest/apicoll.h
  119 ===================================================================
  120 --- icu/test/intltest/apicoll.h	(revision 39483)
  121 +++ icu/test/intltest/apicoll.h	(revision 39484)
  122 @@ -36,4 +36,5 @@
  123       */
  124      void TestProperty(/* char* par */);
  125 +    void TestKeywordValues();
  126  
  127      /**

Generated by cgit