Changeset 302:555d58850cd9

Show
Ignore:
Timestamp:
08/28/08 22:26:26 (3 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Omit array bounds checking on dynamic struct length.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/graphics/Image.d

    r246 r302  
    1313module dwt.graphics.Image; 
    1414 
    15  
     15import tango.util.log.Trace; 
    1616import dwt.DWT; 
    1717import dwt.DWTError; 
     
    713713                                        paletteData = new PaletteData(rgbs); 
    714714                                        for (int i = 0; i < colorPalette.Count; i++) { 
    715                                             if (((palette.Entries[i] >> 24) & 0xFF) is 0 && (colorPalette.Flags & Gdip.PaletteFlagsHasAlpha) !is 0) { 
     715                                            // DWT: access palette.Entries without array bounds checking 
     716                                            if (((*(palette.Entries.ptr + i) >> 24) & 0xFF) is 0 && (colorPalette.Flags & Gdip.PaletteFlagsHasAlpha) !is 0) { 
    716717                                                transparentPixel = i; 
    717718                                            } 
    718                                             rgbs[i] = new RGB(((palette.Entries[i] & 0xFF0000) >> 16), ((palette.Entries[i] & 0xFF00) >> 8), ((palette.Entries[i] & 0xFF) >> 0)); 
     719                                            rgbs[i] = new RGB(((*(palette.Entries.ptr + i) & 0xFF0000) >> 16), ((*(palette.Entries.ptr + i) & 0xFF00) >> 8), ((*(palette.Entries.ptr + i) & 0xFF) >> 0)); 
    719720                                        } 
    720721                                        OS.HeapFree(hHeap, 0, palette);