VirtualBox

Changeset 62448 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jul 22, 2016 2:51:49 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
109001
Message:

IPRT: More MSC level 4 warning fixes.

Location:
trunk/src/VBox/Runtime/common
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/asn1/asn1-ut-objid.cpp

    r57358 r62448  
    430430        RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator);
    431431        pThis->cComponents = pSrc->cComponents;
     432#if 0 /** @todo breaks with arrays of ObjIds or structs containing them. They get resized and repositioned in memory, thus invalidating the pointer. Add recall-pointers callback, or just waste memory? Or maybe make all arrays pointer-arrays? */
    432433        size_t cbLeft = sizeof(pThis->szObjId);
    433 #if 0 /** @todo breaks with arrays of ObjIds or structs containing them. They get resized and repositioned in memory, thus invalidating the pointer. Add recall-pointers callback, or just waste memory? Or maybe make all arrays pointer-arrays? */
    434434        if (pSrc->cComponents * sizeof(uint32_t) <= cbLeft)
    435435        {
  • trunk/src/VBox/Runtime/common/asn1/asn1-ut-string.cpp

    r57358 r62448  
    518518    while (i-- > 0)
    519519    {
    520         uint32_t cchMatch;
     520        uint32_t cchMatch = 0; /* (MSC maybe used uninitialized) */
    521521        PCRTISO2022MAP pMap = papMaps[i];
    522522        /** @todo skip non-Teletex codesets if we ever add more than we need for it. */
     
    530530            return cchMatch + 1;
    531531        }
    532         else if (!ppMapRet) /* ppMapRet is NULL if Gn. */
     532
     533        if (!ppMapRet) /* ppMapRet is NULL if Gn. */
    533534        {
    534535            uint32_t iGn;
     
    10331034    if (RT_SUCCESS(rc))
    10341035    {
    1035         size_t cchUtf8 = 0;
    10361036        for (;;)
    10371037        {
  • trunk/src/VBox/Runtime/common/crypto/digest-builtin.cpp

    r61892 r62448  
    639639static DECLCALLBACK(RTDIGESTTYPE) rtCrDigestOsslEvp_GetDigestType(void *pvState)
    640640{
    641     EVP_MD_CTX *pThis = (EVP_MD_CTX *)pvState;
     641    //EVP_MD_CTX *pThis = (EVP_MD_CTX *)pvState;
    642642    /** @todo figure which digest algorithm it is! */
    643643    return RTDIGESTTYPE_UNKNOWN;
  • trunk/src/VBox/Runtime/common/crypto/store-inmem.cpp

    r57572 r62448  
    236236static DECLCALLBACK(int) rtCrStoreInMem_CertFindAll(void *pvProvider, PRTCRSTORECERTSEARCH pSearch)
    237237{
    238     PRTCRSTOREINMEM pThis = (PRTCRSTOREINMEM)pvProvider;
    239238    pSearch->auOpaque[0] = ~(uintptr_t)pvProvider;
    240239    pSearch->auOpaque[1] = 0;
  • trunk/src/VBox/Runtime/common/crypto/x509-certpaths.cpp

    r59678 r62448  
    26532653    int      rcLastFailure = VINF_SUCCESS;
    26542654    uint32_t cValidPaths   = 0;
    2655     uint32_t iPath         = 0;
    26562655    PRTCRX509CERTPATHNODE pCurLeaf;
    26572656    RTListForEach(&pThis->LeafList, pCurLeaf, RTCRX509CERTPATHNODE, ChildListOrLeafEntry)
  • trunk/src/VBox/Runtime/common/dbg/dbgcfg.cpp

    r57944 r62448  
    14011401        if (RT_SUCCESS(rc2))
    14021402        {
    1403             size_t cchCurPath = cchPath + strlen(&pszPath[cchPath]);
    14041403            for (uint32_t iSuffix = 0; papszSuffixes[iSuffix]; iSuffix++)
    14051404            {
  • trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp

    r60798 r62448  
    278278
    279279
     280#ifdef LOG_ENABLED
    280281/**
    281282 * Gets a name string for a subsection type.
     
    325326    return s_sz;
    326327}
    327 
    328 
     328#endif /* LOG_ENABLED */
     329
     330
     331#ifdef LOG_ENABLED
    329332/**
    330333 * Gets a name string for a symbol type.
     
    337340    switch (enmSymType)
    338341    {
    339 #define CASE_RET_STR(Name)  case kCvSymType_##Name: return #Name;
     342# define CASE_RET_STR(Name)  case kCvSymType_##Name: return #Name;
    340343        CASE_RET_STR(Compile);
    341344        CASE_RET_STR(Register);
     
    446449    return "<unknown type>";
    447450}
     451#endif /* LOG_ENABLED */
    448452
    449453
     
    739743                    /*uint32_t uEnd          =*/ *uCursor.pu32++;
    740744                    /*uint32_t uNext         =*/ *uCursor.pu32++;
    741                     uint32_t cbProc        = *uCursor.pu32++;
     745                    /*uint32_t cbProc        =*/ *uCursor.pu32++;
    742746                    /*uint32_t offDebugStart =*/ *uCursor.pu32++;
    743747                    /*uint32_t offDebugEnd   =*/ *uCursor.pu32++;
     
    10291033        {
    10301034            PCRTCV8SRCINFO pSrcInfo = (PCRTCV8SRCINFO)&pThis->pbSrcInfo[off];
     1035#ifdef LOG_ENABLED
    10311036            const char    *pszName  = pSrcInfo->offSourceName < pThis->cbSrcStrings
    10321037                                    ? &pThis->pchSrcStrings[pSrcInfo->offSourceName] : "out-of-bounds.c!";
     
    10371042            else
    10381043                Log3(("    %010zx #%03zu: !%#x! %#x=%s\n", off, iFile, pSrcInfo->uDigestType, pSrcInfo->offSourceName, pszName));
     1044#endif
    10391045            off += pSrcInfo->uDigestType == RTCV8SRCINFO_DIGEST_TYPE_MD5 ? sizeof(*pSrcInfo) : 8;
    10401046            iFile++;
     
    11211127    uCursor.pv = pvSubSect;
    11221128    RTDBGMODCV_CHECK_NOMSG_RET_BF(cbSubSect >= 2 + 2 + 2 + 2 + 0 + 1);
    1123     uint16_t iOverlay = *uCursor.pu16++;
    1124     uint16_t iLib     = *uCursor.pu16++;
     1129    uint16_t iOverlay = *uCursor.pu16++; NOREF(iOverlay);
     1130    uint16_t iLib     = *uCursor.pu16++; NOREF(iLib);
    11251131    uint16_t cSegs    = *uCursor.pu16++;
    11261132    pThis->uCurStyle  = *uCursor.pu16++;
     
    11331139    RTDBGMODCV_CHECK_NOMSG_RET_BF(cbSubSect >= 2 + 2 + 2 + 2 + cSegs * 12U + 1 + cchName);
    11341140
     1141#ifdef LOG_ENABLED
    11351142    const char *pchName = (const char *)&uCursor.pu8[cSegs * 12 + 1];
    11361143    Log2(("RTDbgModCv: Module: iOverlay=%#x iLib=%#x cSegs=%#x Style=%c%c (%#x) %.*s\n", iOverlay, iLib, cSegs,
    11371144          RT_BYTE1(pThis->uCurStyle), RT_BYTE2(pThis->uCurStyle), pThis->uCurStyle, cchName, pchName));
     1145#endif
    11381146    RTDBGMODCV_CHECK_NOMSG_RET_BF(pThis->uCurStyle == RT_MAKE_U16('C', 'V'));
    11391147
     1148#ifdef LOG_ENABLED
    11401149    PCRTCVMODSEGINFO32 paSegs = (PCRTCVMODSEGINFO32)uCursor.pv;
    11411150    for (uint16_t iSeg = 0; iSeg < cSegs; iSeg++)
    11421151        Log2(("    #%02u: %04x:%08x LB %08x\n", iSeg, paSegs[iSeg].iSeg, paSegs[iSeg].off, paSegs[iSeg].cb));
     1152#endif
    11431153
    11441154    return VINF_SUCCESS;
     
    11811191    Log2(("RTDbgModCv: SrcModule: cFiles=%u cSegs=%u\n", pHdr->cFiles, pHdr->cFiles));
    11821192    RTDBGMODCV_CHECK_RET_BF(cbSubSect >= cbHdr, ("cbSubSect=%#x cbHdr=%zx\n", cbSubSect, cbHdr));
     1193#ifdef LOG_ENABLED
    11831194    if (LogIs2Enabled())
    11841195    {
     
    11901201            Log2(("RTDbgModCv:   seg #%u: %#010x-%#010x\n", paidxSegs[i], paSegRanges[i].offStart, paSegRanges[i].offEnd));
    11911202    }
     1203#endif
    11921204
    11931205    /*
     
    13331345        if (i == pHdr->cLogSegs)
    13341346            Log2(("Group/Physical descriptors: %u\n", pHdr->cSegs - pHdr->cLogSegs));
    1335         uint16_t idx = i < pHdr->cLogSegs ? i : i - pHdr->cLogSegs;
    13361347        char szFlags[16];
    13371348        memset(szFlags, '-', sizeof(szFlags));
     
    13541365            szFlags[8]  = '!', szFlags[9] = '\0';
    13551366        Log2(("    #%02u: %#010x LB %#010x flags=%#06x ovl=%#06x group=%#06x frame=%#06x iSegName=%#06x iClassName=%#06x %s\n",
    1356               idx, paDescs[i].off, paDescs[i].cb, paDescs[i].fFlags, paDescs[i].iOverlay, paDescs[i].iGroup,
    1357               paDescs[i].iFrame, paDescs[i].offSegName, paDescs[i].offClassName, szFlags));
     1367              i < pHdr->cLogSegs ? i : i - pHdr->cLogSegs, paDescs[i].off, paDescs[i].cb, paDescs[i].fFlags, paDescs[i].iOverlay,
     1368              paDescs[i].iGroup, paDescs[i].iFrame, paDescs[i].offSegName, paDescs[i].offClassName, szFlags));
    13581369
    13591370        RTDBGMODCV_CHECK_NOMSG_RET_BF(paDescs[i].offSegName == UINT16_MAX || paDescs[i].offSegName < pThis->cbSegNames);
     
    16131624    for (i = 0; i < pHdr->cSegs; i++)
    16141625        if (paDescs[i].fFlags & RTCVSEGMAPDESC_F_ABS)
    1615             paDescs[i].iGroup = (uint16_t)RTDBGSEGIDX_ABS;
     1626            paDescs[i].iGroup = (uint16_t)(RTDBGSEGIDX_ABS & UINT16_MAX);
    16161627        else if ((paDescs[i].fFlags & RTCVSEGMAPDESC_F_GROUP) || fNoGroups)
    16171628            paDescs[i].iGroup = iSeg++;
     
    20452056 */
    20462057
     2058#ifdef LOG_ENABLED
    20472059static const char *rtDbgModCvGetCoffStorageClassName(uint8_t bStorageClass)
    20482060{
     
    20832095    return s_szName;
    20842096}
     2097#endif /* LOG_ENABLED */
    20852098
    20862099
     
    21042117        {
    21052118            int rc = RTDbgModLineAdd(pThis->hCnt, pszFile, pCur->Linenumber, RTDBGSEGIDX_RVA, pCur->Type.VirtualAddress, NULL);
    2106             Log4(("    %#010x: %u  [%Rrc]\n", pCur->Type.VirtualAddress, pCur->Linenumber, rc));
     2119            Log4(("    %#010x: %u  [%Rrc]\n", pCur->Type.VirtualAddress, pCur->Linenumber, rc)); NOREF(rc);
    21072120        }
    21082121        pCur++;
  • trunk/src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp

    r57978 r62448  
    10311031#if defined(LOG_ENABLED) || defined(RT_STRICT)
    10321032
     1033# if 0 /* unused */
    10331034/**
    10341035 * Turns a tag value into a string for logging purposes.
     
    10501051    return s_szStatic;
    10511052}
     1053# endif
    10521054
    10531055
  • trunk/src/VBox/Runtime/common/dvm/dvmmbr.cpp

    r57444 r62448  
    216216                                                  bool *pfUsed)
    217217{
    218     PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
    219 
     218    NOREF(hVolMgrFmt);
    220219    NOREF(cbRange);
    221220
    222221    /* MBR uses the first sector only. */
    223     if (off < 512)
    224         *pfUsed = true;
    225     else
    226         *pfUsed = false;
    227 
     222    *pfUsed = off < 512;
    228223    return VINF_SUCCESS;
    229224}
  • trunk/src/VBox/Runtime/common/err/errmsg.cpp

    r57926 r62448  
    7979RTDECL(PCRTSTATUSMSG) RTErrGet(int rc)
    8080{
    81     unsigned iFound = ~0;
     81    unsigned iFound = ~0U;
    8282    unsigned i;
    8383    for (i = 0; i < RT_ELEMENTS(g_aStatusMsgs) - 1; i++)
  • trunk/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h

    r60450 r62448  
    241241            const char *pszName = ELF_STR(pModElf, pSym->st_name);
    242242            RTUINTPTR   ExtValue;
    243             int rc = pfnGetImport(&pModElf->Core, "", pszName, ~0, &ExtValue, pvUser);
     243            int rc = pfnGetImport(&pModElf->Core, "", pszName, ~0U, &ExtValue, pvUser);
    244244            AssertMsgRCReturn(rc, ("Failed to resolve '%s' rc=%Rrc\n", pszName, rc), rc);
    245245            SymValue = (Elf_Addr)ExtValue;
     
    445445            /* Try to resolve the symbol. */
    446446            RTUINTPTR Value;
    447             int rc = pfnGetImport(&pModElf->Core, "", pszName, ~0, &Value, pvUser);
     447            int rc = pfnGetImport(&pModElf->Core, "", pszName, ~0U, &Value, pvUser);
    448448            if (RT_FAILURE(rc))
    449449            {
     
    747747                 */
    748748                AssertMsgReturn(Value == (RTUINTPTR)Value, (FMT_ELF_ADDR "\n", Value), VERR_SYMBOL_VALUE_TOO_BIG);
    749                 rc = pfnCallback(pMod, pszName, ~0, (RTUINTPTR)Value, pvUser);
     749                rc = pfnCallback(pMod, pszName, ~0U, (RTUINTPTR)Value, pvUser);
    750750                if (rc)
    751751                    return rc;
  • trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp

    r61936 r62448  
    673673                     && pThunk->u1.Ordinal < pModPe->cbImage)
    674674            {
    675                 rc = pfnGetImport(&pModPe->Core, pszModName, PE_RVA2TYPE(pvBitsR, (char*)(uintptr_t)pThunk->u1.AddressOfData + 2, const char *),
    676                                   ~0, &Value, pvUser);
     675                rc = pfnGetImport(&pModPe->Core, pszModName,
     676                                  PE_RVA2TYPE(pvBitsR, (char*)(uintptr_t)pThunk->u1.AddressOfData + 2, const char *),
     677                                  ~0U, &Value, pvUser);
    677678                Log4((RT_SUCCESS(rc) ? "RTLdrPE:  %RTptr %s\n" : "RTLdrPE:  %08RX32 %s rc=%Rrc\n",
    678679                      (uint32_t)Value, PE_RVA2TYPE(pvBitsR, (char*)(uintptr_t)pThunk->u1.AddressOfData + 2, const char *), rc));
     
    713714
    714715/** @copydoc RTLDROPSPE::pfnResolveImports */
    715 static DECLCALLBACK(int) rtldrPEResolveImports64(PRTLDRMODPE pModPe, const void *pvBitsR, void *pvBitsW, PFNRTLDRIMPORT pfnGetImport, void *pvUser)
     716static DECLCALLBACK(int) rtldrPEResolveImports64(PRTLDRMODPE pModPe, const void *pvBitsR, void *pvBitsW,
     717                                                 PFNRTLDRIMPORT pfnGetImport, void *pvUser)
    716718{
    717719    /*
     
    766768                /** @todo add validation of the string pointer! */
    767769                rc = pfnGetImport(&pModPe->Core, pszModName, PE_RVA2TYPE(pvBitsR, (uintptr_t)pThunk->u1.AddressOfData + 2, const char *),
    768                                   ~0, &Value, pvUser);
     770                                  ~0U, &Value, pvUser);
    769771                Log4((RT_SUCCESS(rc) ? "RTLdrPE:  %016RX64 %s\n" : "RTLdrPE:  %016RX64 %s rc=%Rrc\n",
    770772                      (uint64_t)Value, PE_RVA2TYPE(pvBitsR, (uintptr_t)pThunk->u1.AddressOfData + 2, const char *), rc));
     
    788790 * Applies fixups.
    789791 */
    790 static int rtldrPEApplyFixups(PRTLDRMODPE pModPe, const void *pvBitsR, void *pvBitsW, RTUINTPTR BaseAddress, RTUINTPTR OldBaseAddress)
     792static int rtldrPEApplyFixups(PRTLDRMODPE pModPe, const void *pvBitsR, void *pvBitsW, RTUINTPTR BaseAddress,
     793                              RTUINTPTR OldBaseAddress)
    791794{
    792795    if (    !pModPe->RelocDir.VirtualAddress
     
    20372040
    20382041
     2042#ifndef IPRT_WITHOUT_LDR_VERIFY
    20392043/**
    20402044 * Returns the digest size for the given digest type.
     
    20542058    }
    20552059}
     2060#endif
    20562061
    20572062
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r62436 r62448  
    474474
    475475    va_start(args, pszFormat);
    476     rtlogLoggerExVLocked(pLogger, 0, ~0, pszFormat, args);
     476    rtlogLoggerExVLocked(pLogger, 0, ~0U, pszFormat, args);
    477477    va_end(args);
    478478}
     
    494494
    495495    va_start(args, pszFormat);
    496     RTLogLoggerExV(pLogger, 0, ~0, pszFormat, args);
     496    RTLogLoggerExV(pLogger, 0, ~0U, pszFormat, args);
    497497    va_end(args);
    498498}
  • trunk/src/VBox/Runtime/common/math/bignum.cpp

    r59747 r62448  
    11011101    {
    11021102        RTBIGNUM_ASSERT_VALID(pLeft);
    1103         if (pLeft->fNegative == (iRight < 0))
     1103        if (pLeft->fNegative == (unsigned)(iRight < 0)) /* (unsigned cast is for MSC weirdness) */
    11041104        {
    11051105            AssertCompile(RTBIGNUM_ELEMENT_SIZE <= sizeof(iRight));
     
    17291729    {
    17301730        int rc = rtBigNumSetUsed(pBigNum, cUsed + 1);
     1731        AssertRCReturn(rc, rc);
    17311732        pBigNum->pauElements[cUsed] = uCarry;
    17321733    }
  • trunk/src/VBox/Runtime/common/net/netaddrstr2.cpp

    r58438 r62448  
    224224         * "::" compressed zero run.
    225225         */
     226        pszNext = NULL; /* (MSC incorrectly thinks it may be used unitialized) */
    226227        for (iGroup = 0; iGroup < 8; ++iGroup)
    227228        {
  • trunk/src/VBox/Runtime/common/path/RTPathExt.cpp

    r57358 r62448  
    6565    }
    6666
    67     /* will never get here */
    68     return NULL;
     67    /* not reached */
    6968}
    7069
  • trunk/src/VBox/Runtime/common/path/RTPathParse.cpp.h

    r56290 r62448  
    209209
    210210                    /* look for an ? */
    211                     uint16_t cDots  = 0;
    212211                    uint32_t offSuffix = offStart + cchComp;
    213212                    while (offSuffix-- > offStart)
  • trunk/src/VBox/Runtime/common/path/RTPathParseSimple.cpp

    r57358 r62448  
    114114
    115115    /* will never get here */
    116     return 0;
    117116}
    118117
  • trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp

    r59827 r62448  
    583583            {
    584584
    585                 pBufDesc->off      = RTVfsIoStrmTell(pThis->hIos);
    586                 size_t cbRead      = 0;
    587                 size_t cbToRead    = pThis->cbBuffer;
     585                pBufDesc->off = RTVfsIoStrmTell(pThis->hIos);
     586                size_t cbRead = 0;
    588587                rc = RTVfsIoStrmRead(pThis->hIos, pBufDesc->pbBuffer, pThis->cbBuffer, true /*fBlocking*/, &cbRead);
    589588                if (RT_SUCCESS(rc))
  • trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp

    r57372 r62448  
    478478    if (RT_SUCCESS(rc))
    479479    {
    480         uint8_t *offStart = pu8Buf;
    481480        pu8Buf += pThis->cdh.cbFilename;
    482481        cb      = pThis->cdh.cbExtra;
     
    767766static DECLCALLBACK(int) rtZipPkzipFssBaseObj_Close(void *pvThis)
    768767{
    769     PRTZIPPKZIPBASEOBJ pThis = (PRTZIPPKZIPBASEOBJ)pvThis;
    770 
     768    NOREF(pvThis);
    771769    return VINF_SUCCESS;
    772770}
  • trunk/src/VBox/Runtime/common/zip/tarcmd.cpp

    r59826 r62448  
    401401}
    402402
     403#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
    403404
    404405/**
     
    463464}
    464465
     466#endif /* !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2) */
    465467
    466468
     
    596598                              rc, pszName);
    597599
    598     const char *pszLinkType = NULL;
    599600    char szTarget[RTPATH_MAX];
    600601    szTarget[0] = '\0';
  • trunk/src/VBox/Runtime/common/zip/unzipcmd.cpp

    r57358 r62448  
    477477            return rtZipUnzipDoWithMembers(&Opts, rtZipUnzipCmdExtractCallback, &cFiles, &cBytes);
    478478    }
    479 
    480     return RTEXITCODE_SUCCESS;
    481 }
     479}
  • trunk/src/VBox/Runtime/common/zip/zip.cpp

    r60048 r62448  
    531531            return zipErrConvertFromZlib(rc, true /*fCompressing*/);
    532532    }
    533     return VINF_SUCCESS;
    534533}
    535534
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