VirtualBox

Changeset 99527 in vbox


Ignore:
Timestamp:
Apr 25, 2023 6:40:37 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
157036
Message:

xpcom/tstTestHashtables: Don't use %c with Unicode CP, because it doesn't handle the encoding right (causing errors when the output of unit tests in the validation kit contains invalid UTF-8 sequences).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/tests/TestHashtables.cpp

    r86419 r99527  
    114114PLDHashOperator
    115115nsTEnumGo(EntityToUnicodeEntry* aEntry, void* userArg) {
    116   printf("  enumerated \"%s\" = %u\n", 
     116  printf("  enumerated \"%s\" = %u\n",
    117117         aEntry->mNode->mStr, aEntry->mNode->mUnicode);
    118118
     
    202202PLDHashOperator
    203203nsCEnumRead(const nsACString& aKey, TestUniChar* aData, void* userArg) {
    204   printf("  enumerated \"%s\" = %c\n",
     204  printf("  enumerated \"%s\" = %u\n",
    205205         PromiseFlatCString(aKey).get(), aData->GetChar());
    206206  return PL_DHASH_NEXT;
     
    209209PLDHashOperator
    210210nsCEnum(const nsACString& aKey, nsAutoPtr<TestUniChar>& aData, void* userArg) {
    211     printf("  enumerated \"%s\" = %c\n",
     211    printf("  enumerated \"%s\" = %u\n",
    212212           PromiseFlatCString(aKey).get(), aData->GetChar());
    213213  return PL_DHASH_NEXT;
     
    278278  {
    279279    ++refcount_;
    280     printf("IFoo@%p::AddRef(), refcount --> %d\n", 
     280    printf("IFoo@%p::AddRef(), refcount --> %d\n",
    281281           NS_STATIC_CAST(void*, this), refcount_);
    282282    return refcount_;
     
    289289    if ( wrap_message )
    290290      printf(">>");
    291      
     291
    292292    nsrefcnt newrefcount = --refcount_;
    293293    printf("IFoo@%p::Release(), refcount --> %d\n",
     
    487487    exit (13);
    488488  }
    489      
     489
    490490  printf("not found; good.\n");
    491      
     491
    492492  printf("Enumerating:\n");
    493  
     493
    494494  count = UniToEntity.EnumerateRead(nsDEnumRead, nsnull);
    495495  if (count != ENTITY_COUNT) {
     
    497497    exit (14);
    498498  }
    499  
     499
    500500  printf("Clearing...");
    501501  UniToEntity.Clear();
     
    552552    exit (13);
    553553  }
    554      
     554
    555555  printf("not found; good.\n");
    556      
     556
    557557  printf("Enumerating:\n");
    558  
     558
    559559  count = UniToEntityL.EnumerateRead(nsDEnumRead, nsnull);
    560560  if (count != ENTITY_COUNT) {
     
    562562    exit (14);
    563563  }
    564  
     564
    565565  printf("Clearing...");
    566566  UniToEntityL.Clear();
     
    613613    }
    614614
    615     printf("Found %c\n", myChar->GetChar());
     615    printf("Found %u\n", myChar->GetChar());
    616616  }
    617617
     
    621621    exit (19);
    622622  }
    623      
     623
    624624  printf("not found; good.\n");
    625      
     625
    626626  printf("Enumerating:\n");
    627  
     627
    628628  count = EntToUniClass.EnumerateRead(nsCEnumRead, nsnull);
    629629  if (count != ENTITY_COUNT) {
     
    631631    exit (20);
    632632  }
    633  
     633
    634634  printf("Clearing...\n");
    635635  EntToUniClass.Clear();
     
    681681    }
    682682
    683     printf("Found %c\n", myChar->GetChar());
     683    printf("Found %u\n", myChar->GetChar());
    684684  }
    685685
     
    689689    exit (19);
    690690  }
    691      
     691
    692692  printf("not found; good.\n");
    693      
     693
    694694  printf("Enumerating:\n");
    695  
     695
    696696  count = EntToUniClassL.EnumerateRead(nsCEnumRead, nsnull);
    697697  if (count != ENTITY_COUNT) {
     
    699699    exit (20);
    700700  }
    701  
     701
    702702  printf("Clearing...\n");
    703703  EntToUniClassL.Clear();
     
    735735    CreateIFoo(getter_AddRefs(foo));
    736736    foo->SetString(nsDependentCString(gEntities[i].mStr));
    737    
    738    
     737
     738
    739739    fooArray.InsertObjectAt(foo, i);
    740740
     
    751751  for (i = 0; i < ENTITY_COUNT; ++i) {
    752752    printf("  Getting entry %s...", gEntities[i].mStr);
    753    
     753
    754754    if (!EntToUniClass2.Get(fooArray[i], &myChar2)) {
    755755      printf("FAILED\n");
     
    757757    }
    758758
    759     printf("Found %c\n", myChar2);
     759    printf("Found %u\n", myChar2);
    760760  }
    761761
     
    765765    exit (25);
    766766  }
    767      
     767
    768768  printf("not found; good.\n");
    769      
     769
    770770  printf("Enumerating:\n");
    771  
     771
    772772  count = EntToUniClass2.EnumerateRead(nsIEnum2Read, nsnull);
    773773  if (count != ENTITY_COUNT) {
     
    775775    exit (26);
    776776  }
    777  
     777
    778778  printf("Clearing...\n");
    779779  EntToUniClass2.Clear();
     
    809809    CreateIFoo(getter_AddRefs(foo));
    810810    foo->SetString(nsDependentCString(gEntities[i].mStr));
    811    
     811
    812812    if (!UniToEntClass2.Put(gEntities[i].mUnicode, foo)) {
    813813      printf("FAILED\n");
     
    821821  for (i = 0; i < ENTITY_COUNT; ++i) {
    822822    printf("  Getting entry %s...", gEntities[i].mStr);
    823    
     823
    824824    nsCOMPtr<IFoo> myEnt;
    825825    if (!UniToEntClass2.Get(gEntities[i].mUnicode, getter_AddRefs(myEnt))) {
     
    827827      exit (30);
    828828    }
    829    
     829
    830830    nsCAutoString str;
    831831    myEnt->GetString(str);
     
    839839    exit (31);
    840840  }
    841      
     841
    842842  printf("not found; good.\n");
    843      
     843
    844844  printf("Enumerating:\n");
    845  
     845
    846846  count = UniToEntClass2.EnumerateRead(nsIEnumRead, nsnull);
    847847  if (count != ENTITY_COUNT) {
     
    849849    exit (32);
    850850  }
    851  
     851
    852852  printf("Clearing...\n");
    853853  UniToEntClass2.Clear();
     
    883883    CreateIFoo(getter_AddRefs(foo));
    884884    foo->SetString(nsDependentCString(gEntities[i].mStr));
    885    
     885
    886886    if (!UniToEntClass2L.Put(gEntities[i].mUnicode, foo)) {
    887887      printf("FAILED\n");
     
    895895  for (i = 0; i < ENTITY_COUNT; ++i) {
    896896    printf("  Getting entry %s...", gEntities[i].mStr);
    897    
     897
    898898    nsCOMPtr<IFoo> myEnt;
    899899    if (!UniToEntClass2L.Get(gEntities[i].mUnicode, getter_AddRefs(myEnt))) {
     
    901901      exit (30);
    902902    }
    903    
     903
    904904    nsCAutoString str;
    905905    myEnt->GetString(str);
     
    912912    exit (31);
    913913  }
    914      
     914
    915915  printf("not found; good.\n");
    916      
     916
    917917  printf("Enumerating:\n");
    918  
     918
    919919  count = UniToEntClass2L.EnumerateRead(nsIEnumRead, nsnull);
    920920  if (count != ENTITY_COUNT) {
     
    922922    exit (32);
    923923  }
    924  
     924
    925925  printf("Clearing...\n");
    926926  UniToEntClass2L.Clear();
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette