Changeset 28


Ignore:
Timestamp:
Mar 28, 2009, 7:37:20 PM (16 years ago)
Author:
bird
Message:

shut up gcc warnings.

Location:
trunk/kLdr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/kLdrModLX.c

    r25 r28  
    10751075                        uValue = 0; /** @todo implement enumeration of forwarders properly. */
    10761076                        fKind = KLDRSYMKIND_FORWARDER;
     1077                        break;
     1078
     1079                    default: /* shut up gcc. */
     1080                        uValue = 0;
     1081                        fKind = KLDRSYMKIND_NO_BIT | KLDRSYMKIND_NO_TYPE;
    10771082                        break;
    10781083                }
     
    16721677                    pbSrc += cb1;
    16731678
    1674                     if (off > OBJPAGELEN - cbDst)
     1679                    if (off > OBJPAGELEN - (unsigned)cbDst)
    16751680                        return KLDR_ERR_LX_BAD_ITERDATA2;
    16761681                    cbDst -= cb2;
     
    17071712
    17081713                    pbSrc += 2;
    1709                     if (off > OBJPAGELEN - cbDst)
     1714                    if (off > OBJPAGELEN - (unsigned)cbDst)
    17101715                        return KLDR_ERR_LX_BAD_ITERDATA2;
    17111716                    cbDst -= cb;
     
    17531758                    pbSrc += cb1;
    17541759
    1755                     if (off > OBJPAGELEN - cbDst)
     1760                    if (off > OBJPAGELEN - (unsigned)cbDst)
    17561761                        return KLDR_ERR_LX_BAD_ITERDATA2;
    17571762                    cbDst -= cb2;
     
    24082413                        KLDRMODLX_ASSERT(!"NRRENT");
    24092414                    default:
     2415                        iSelector = -1;
    24102416                        break;
    24112417                }
  • trunk/kLdr/kLdrModMachO.c

    r25 r28  
    10801080                            pSectExtra->RVA = pSect->addr;
    10811081                            pSectExtra->LinkAddress = pSect->addr;
    1082                             pSectExtra->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1;
     1082                            if (pSect->offset)
     1083                                pSectExtra->offFile = pSect->offset + pModMachO->offImage;
     1084                            else
     1085                                pSectExtra->offFile = -1;
    10831086                            pSectExtra->cFixups = pSect->nreloc;
    10841087                            pSectExtra->paFixups = NULL;
    1085                             pSectExtra->offFixups = pSect->nreloc ? pSect->reloff + pModMachO->offImage : -1;
     1088                            if (pSect->nreloc)
     1089                                pSectExtra->offFixups = pSect->reloff + pModMachO->offImage;
     1090                            else
     1091                                pSectExtra->offFixups = -1;
    10861092                            pSectExtra->fFlags = pSect->flags;
    10871093                            pSectExtra->iSegment = pSegExtra - &pModMachO->aSegments[0];
     
    11171123                                pSeg->Alignment = (1 << pSect->align);
    11181124                                pSeg->LinkAddress = pSect->addr;
    1119                                 pSeg->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1;
    1120                                 pSeg->cbFile  = pSect->offset ? pSect->size : -1;
     1125                                if (pSect->offset)
     1126                                {
     1127                                    pSeg->offFile = pSect->offset + pModMachO->offImage;
     1128                                    pSeg->cbFile  = pSect->size;
     1129                                }
     1130                                else
     1131                                {
     1132                                    pSeg->offFile = -1;
     1133                                    pSeg->cbFile  = -1;
     1134                                }
    11211135                                pSeg->RVA = pSect->addr - pModMachO->LinkAddress;
    11221136                                pSeg->cbMapped = 0;
     
    11331147                            {
    11341148                                /* update exiting segment */
    1135                                 if (pSeg[-1].Alignment < (1 << pSect->align))
    1136                                     pSeg[-1].Alignment = (1 << pSect->align);
     1149                                if (pSeg[-1].Alignment < K_BIT64(pSect->align))
     1150                                    pSeg[-1].Alignment = K_BIT64(pSect->align);
    11371151                                if (pSect->addr < pSeg[-1].LinkAddress)
    11381152                                    return KLDR_ERR_MACHO_BAD_SECTION; /** @todo move up! */
     
    11411155                                   (yes, we are very very careful here, I know.) */
    11421156                                if (    pSect->offset
    1143                                     &&  pSeg[-1].cbFile == pSeg[-1].cb)
     1157                                    &&  (KU64)pSeg[-1].cbFile == pSeg[-1].cb)
    11441158                                {
    1145                                     int fOk = pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset + pModMachO->offImage
     1159                                    int fOk = (KU64)pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset + (KU64)pModMachO->offImage
    11461160                                           && pSect[-1].offset
    1147                                            && pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset + pModMachO->offImage + pSect[-1].size;
     1161                                           && (KU64)pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset + (KU64)pModMachO->offImage + pSect[-1].size;
    11481162                                    /* more checks? */
    11491163                                    if (fOk)
     
    11971211                            pSectExtra->RVA = pSect->addr;
    11981212                            pSectExtra->LinkAddress = pSect->addr;
    1199                             pSectExtra->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1;
     1213                            if (pSect->offset)
     1214                                pSectExtra->offFile = pSect->offset + pModMachO->offImage;
     1215                            else
     1216                                pSectExtra->offFile = -1;
    12001217                            pSectExtra->cFixups = pSect->nreloc;
    12011218                            pSectExtra->paFixups = NULL;
    1202                             pSectExtra->offFixups = pSect->nreloc ? pSect->reloff + pModMachO->offImage : -1;
     1219                            if (pSect->nreloc)
     1220                                pSectExtra->offFixups = pSect->reloff + pModMachO->offImage;
     1221                            else
     1222                                pSectExtra->offFixups = -1;
    12031223                            pSectExtra->fFlags = pSect->flags;
    12041224                            pSectExtra->iSegment = pSegExtra - &pModMachO->aSegments[0];
     
    12341254                                pSeg->Alignment = (1 << pSect->align);
    12351255                                pSeg->LinkAddress = pSect->addr;
    1236                                 pSeg->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1;
    1237                                 pSeg->cbFile  = pSect->offset ? pSect->size : -1;
     1256                                if (pSect->offset)
     1257                                {
     1258                                    pSeg->offFile = pSect->offset + pModMachO->offImage;
     1259                                    pSeg->cbFile  = pSect->size;
     1260                                }
     1261                                else
     1262                                {
     1263                                    pSeg->offFile = -1;
     1264                                    pSeg->cbFile  = -1;
     1265                                }
    12381266                                pSeg->RVA = pSect->addr - pModMachO->LinkAddress;
    12391267                                pSeg->cbMapped = 0;
     
    12501278                            {
    12511279                                /* update exiting segment */
    1252                                 if (pSeg[-1].Alignment < (1 << pSect->align))
    1253                                     pSeg[-1].Alignment = (1 << pSect->align);
     1280                                if (pSeg[-1].Alignment < K_BIT64(pSect->align))
     1281                                    pSeg[-1].Alignment = K_BIT64(pSect->align);
    12541282                                if (pSect->addr < pSeg[-1].LinkAddress)
    12551283                                    return KLDR_ERR_MACHO_BAD_SECTION; /** @todo move up! */
     
    12581286                                   (yes, we are very very careful here, I know.) */
    12591287                                if (    pSect->offset
    1260                                     &&  pSeg[-1].cbFile == pSeg[-1].cb)
     1288                                    &&  (KU64)pSeg[-1].cbFile == pSeg[-1].cb)
    12611289                                {
    1262                                     int fOk = pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset + pModMachO->offImage
     1290                                    int fOk = (KU64)pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset + (KU64)pModMachO->offImage
    12631291                                           && pSect[-1].offset
    1264                                            && pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset + pModMachO->offImage + pSect[-1].size;
     1292                                           && (KU64)pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset + (KU64)pModMachO->offImage + pSect[-1].size;
    12651293                                    /* more checks? */
    12661294                                    if (fOk)
     
    25662594    KLDRPU uFixVirgin;
    25672595    KLDRPU uFix;
    2568     KLDRADDR SymAddr;
     2596    KLDRADDR SymAddr = ~(KLDRADDR)0;
    25692597    int rc;
    25702598
  • trunk/kLdr/kLdrModPE.c

    r25 r28  
    11961196        rc = pfnCallback(pMod, iDbgInfo,
    11971197                         enmDbgInfoType, pDbgDir->MajorVersion, pDbgDir->MinorVersion,
    1198                          pDbgDir->PointerToRawData ? pDbgDir->PointerToRawData : -1,
     1198                         pDbgDir->PointerToRawData ? (KLDRFOFF)pDbgDir->PointerToRawData : -1,
    11991199                         pDbgDir->AddressOfRawData ? pDbgDir->AddressOfRawData : NIL_KLDRADDR,
    12001200                         pDbgDir->SizeOfData,
Note: See TracChangeset for help on using the changeset viewer.