VirtualBox

Changeset 18511 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Mar 29, 2009 3:09:25 AM (16 years ago)
Author:
vboxsync
Message:

vrdptext.c: size_t warning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/vrdptext.c

    r8155 r18511  
    7878 *
    7979 */
    80  
     80
    8181static BOOL vboxReportGlyph (GLYPHPOS *pGlyphPos, uint8_t **ppu8Ptr, uint8_t *pu8End)
    8282{
    8383    uint32_t cbOrder;
    8484    uint32_t cbBitmap;
    85    
     85
    8686    VRDPORDERGLYPH *pOrder = (VRDPORDERGLYPH *)*ppu8Ptr;
    87    
     87
    8888    GLYPHBITS *pgb = pGlyphPos->pgdf->pgb;
    89    
     89
    9090    /* BYTE-aligned 1BPP bitmap of the glyph. The array includes padding at the end to DWORD-align. */
    9191    cbBitmap = (pgb->sizlBitmap.cx + 7) / 8; /* Line size in bytes. */
    9292    cbBitmap *= pgb->sizlBitmap.cy;          /* Size of bitmap. */
    9393    cbBitmap = (cbBitmap + 3) & ~3;          /* DWORD align. */
    94    
    95     cbOrder = (uint8_t *)&pOrder->au8Bitmap - (uint8_t *)pOrder;
    96    
     94
     95    cbOrder = (uint32_t)((uint8_t *)&pOrder->au8Bitmap - (uint8_t *)pOrder);
     96
    9797    cbOrder += cbBitmap;
    98    
     98
    9999    if (*ppu8Ptr + cbOrder > pu8End)
    100100    {
    101101        return FALSE;
    102102    }
    103    
     103
    104104    pOrder->o32NextGlyph = cbOrder;
    105    
     105
    106106    pOrder->u64Handle = RTCrc64Start ();
    107107    pOrder->u64Handle = RTCrc64Process(pOrder->u64Handle, pgb->aj, cbBitmap);
    108108    pOrder->u64Handle = RTCrc64Process(pOrder->u64Handle, &pgb->ptlOrigin, sizeof (pgb->ptlOrigin));
    109109    pOrder->u64Handle = RTCrc64Finish(pOrder->u64Handle);
    110    
     110
    111111    pOrder->x = (int16_t)pGlyphPos->ptl.x;
    112112    pOrder->y = (int16_t)pGlyphPos->ptl.y;
    113    
     113
    114114    pOrder->w = (uint16_t)pgb->sizlBitmap.cx;
    115115    pOrder->h = (uint16_t)pgb->sizlBitmap.cy;
     
    117117    pOrder->xOrigin = (int16_t)pgb->ptlOrigin.x;
    118118    pOrder->yOrigin = (int16_t)pgb->ptlOrigin.y;
    119    
     119
    120120    /* 1BPP bitmap. Rows are byte aligned. Size is (((w + 7)/8) * h + 3) & ~3. */
    121121    memcpy (pOrder->au8Bitmap, pgb->aj, cbBitmap);
    122    
     122
    123123    *ppu8Ptr += cbOrder;
    124    
     124
    125125    return TRUE;
    126126}
     
    129129{
    130130    uint32_t cb = sizeof (VRDPORDERTEXT);
    131    
     131
    132132    cb += cGlyphs * (sizeof (VRDPORDERGLYPH) + cbMaxGlyph);
    133    
     133
    134134    return cb;
    135135}
     
    150150    uint8_t *pu8GlyphPtr;
    151151    uint8_t *pu8GlyphEnd;
    152    
     152
    153153    DISPDBG((1, "VRDP::vrdpReportText: ppdev %p, pClipRects %p, pstro %p, pfo %p, prclOpaque %p, ulForeRGB %x, ulBackRGB %x\n",
    154154                ppdev, pClipRects, pstro, pfo, prclOpaque, ulForeRGB, ulBackRGB));
    155    
     155
    156156    if (pstro->ulCharInc > 0xFF)
    157157    {
     
    169169
    170170    memset (&fi, 0, sizeof (fi));
    171    
     171
    172172    FONTOBJ_vGetInfo (pfo, sizeof (fi), &fi);
    173    
     173
    174174    if (   fi.cjMaxGlyph1 == 0
    175175        || fi.cjMaxGlyph1 > VRDP_TEXT_MAX_GLYPH_SIZE)
     
    179179        return FALSE;
    180180    }
    181    
     181
    182182    cbOrderMax = vboxSizeofTextOrder (pstro->cGlyphs, fi.cjMaxGlyph1);
    183    
     183
    184184    DISPDBG((1, "VRDP::vrdpReportText: pstro->cGlyphs = %d, fi.cjMaxGlyph1 = 0x%x, cbOrderMax = 0x%x.\n", pstro->cGlyphs, fi.cjMaxGlyph1, cbOrderMax));
    185        
     185
    186186    pOrder = (VRDPORDERTEXT *)EngAllocMem (0, cbOrderMax, ALLOC_TAG);
    187    
     187
    188188    if (!pOrder)
    189189    {
     
    191191        return FALSE;
    192192    }
    193    
     193
    194194    pu8GlyphPtr = (uint8_t *)&pOrder[1]; /* Follows the order header. */
    195195    pu8GlyphEnd = (uint8_t *)pOrder + cbOrderMax;
    196    
     196
    197197    pOrder->xBkGround = (int16_t)pstro->rclBkGround.left;
    198198    pOrder->yBkGround = (int16_t)pstro->rclBkGround.top;
     
    214214        pOrder->hOpaque = 0;
    215215    }
    216    
     216
    217217    pOrder->u16MaxGlyph = (uint16_t)fi.cjMaxGlyph1;
    218    
     218
    219219    pOrder->u8Glyphs = (uint8_t)pstro->cGlyphs;
    220    
     220
    221221    pOrder->u8Flags = (uint8_t)pstro->flAccel;
    222    
     222
    223223    pOrder->u8CharInc = (uint8_t)pstro->ulCharInc;
    224    
     224
    225225    pOrder->u32FgRGB = ulForeRGB;
    226226    pOrder->u32BgRGB = ulBackRGB;
    227    
     227
    228228    DISPDBG((1, "VRDP::vrdpReportText: pstro->pgp %p.\n", pstro->pgp));
    229    
     229
    230230    /* Enumerate glyphs. */
    231231    STROBJ_vEnumStart (pstro);
    232    
     232
    233233    fResult = TRUE;
    234    
     234
    235235    for (;;)
    236236    {
     
    238238        ULONG cGlyphs = 0;
    239239        GLYPHPOS *pGlyphPos = NULL;
    240        
     240
    241241        BOOL fMore = STROBJ_bEnum (pstro, &cGlyphs, &pGlyphPos);
    242        
     242
    243243        DISPDBG((1, "VRDP::vrdpReportText: cGlyphs %d.\n", cGlyphs));
    244    
     244
    245245        for (i = 0; i < cGlyphs; i++)
    246246        {
    247247            fResult = vboxReportGlyph (&pGlyphPos[i], &pu8GlyphPtr, pu8GlyphEnd);
    248            
     248
    249249            if (!fResult)
    250250            {
     
    252252            }
    253253        }
    254        
     254
    255255        if (!fMore || !fResult)
    256256        {
     
    260260
    261261    DISPDBG((1, "VRDP::vrdpReportText: fResult %d.\n", fResult));
    262    
     262
    263263    if (fResult)
    264264    {
    265         pOrder->cbOrder = pu8GlyphPtr - (uint8_t *)pOrder;
     265        pOrder->cbOrder = (uint32_t)(pu8GlyphPtr - (uint8_t *)pOrder);
    266266
    267267        vrdpReportOrderGeneric (ppdev, pClipRects, pOrder, pOrder->cbOrder, VRDP_ORDER_TEXT);
    268268    }
    269    
     269
    270270    EngFreeMem (pOrder);
    271    
     271
    272272    return fResult;
    273273}
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