VirtualBox

Changeset 102457 in vbox


Ignore:
Timestamp:
Dec 4, 2023 5:24:33 PM (12 months ago)
Author:
vboxsync
Message:

libs/xpcom: Get rid of PL_strcmp/PL_strncmp and replace with IPRT equivalents, bugref:10545

Location:
trunk/src/libs/xpcom18a4
Files:
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/Makefile.kmk

    r102392 r102457  
    389389        nsprpub/lib/ds/plarena.c \
    390390        nsprpub/lib/ds/plhash.c \
    391         nsprpub/lib/libc/src/strcmp.c \
    392391        nsprpub/lib/libc/src/strccmp.c \
    393392        nsprpub/pr/src/pthreads/ptsynch.c
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/src/tmTransactionService.cpp

    r102392 r102457  
    342342      qmap = (tm_queue_mapping*) mQueueMaps[index];
    343343      if (qmap &&
    344           PL_strcmp(qmap->joinedQueueName, (char*) aTrans->GetMessage()) == 0) {
     344          RTStrCmp(qmap->joinedQueueName, (char*) aTrans->GetMessage()) == 0) {
    345345
    346346        // set the ID in the mapping
  • trunk/src/libs/xpcom18a4/nsprpub/lib/libc/include/plstr.h

    r102340 r102457  
    6363
    6464#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
    65 #define PL_strcmp VBoxNsplPL_strcmp
    66 #define PL_strncmp VBoxNsplPL_strncmp
    6765#define PL_strcasecmp VBoxNsplPL_strcasecmp
    6866#define PL_strncasecmp VBoxNsplPL_strncasecmp
    69 #define PL_strdup VBoxNsplPL_strdup
    70 #define PL_strfree VBoxNsplPL_strfree
    71 #define PL_strncpy VBoxNsplPL_strncpy
    72 #define PL_strncpyz VBoxNsplPL_strncpyz
    73 #define PL_strcaserstr VBoxNsplPL_strcaserstr
    74 #define PL_strcasestr VBoxNsplPL_strcasestr
    75 #define PL_strndup VBoxNsplPL_strndup
    7667#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
    7768
    7869PR_BEGIN_EXTERN_C
    79 /*
    80  * PL_strcmp
    81  *
    82  * Returns an integer, the sign of which -- positive, zero, or negative --
    83  * reflects the lexical sorting order of the two strings indicated.  The
    84  * result is positive if the first string comes after the second.  The
    85  * NSPR implementation is not i18n.
    86  */
    87 
    88 PR_EXTERN(PRIntn)
    89 PL_strcmp(const char *a, const char *b);
    90 
    91 /*
    92  * PL_strncmp
    93  *
    94  * Returns an integer, the sign of which -- positive, zero, or negative --
    95  * reflects the lexical sorting order of the two strings indicated, up to
    96  * the maximum specified.  The result is positive if the first string comes
    97  * after the second.  The NSPR implementation is not i18n.  If the maximum
    98  * is zero, only the existance or non-existance (pointer is null) of the
    99  * strings is compared.
    100  */
    101 
    102 PR_EXTERN(PRIntn)
    103 PL_strncmp(const char *a, const char *b, PRUint32 max);
    104 
    10570/*
    10671 * PL_strcasecmp
  • trunk/src/libs/xpcom18a4/vboxdeps.cpp

    r102341 r102457  
    1414uintptr_t deps[] =
    1515{
    16     (uintptr_t)PL_strcmp,
    1716    (uintptr_t)PL_strcasecmp,
    1817    (uintptr_t)PL_HashString,
  • trunk/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp

    r102348 r102457  
    320320  static PRIntn PR_CALLBACK TotalEntries(PLHashEntry *he, PRIntn i, void *arg) {
    321321    BloatEntry* entry = (BloatEntry*)he->value;
    322     if (entry && nsCRT::strcmp(entry->mClassName, "TOTAL") != 0) {
     322    if (entry && RTStrCmp(entry->mClassName, "TOTAL") != 0) {
    323323      entry->Total((BloatEntry*)arg);
    324324    }
     
    390390              i+1, mClassName,
    391391              (PRInt32)mClassSize,
    392               (nsCRT::strcmp(mClassName, "TOTAL"))
     392              (RTStrCmp(mClassName, "TOTAL"))
    393393                  ?(PRInt32)((stats->mCreates - stats->mDestroys) * mClassSize)
    394394                  :mTotalLeaked,
     
    538538        BloatEntry* right = NS_STATIC_CAST(BloatEntry*, entries[j]);
    539539
    540         if (PL_strcmp(left->GetClassName(), right->GetClassName()) < 0) {
     540        if (RTStrCmp(left->GetClassName(), right->GetClassName()) < 0) {
    541541          entries.ReplaceElementAt(right, i);
    542542          entries.ReplaceElementAt(left, j);
     
    637637  const char* value = getenv(envVar);
    638638  if (value) {
    639     if (nsCRT::strcmp(value, "1") == 0) {
     639    if (RTStrCmp(value, "1") == 0) {
    640640      *result = stdout;
    641641      fprintf(stdout, "### %s defined -- logging %s to stdout\n",
     
    643643      return PR_TRUE;
    644644    }
    645     else if (nsCRT::strcmp(value, "2") == 0) {
     645    else if (RTStrCmp(value, "2") == 0) {
    646646      *result = stderr;
    647647      fprintf(stdout, "### %s defined -- logging %s to stderr\n",
  • trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp

    r102345 r102457  
    994994
    995995            // ignore the leading '['
    996             if (0 != PL_strcmp(values[0]+1, token))
     996            if (0 != RTStrCmp(values[0]+1, token))
    997997                break;
    998998
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsAtomTable.cpp

    r101962 r102457  
    3636 *
    3737 * ***** END LICENSE BLOCK ***** */
     38#include <iprt/string.h>
    3839
    3940#include "nsAtomTable.h"
     
    181182  const AtomTableEntry *he = NS_STATIC_CAST(const AtomTableEntry*, entry);
    182183  const char* keyStr = NS_STATIC_CAST(const char*, key);
    183   return nsCRT::strcmp(keyStr, he->get()) == 0;
     184  return RTStrCmp(keyStr, he->get()) == 0;
    184185}
    185186
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsCRT.h

    r102326 r102457  
    146146  }                                                                             
    147147
    148   /// Compare s1 and s2.
    149   static PRInt32 strcmp(const char* s1, const char* s2) {
    150     return PRInt32(PL_strcmp(s1, s2));
    151   }
    152 
    153   static PRInt32 strncmp(const char* s1, const char* s2,
    154                          PRUint32 aMaxLen) {
    155     return PRInt32(PL_strncmp(s1, s2, aMaxLen));
    156   }
    157 
    158148  /// Case-insensitive string comparison.
    159149  static PRInt32 strcasecmp(const char* s1, const char* s2) {
     
    169159      result=-1;
    170160    return result;
    171   }
    172 
    173   static PRInt32 strncmp(const char* s1, const char* s2, PRInt32 aMaxLen) {
    174     // inline the first test (assumes strings are not null):
    175     PRInt32 diff = ((const unsigned char*)s1)[0] - ((const unsigned char*)s2)[0];
    176     if (diff != 0) return diff;
    177     return PRInt32(PL_strncmp(s1,s2,unsigned(aMaxLen)));
    178161  }
    179162 
  • trunk/src/libs/xpcom18a4/xpcom/io/nsAppFileLocationProvider.cpp

    r102315 r102457  
    3737 *
    3838 * ***** END LICENSE BLOCK ***** */
     39#include <iprt/string.h>
    3940
    4041#include "nsAppFileLocationProvider.h"
     
    133134    *persistant = PR_TRUE;
    134135
    135     if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0)
     136    if (RTStrCmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0)
    136137    {
    137138        rv = GetProductDirectory(getter_AddRefs(localFile));
    138139    }
    139     else if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_FILE) == 0)
     140    else if (RTStrCmp(prop, NS_APP_APPLICATION_REGISTRY_FILE) == 0)
    140141    {
    141142        rv = GetProductDirectory(getter_AddRefs(localFile));
     
    143144            rv = localFile->AppendNative(APP_REGISTRY_NAME);
    144145    }
    145     else if (nsCRT::strcmp(prop, NS_APP_DEFAULTS_50_DIR) == 0)
     146    else if (RTStrCmp(prop, NS_APP_DEFAULTS_50_DIR) == 0)
    146147    {
    147148        rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     
    149150            rv = localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
    150151    }
    151     else if (nsCRT::strcmp(prop, NS_APP_PREF_DEFAULTS_50_DIR) == 0)
     152    else if (RTStrCmp(prop, NS_APP_PREF_DEFAULTS_50_DIR) == 0)
    152153    {
    153154        rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     
    158159        }
    159160    }
    160     else if (nsCRT::strcmp(prop, NS_APP_PROFILE_DEFAULTS_50_DIR) == 0 ||
    161              nsCRT::strcmp(prop, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR) == 0)
     161    else if (RTStrCmp(prop, NS_APP_PROFILE_DEFAULTS_50_DIR) == 0 ||
     162             RTStrCmp(prop, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR) == 0)
    162163    {
    163164        rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     
    168169        }
    169170    }
    170     else if (nsCRT::strcmp(prop, NS_APP_USER_PROFILES_ROOT_DIR) == 0)
     171    else if (RTStrCmp(prop, NS_APP_USER_PROFILES_ROOT_DIR) == 0)
    171172    {
    172173        rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile));
    173174    }
    174     else if (nsCRT::strcmp(prop, NS_APP_RES_DIR) == 0)
     175    else if (RTStrCmp(prop, NS_APP_RES_DIR) == 0)
    175176    {
    176177        rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     
    178179            rv = localFile->AppendRelativeNativePath(RES_DIR_NAME);
    179180    }
    180     else if (nsCRT::strcmp(prop, NS_APP_CHROME_DIR) == 0)
     181    else if (RTStrCmp(prop, NS_APP_CHROME_DIR) == 0)
    181182    {
    182183        rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     
    184185            rv = localFile->AppendRelativeNativePath(CHROME_DIR_NAME);
    185186    }
    186     else if (nsCRT::strcmp(prop, NS_APP_PLUGINS_DIR) == 0)
     187    else if (RTStrCmp(prop, NS_APP_PLUGINS_DIR) == 0)
    187188    {
    188189        rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     
    190191            rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
    191192    }
    192     else if (nsCRT::strcmp(prop, NS_ENV_PLUGINS_DIR) == 0)
     193    else if (RTStrCmp(prop, NS_ENV_PLUGINS_DIR) == 0)
    193194    {
    194195        NS_ERROR("Don't use nsAppFileLocationProvider::GetFile(NS_ENV_PLUGINS_DIR, ...). "
     
    198199            rv = NS_NewNativeLocalFile(nsDependentCString(pathVar), PR_TRUE, getter_AddRefs(localFile));
    199200    }
    200     else if (nsCRT::strcmp(prop, NS_USER_PLUGINS_DIR) == 0)
     201    else if (RTStrCmp(prop, NS_USER_PLUGINS_DIR) == 0)
    201202    {
    202203        rv = GetProductDirectory(getter_AddRefs(localFile));
     
    204205            rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
    205206    }
    206     else if (nsCRT::strcmp(prop, NS_APP_SEARCH_DIR) == 0)
     207    else if (RTStrCmp(prop, NS_APP_SEARCH_DIR) == 0)
    207208    {
    208209        rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     
    210211            rv = localFile->AppendRelativeNativePath(SEARCH_DIR_NAME);
    211212    }
    212     else if (nsCRT::strcmp(prop, NS_APP_INSTALL_CLEANUP_DIR) == 0)
     213    else if (RTStrCmp(prop, NS_APP_INSTALL_CLEANUP_DIR) == 0)
    213214    {
    214215        // This is cloned so that embeddors will have a hook to override
     
    466467    nsresult rv = NS_ERROR_FAILURE;
    467468
    468     if (!nsCRT::strcmp(prop, NS_APP_PLUGINS_DIR_LIST))
     469    if (!RTStrCmp(prop, NS_APP_PLUGINS_DIR_LIST))
    469470    {
    470471        static const char* keys[] = { nsnull, NS_APP_PLUGINS_DIR, nsnull };
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp

    r102323 r102457  
    351351                                   &mInterface->mDescriptor->
    352352                                        method_descriptors[i]);
    353         if (PL_strcmp(methodName, info->GetName()) == 0) {
     353        if (RTStrCmp(methodName, info->GetName()) == 0) {
    354354            *index = i + mInterface->mMethodBaseIndex;
    355355            *result = info;
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp

    r102324 r102457  
    588588    for(PRUint32 i = 0; i < aWorkingSet->GetFileCount(); ++i)
    589589    {
    590         if(0 == PL_strcmp(aName, aWorkingSet->GetFileAt(i).GetName()))
     590        if(0 == RTStrCmp(aName, aWorkingSet->GetFileAt(i).GetName()))
    591591            return i;     
    592592    }
     
    13581358            aSrcWorkingSet->GetTypelibFileName(srcEntry->GetTypelibRecord());
    13591359   
    1360         if(0 == PL_strcmp(destFilename, srcFilename) &&
     1360        if(0 == RTStrCmp(destFilename, srcFilename) &&
    13611361           (destEntry->GetTypelibRecord().GetZipItemIndex() ==
    13621362            srcEntry->GetTypelibRecord().GetZipItemIndex()))
     
    13651365            // But... Let's make sure they didn't change the interface name.
    13661366            // There are wacky developers that do stuff like that!
    1367             if(0 == PL_strcmp(destEntry->GetTheName(), srcEntry->GetTheName()))
     1367            if(0 == RTStrCmp(destEntry->GetTheName(), srcEntry->GetTheName()))
    13681368                return PL_DHASH_NEXT;
    13691369        }
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiManifest.cpp

    r102197 r102457  
    390390
    391391            // ignore the leading '['
    392             if(0 != PL_strcmp(values[0]+1, token))
     392            if(0 != RTStrCmp(values[0]+1, token))
    393393                break;
    394394
     
    462462
    463463    // VersionLiteral
    464     if(0 != PL_strcmp(values[1], g_TOKEN_Version))
     464    if(0 != RTStrCmp(values[1], g_TOKEN_Version))
    465465        goto out;
    466466
     
    487487
    488488    // AppDirLiteral
    489     if(0 != PL_strcmp(values[1], g_TOKEN_AppDir))
     489    if(0 != RTStrCmp(values[1], g_TOKEN_AppDir))
    490490        goto out;
    491491
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiWorkingSet.cpp

    r1 r102457  
    9999    const char* str1 = ((xptiHashEntry*)entry)->value->GetTheName();
    100100    const char* str2 = (const char*) key;
    101     return str1 == str2 || 0 == PL_strcmp(str1, str2);
     101    return str1 == str2 || 0 == RTStrCmp(str1, str2);
    102102}       
    103103
     
    256256            xptiFile& file = mFileArray[i];
    257257            if(file.GetDirectory() == dir &&
    258                0 == PL_strcmp(name, file.GetName()))
     258               0 == RTStrCmp(name, file.GetName()))
    259259            {
    260260                return i;
     
    310310    {
    311311        for(PRUint32 i = 0; i < mZipItemCount;++i)
    312             if(0 == PL_strcmp(name, mZipItemArray[i].GetName()))
     312            if(0 == RTStrCmp(name, mZipItemArray[i].GetName()))
    313313                return i;
    314314    }
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiprivate.h

    r102348 r102457  
    4444
    4545#include <iprt/stream.h>
     46#include <iprt/string.h>
    4647
    4748#include "nscore.h"
     
    207208                mSize == r.mSize &&
    208209                mDate == r.mDate &&
    209                 0 == PL_strcmp(mName, r.mName);
     210                0 == RTStrCmp(mName, r.mName);
    210211    }
    211212
     
    268269    PRBool Equals(const xptiZipItem& r) const
    269270    {
    270         return 0 == PL_strcmp(mName, r.mName);
     271        return 0 == RTStrCmp(mName, r.mName);
    271272    }
    272273
  • trunk/src/libs/xpcom18a4/xpcom/tests/TestCRT.cpp

    r1 r102457  
    3535 *
    3636 * ***** END LICENSE BLOCK ***** */
     37#include <iprt/string.h>
    3738
    3839#include "nsCRT.h"
     
    6061static void Check(const char* s1, const char* s2, PRIntn n)
    6162{
    62   PRIntn clib = PL_strcmp(s1, s2);
    63   PRIntn clib_n = PL_strncmp(s1, s2, n);
     63  PRIntn clib = RTStrCmp(s1, s2);
     64  PRIntn clib_n = RTStrNCmp(s1, s2, n);
    6465  PRIntn clib_case = PL_strcasecmp(s1, s2);
    6566  PRIntn clib_case_n = PL_strncasecmp(s1, s2, n);
  • trunk/src/libs/xpcom18a4/xpcom/tests/TestID.cpp

    r86425 r102457  
    3535 *
    3636 * ***** END LICENSE BLOCK ***** */
     37#include <iprt/string.h>
     38
    3739#include <stdio.h>
    38 #include "plstr.h"
    3940#include "nsID.h"
    4041#include "prmem.h"
     
    6768      return -1;
    6869    }
    69     if (0 != PL_strcmp(cp, ids[4*(i/4) + 3])) {
     70    if (0 != RTStrCmp(cp, ids[4*(i/4) + 3])) {
    7071      fprintf(stderr, "TestID: compare of ToString failed on test #%d\n", i);
    7172      return -1;
Note: See TracChangeset for help on using the changeset viewer.

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