VirtualBox

Changeset 104493 in vbox


Ignore:
Timestamp:
May 2, 2024 4:45:44 PM (7 months ago)
Author:
vboxsync
Message:

libs/xpcom/components: Some smaller cleanups, bugref:3409

Location:
trunk/src/libs/xpcom18a4/xpcom/components
Files:
2 edited

Legend:

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

    r103505 r104493  
    695695    mStaticComponentLoader(0),
    696696#endif
     697    mComponentsOffset(0),
     698    mGREComponentsOffset(0),
    697699    mShuttingDown(NS_SHUTDOWN_NEVERHAPPENED),
    698700    mLoaderData(nsnull),
     701    mNLoaderData(0),
     702    mMaxNLoaderData(0),
    699703    mRegistryDirty(PR_FALSE)
    700704{
     
    10481052        return NS_ERROR_FAILURE;
    10491053
    1050     uint64_t fileSize;
    1051     vrc = RTFileQuerySize(hFile, &fileSize);
     1054    uint64_t cbFile;
     1055    vrc = RTFileQuerySize(hFile, &cbFile);
    10521056    if (RT_FAILURE(vrc))
    10531057    {
     
    10561060    }
    10571061
    1058     PRInt32 flen = nsInt64((PRInt64)fileSize);
    1059     if (flen == 0)
     1062    if (cbFile == 0)
    10601063    {
    10611064        RTFileClose(hFile);
     
    10641067    }
    10651068
    1066     char* registry = new char[flen+1];
     1069    /* Some arbitrary upper limit we should never reach. */
     1070    if (cbFile > 128 * _1M)
     1071    {
     1072        RTFileClose(hFile);
     1073        NS_WARNING("Persistent Registry too large!");
     1074        return NS_ERROR_FAILURE;
     1075    }
     1076
     1077    char* registry = new char[cbFile+1];
    10671078    if (!registry)
    10681079        goto out;
    10691080
    1070     vrc = RTFileRead(hFile, registry, flen, &cbRead);
    1071     if (RT_FAILURE(vrc) || cbRead < flen)
     1081    vrc = RTFileRead(hFile, registry, cbFile, &cbRead);
     1082    if (RT_FAILURE(vrc) || cbRead < cbFile)
    10721083    {
    10731084        rv = NS_ERROR_FAILURE;
    10741085        goto out;
    10751086    }
    1076     registry[flen] = '\0';
    1077 
    1078     reader.Init(registry, flen);
     1087    registry[cbFile] = '\0';
     1088
     1089    reader.Init(registry, (PRUint32)cbFile);
    10791090
    10801091    if (ReadSectionHeader(reader, "HEADER"))
     
    26092620
    26102621    entry = new (mem) nsFactoryEntry(aClass, aFactory, entry);
    2611 
    2612     if (!entry)
    2613         return NS_ERROR_OUT_OF_MEMORY;
     2622    /* The following will never be true as we pass an already allocated memory buffer into new. */
     2623    //if (!entry)
     2624    //    return NS_ERROR_OUT_OF_MEMORY;
    26142625
    26152626    factoryTableEntry->mFactoryEntry = entry;
     
    27672778                                         aRegistryName, aRegistryNameLen,
    27682779                                         typeIndex);
    2769         if (!entry)
    2770             return NS_ERROR_OUT_OF_MEMORY;
     2780        /* The following will never be true as we pass an already allocated memory buffer into new. */
     2781        //if (!entry)
     2782        //    return NS_ERROR_OUT_OF_MEMORY;
    27712783
    27722784        nsFactoryTableEntry* factoryTableEntry =
  • trunk/src/libs/xpcom18a4/xpcom/components/nsNativeComponentLoader.cpp

    r102458 r104493  
    208208                        || RTStrICmp(leafName.get() + (leafName.Length() - sizeof(".dSYM") + 1), ".dSYM"))
    209209#endif
    210                         rv = RegisterComponentsInDir(when, dirEntry);
     210                        RegisterComponentsInDir(when, dirEntry);
    211211                }
    212212                else
     
    214214                    PRBool registered;
    215215                    // This is a file. Try to register it.
    216                     rv = AutoRegisterComponent(when, dirEntry, &registered);
     216                    AutoRegisterComponent(when, dirEntry, &registered);
    217217                }
    218218            }
     
    836836    }
    837837
     838    dll = new nsDll(spec, this);
    838839    if (!dll)
    839     {
    840         dll = new nsDll(spec, this);
    841         if (!dll)
    842             return NS_ERROR_OUT_OF_MEMORY;
    843     }
     840        return NS_ERROR_OUT_OF_MEMORY;
    844841
    845842    *aDll = dll;
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