VirtualBox

Ignore:
Timestamp:
Nov 21, 2023 10:50:09 AM (15 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160312
Message:

libs/xpcom/xpcom: Convert nsComponentManager registry reading from nsprpub to IPRT streams, bugref:10545

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp

    r102186 r102187  
    10381038    nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(file));
    10391039
    1040     rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd);
     1040    nsCAutoString pathName;
     1041    rv = localFile->GetNativePath(pathName);
    10411042    if (NS_FAILED(rv))
    10421043        return rv;
    10431044
    1044     PRInt64 fileSize;
    1045     rv = localFile->GetFileSize(&fileSize);
    1046     if (NS_FAILED(rv))
    1047     {
    1048         PR_Close(fd);
    1049         return rv;
    1050     }
    1051 
    1052     PRInt32 flen = nsInt64(fileSize);
     1045    size_t cbRead = 0;
     1046    RTFILE hFile = NIL_RTFILE;
     1047    int vrc = RTFileOpen(&hFile, pathName.get(),
     1048                         RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE);
     1049    if (RT_FAILURE(vrc))
     1050        return NS_ERROR_FAILURE;
     1051
     1052    uint64_t fileSize;
     1053    vrc = RTFileQuerySize(hFile, &fileSize);
     1054    if (RT_FAILURE(vrc))
     1055    {
     1056        RTFileClose(hFile);
     1057        return NS_ERROR_FAILURE;
     1058    }
     1059
     1060    PRInt32 flen = nsInt64((int64_t)fileSize);
    10531061    if (flen == 0)
    10541062    {
    1055         PR_Close(fd);
     1063        RTFileClose(hFile);
    10561064        NS_WARNING("Persistent Registry Empty!");
    10571065        return NS_OK; // ERROR CONDITION
     
    10621070        goto out;
    10631071
    1064     if (flen > PR_Read(fd, registry, flen))
     1072    vrc = RTFileRead(hFile, registry, flen, &cbRead);
     1073    if (RT_FAILURE(vrc) || cbRead < flen)
    10651074    {
    10661075        rv = NS_ERROR_FAILURE;
     
    12671276    mRegistryDirty = PR_FALSE;
    12681277out:
    1269     if (fd)
    1270         PR_Close(fd);
     1278    if (hFile != NIL_RTFILE)
     1279        RTFileClose(hFile);
    12711280
    12721281    if (registry)
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