Commit 177d18e5 authored by aroben@apple.com's avatar aroben@apple.com
Browse files

Fix a MSVC warning in GetEOTHeader

        Reviewed by Dan Bernstein.

        * platform/graphics/win/GetEOTHeader.cpp:
        (WebCore::getEOTHeader): MSVC complains that having a 0-sized array in
        a struct is a non-standard extension. I've replaced the 0-sized arrays
        with arrays of 1 element, and replaced sizeof(structType) with
        offsetof(structType, arrayMember).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 94a6a3d4
2008-05-12 Adam Roben <aroben@apple.com>
Fix a MSVC warning in GetEOTHeader
Reviewed by Dan Bernstein.
* platform/graphics/win/GetEOTHeader.cpp:
(WebCore::getEOTHeader): MSVC complains that having a 0-sized array in
a struct is a non-standard extension. I've replaced the 0-sized arrays
with arrays of 1 element, and replaced sizeof(structType) with
offsetof(structType, arrayMember).
2008-05-09 Adam Roben <aroben@apple.com>
 
Fix a MSVC warning in TextCodecICU
......@@ -73,7 +73,7 @@ struct sfntHeader {
BigEndianUShort searchRange;
BigEndianUShort entrySelector;
BigEndianUShort rangeShift;
TableDirectoryEntry tables[];
TableDirectoryEntry tables[1];
};
struct OS2Table {
......@@ -145,7 +145,7 @@ struct nameTable {
BigEndianUShort format;
BigEndianUShort count;
BigEndianUShort stringOffset;
nameRecord nameRecords[];
nameRecord nameRecords[1];
};
#pragma pack()
......@@ -175,12 +175,12 @@ bool getEOTHeader(SharedBuffer* fontData, Vector<UInt8, 512>& eotHeader)
prefix->version = 0x00020001;
prefix->flags = 0;
if (dataLength < sizeof(sfntHeader))
if (dataLength < offsetof(sfntHeader, tables))
return false;
const sfntHeader* sfnt = reinterpret_cast<const sfntHeader*>(data);
if (dataLength < sizeof(sfntHeader) + sfnt->numTables * sizeof(TableDirectoryEntry))
if (dataLength < offsetof(sfntHeader, tables) + sfnt->numTables * sizeof(TableDirectoryEntry))
return false;
bool haveOS2 = false;
......@@ -237,13 +237,13 @@ bool getEOTHeader(SharedBuffer* fontData, Vector<UInt8, 512>& eotHeader)
}
case 'name':
{
if (dataLength < tableOffset + sizeof(nameTable))
if (dataLength < tableOffset + offsetof(nameTable, nameRecords))
return false;
haveName = true;
const nameTable* name = reinterpret_cast<const nameTable*>(data + tableOffset);
for (int j = 0; j < name->count; j++) {
if (dataLength < tableOffset + sizeof(nameTable) + (j + 1) * sizeof(nameRecord))
if (dataLength < tableOffset + offsetof(nameTable, nameRecords) + (j + 1) * sizeof(nameRecord))
return false;
if (name->nameRecords[j].platformID == 3 && name->nameRecords[j].encodingID == 1 && name->nameRecords[j].languageID == 0x0409) {
if (dataLength < tableOffset + name->stringOffset + name->nameRecords[j].offset + name->nameRecords[j].length)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment