VirtualBox

Changeset 102345 in vbox


Ignore:
Timestamp:
Nov 27, 2023 6:48:07 PM (12 months ago)
Author:
vboxsync
Message:

libs/xpcom: Replace remaining APIs from prprf.h with IPRT equivalents, bugref:10545

Location:
trunk/src/libs/xpcom18a4
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp

    r102343 r102345  
    5959#include <errno.h>
    6060
    61 #include "prprf.h"
    62 
    6361#include "ipcConfig.h"
    6462#include "ipcMessage.h"
     
    205203    //
    206204    char buf[32];
    207     int nb = PR_snprintf(buf, sizeof(buf), "%u\n", (unsigned long) getpid());
    208     write(ipcLockFD, buf, nb);
     205    ssize_t nb = RTStrPrintf2(buf, sizeof(buf), "%u\n", (unsigned long) getpid());
     206    if (nb <= 0)
     207        return ELockFileOpen;
     208    write(ipcLockFD, buf, (size_t)nb);
    209209
    210210    return EOk;
  • trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcConfig.h

    r3372 r102345  
    3939#define ipcProto_h__
    4040
    41 #if defined(XP_WIN)
    42 //
    43 // use WM_COPYDATA messages
    44 //
    45 #include "prprf.h"
    46 
    47 #define IPC_WINDOW_CLASS              "Mozilla:IPCWindowClass"
    48 #define IPC_WINDOW_NAME               "Mozilla:IPCWindow"
    49 #define IPC_CLIENT_WINDOW_CLASS       "Mozilla:IPCAppWindowClass"
    50 #define IPC_CLIENT_WINDOW_NAME_PREFIX "Mozilla:IPCAppWindow:"
    51 #define IPC_SYNC_EVENT_NAME           "Local\\MozillaIPCSyncEvent"
    52 #ifndef IPC_DAEMON_APP_NAME
    53 #define IPC_DAEMON_APP_NAME           "mozilla-ipcd.exe"
    54 #endif
    55 #define IPC_PATH_SEP_CHAR             '\\'
    56 #define IPC_MODULES_DIR               "ipc\\modules"
    57 
    58 #define IPC_CLIENT_WINDOW_NAME_MAXLEN (sizeof(IPC_CLIENT_WINDOW_NAME_PREFIX) + 20)
    59 
    60 // writes client name into buf.  buf must be at least
    61 // IPC_CLIENT_WINDOW_NAME_MAXLEN bytes in length.
    62 inline void IPC_GetClientWindowName(PRUint32 pid, char *buf)
    63 {
    64     PR_snprintf(buf, IPC_CLIENT_WINDOW_NAME_MAXLEN, "%s%u",
    65                 IPC_CLIENT_WINDOW_NAME_PREFIX, pid);
    66 }
    67 
    68 #else
    6941#include "nscore.h"
    7042//
     
    8961NS_HIDDEN_(void) IPC_GetDefaultSocketPath(char *buf, PRUint32 bufLen);
    9062
    91 #endif
    92 
    9363// common shared configuration values
    9464
  • trunk/src/libs/xpcom18a4/java/src/nsJavaWrapper.cpp

    r102014 r102345  
    4949#include "nsProxyRelease.h"
    5050
     51#include <iprt/string.h>
     52
    5153static nsID nullID =  {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
    5254
     
    15031505                    nsXPIDLCString emsg;
    15041506                    ex->GetMessage(getter_Copies(emsg));
    1505                     PR_snprintf(msg, msgSize, "%s",
    1506                                 emsg.get());
     1507                    RTStrPrintf2(msg, msgSize, "%s",
     1508                                 emsg.get());
    15071509                    gotMsg = true;
    15081510                }
     
    15161518        if (strncmp(pMsg->pszMsgFull, "Unknown", 7) != 0)
    15171519        {
    1518             PR_snprintf(msg, msgSize, "%s (%s)",
    1519                         pMsg->pszMsgFull, pMsg->pszDefine);
     1520            RTStrPrintf2(msg, msgSize, "%s (%s)",
     1521                         pMsg->pszMsgFull, pMsg->pszDefine);
    15201522            gotMsg = true;
    15211523        }
     
    15241526    if (!gotMsg)
    15251527    {
    1526         PR_snprintf(msg, msgSize, "Error 0x%x in module 0x%x",
    1527                     NS_ERROR_GET_CODE(r), NS_ERROR_GET_MODULE(r));
     1528        RTStrPrintf2(msg, msgSize, "Error 0x%x in module 0x%x",
     1529                     NS_ERROR_GET_CODE(r), NS_ERROR_GET_MODULE(r));
    15281530    }
    15291531}
  • trunk/src/libs/xpcom18a4/xpcom/base/nsID.cpp

    r28914 r102345  
    3737 * ***** END LICENSE BLOCK ***** */
    3838#include "nsID.h"
    39 #include "prprf.h"
    4039#include "prmem.h"
     40
     41#include <iprt/string.h>
    4142
    4243static const char gIDFormat[] =
     
    130131
    131132  if (res != NULL) {
    132     PR_snprintf(res, 39, gIDFormat,
    133                 m0, (PRUint32) m1, (PRUint32) m2,
    134                 (PRUint32) m3[0], (PRUint32) m3[1], (PRUint32) m3[2],
    135                 (PRUint32) m3[3], (PRUint32) m3[4], (PRUint32) m3[5],
    136                 (PRUint32) m3[6], (PRUint32) m3[7]);
     133    RTStrPrintf2(res, 39, gIDFormat,
     134                 m0, (PRUint32) m1, (PRUint32) m2,
     135                 (PRUint32) m3[0], (PRUint32) m3[1], (PRUint32) m3[2],
     136                 (PRUint32) m3[3], (PRUint32) m3[4], (PRUint32) m3[5],
     137                 (PRUint32) m3[6], (PRUint32) m3[7]);
    137138  }
    138139  return res;
     
    142143void nsID::ToProvidedString(char (&dest)[NSID_LENGTH]) const
    143144{
    144   PR_snprintf(dest, NSID_LENGTH, gIDFormat,
    145               m0, (PRUint32) m1, (PRUint32) m2,
    146               (PRUint32) m3[0], (PRUint32) m3[1], (PRUint32) m3[2],
    147               (PRUint32) m3[3], (PRUint32) m3[4], (PRUint32) m3[5],
    148               (PRUint32) m3[6], (PRUint32) m3[7]);
     145  RTStrPrintf2(dest, NSID_LENGTH, gIDFormat,
     146               m0, (PRUint32) m1, (PRUint32) m2,
     147               (PRUint32) m3[0], (PRUint32) m3[1], (PRUint32) m3[2],
     148               (PRUint32) m3[3], (PRUint32) m3[4], (PRUint32) m3[5],
     149               (PRUint32) m3[6], (PRUint32) m3[7]);
    149150}
    150151#endif
  • trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp

    r102197 r102345  
    148148static void GetIDString(const nsID& aCID, char buf[UID_STRING_LENGTH])
    149149{
    150     PR_snprintf(buf, UID_STRING_LENGTH, gIDFormat,
    151                 aCID.m0, (PRUint32) aCID.m1, (PRUint32) aCID.m2,
    152                 (PRUint32) aCID.m3[0], (PRUint32) aCID.m3[1],
    153                 (PRUint32) aCID.m3[2], (PRUint32) aCID.m3[3],
    154                 (PRUint32) aCID.m3[4], (PRUint32) aCID.m3[5],
    155                 (PRUint32) aCID.m3[6], (PRUint32) aCID.m3[7]);
     150    RTStrPrintf2(buf, UID_STRING_LENGTH, gIDFormat,
     151                 aCID.m0, (PRUint32) aCID.m1, (PRUint32) aCID.m2,
     152                 (PRUint32) aCID.m3[0], (PRUint32) aCID.m3[1],
     153                 (PRUint32) aCID.m3[2], (PRUint32) aCID.m3[3],
     154                 (PRUint32) aCID.m3[4], (PRUint32) aCID.m3[5],
     155                 (PRUint32) aCID.m3[6], (PRUint32) aCID.m3[7]);
    156156}
    157157
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsSupportsPrimitives.cpp

    r1 r102345  
    3636 *
    3737 * ***** END LICENSE BLOCK ***** */
     38#include <iprt/string.h>
    3839
    3940#include "nsSupportsPrimitives.h"
    4041#include "nsCRT.h"
    4142#include "nsMemory.h"
    42 #include "prprf.h"
    4343#include "nsIInterfaceInfoManager.h"
    4444#include "nsDependentString.h"
     
    256256    char buf[size];
    257257
    258     PR_snprintf(buf, size, "%u", (PRUint16) mData);
     258    RTStrPrintf2(buf, size, "%u", (PRUint16) mData);
    259259
    260260    char* result = (char*) nsMemory::Clone(buf,
     
    301301    char buf[size];
    302302
    303     PR_snprintf(buf, size, "%u", (int) mData);
     303    RTStrPrintf2(buf, size, "%u", (int) mData);
    304304
    305305    char* result = (char*) nsMemory::Clone(buf,
     
    346346    char buf[size];
    347347
    348     PR_snprintf(buf, size, "%lu", mData);
     348    RTStrPrintf2(buf, size, "%lu", mData);
    349349
    350350    char* result = (char*) nsMemory::Clone(buf,
     
    391391    char buf[size];
    392392
    393     PR_snprintf(buf, size, "%llu", mData);
     393    RTStrPrintf2(buf, size, "%llu", mData);
    394394
    395395    char* result = (char*) nsMemory::Clone(buf,
     
    436436    char buf[size];
    437437
    438     PR_snprintf(buf, size, "%llu", mData);
     438    RTStrPrintf2(buf, size, "%llu", mData);
    439439
    440440    char* result = (char*) nsMemory::Clone(buf,
     
    526526    char buf[size];
    527527
    528     PR_snprintf(buf, size, "%d", mData);
     528    RTStrPrintf2(buf, size, "%d", mData);
    529529
    530530    char* result = (char*) nsMemory::Clone(buf,
     
    571571    char buf[size];
    572572
    573     PR_snprintf(buf, size, "%ld", mData);
     573    RTStrPrintf2(buf, size, "%ld", mData);
    574574
    575575    char* result = (char*) nsMemory::Clone(buf,
     
    616616    char buf[size];
    617617
    618     PR_snprintf(buf, size, "%lld", mData);
     618    RTStrPrintf2(buf, size, "%lld", mData);
    619619
    620620    char* result = (char*) nsMemory::Clone(buf,
     
    661661    char buf[size];
    662662
    663     PR_snprintf(buf, size, "%f", (double) mData);
     663    RTStrPrintf2(buf, size, "%f", (double) mData);
    664664
    665665    char* result = (char*) nsMemory::Clone(buf,
     
    706706    char buf[size];
    707707
    708     PR_snprintf(buf, size, "%f", mData);
     708    RTStrPrintf2(buf, size, "%f", mData);
    709709
    710710    char* result = (char*) nsMemory::Clone(buf,
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsVariant.cpp

    r102005 r102345  
    4242#include "nsVariant.h"
    4343#include "nsString.h"
    44 #include "prprf.h"
    4544#include <math.h>
    4645#include "nsCRT.h"
     
    816815        return NS_OK;
    817816
    818     // the rest can be PR_smprintf'd and use common code.
     817    // the rest can use RTStrAPrintf() and use common code.
    819818
    820819#define CASE__SMPRINTF_NUMBER(type_, format_, cast_, member_)                 \
    821820    case nsIDataType :: type_ :                                               \
    822         ptr = PR_smprintf( format_ , (cast_) data.u. member_ );               \
     821        RTStrAPrintf(&ptr, format_ , (cast_) data.u. member_ );               \
    823822        break;
    824823
     
    847846        return NS_ERROR_OUT_OF_MEMORY;
    848847    outString.Assign(ptr);
    849     PR_smprintf_free(ptr);
     848    RTStrFree(ptr);
    850849    return NS_OK;
    851850}
  • trunk/src/libs/xpcom18a4/xpcom/string/src/nsPrintfCString.cpp

    r1 r102345  
    3939#include "nsPrintfCString.h"
    4040#include <stdarg.h>
    41 #include "prprf.h"
    4241
     42#include <iprt/string.h>
    4343
    4444// though these classes define a fixed buffer, they do not set the F_FIXED
     
    5858
    5959    va_start(ap, format);
    60     mLength = PR_vsnprintf(mData, physical_capacity, format, ap);
     60    ssize_t cch = RTStrPrintf2V(mData, physical_capacity, format, ap);
     61    Assert(cch > 0);
     62    mLength = (size_type)cch;
    6163    va_end(ap);
    6264  }
     
    7981
    8082    va_start(ap, format);
    81     mLength = PR_vsnprintf(mData, physical_capacity, format, ap);
     83    ssize_t cch = RTStrPrintf2V(mData, physical_capacity, format, ap);
     84    Assert(cch > 0);
     85    mLength = (size_type)cch;
    8286    va_end(ap);
    8387  }
  • trunk/src/libs/xpcom18a4/xpcom/string/src/nsStringObsolete.cpp

    r102006 r102345  
    5151#include "nsCRT.h"
    5252#include "nsUTF8Utils.h"
    53 #include "prprf.h"
    5453
    5554#include <iprt/assert.h>
     
    11321131        fmt = "%x";
    11331132    }
    1134     PR_snprintf(buf, sizeof(buf), fmt, aInteger);
     1133    RTStrPrintf2(buf, sizeof(buf), fmt, aInteger);
    11351134    Append(buf);
    11361135  }
     
    11521151        fmt = "%x";
    11531152    }
    1154     PR_snprintf(buf, sizeof(buf), fmt, aInteger);
     1153    RTStrPrintf2(buf, sizeof(buf), fmt, aInteger);
    11551154    AppendASCIItoUTF16(buf, *this);
    11561155  }
     
    11721171        fmt = "%llx";
    11731172    }
    1174     PR_snprintf(buf, sizeof(buf), fmt, aInteger);
     1173    RTStrPrintf2(buf, sizeof(buf), fmt, aInteger);
    11751174    Append(buf);
    11761175  }
     
    11921191        fmt = "%llx";
    11931192    }
    1194     PR_snprintf(buf, sizeof(buf), fmt, aInteger);
     1193    RTStrPrintf2(buf, sizeof(buf), fmt, aInteger);
    11951194    AppendASCIItoUTF16(buf, *this);
    11961195  }
  • trunk/src/libs/xpcom18a4/xpcom/tests/TestAtoms.cpp

    r41166 r102345  
    3838#include "nsString.h"
    3939#include "nsReadableUtils.h"
    40 #include "prprf.h"
    4140#include "prtime.h"
    4241#include <stdio.h>
     42
     43#include <iprt/string.h>
    4344
    4445extern "C" int _CrtSetDbgFlag(int);
     
    114115  LL_SUB(dtor, end3, end2);
    115116  char buf[500];
    116   PR_snprintf(buf, sizeof(buf), "making %d ident strings took %lldms",
    117               count, creates);
     117  RTStrPrintf2(buf, sizeof(buf), "making %d ident strings took %lldms",
     118               count, creates);
    118119  puts(buf);
    119   PR_snprintf(buf, sizeof(buf), "%d new idents took %lldms",
    120               count, finds);
     120  RTStrPrintf2(buf, sizeof(buf), "%d new idents took %lldms",
     121               count, finds);
    121122  puts(buf);
    122   PR_snprintf(buf, sizeof(buf), "%d ident lookups took %lldms",
    123               count, lookups);
     123  RTStrPrintf2(buf, sizeof(buf), "%d ident lookups took %lldms",
     124               count, lookups);
    124125  puts(buf);
    125   PR_snprintf(buf, sizeof(buf), "dtor took %lldusec", dtor);
     126  RTStrPrintf2(buf, sizeof(buf), "dtor took %lldusec", dtor);
    126127  puts(buf);
    127128
  • trunk/src/libs/xpcom18a4/xpcom/threads/nsEventQueue.cpp

    r102016 r102345  
    4646
    4747#ifdef NS_DEBUG
    48 #include "prprf.h"
     48#include <iprt/string.h>
    4949#endif
    5050
     
    465465  if (depth > 5) {
    466466    char warning[80];
    467     PR_snprintf(warning, sizeof(warning),
    468       "event queue chain length is %d. this is almost certainly a leak.", depth);
     467    RTStrPrintf2(warning, sizeof(warning),
     468                 "event queue chain length is %d. this is almost certainly a leak.", depth);
    469469    NS_WARNING(warning);
    470470  }
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