Commit 1cbadd97 authored by rwlbuis@webkit.org's avatar rwlbuis@webkit.org

Fix cast-align warnings in JSC

https://bugs.webkit.org/show_bug.cgi?id=80790

Reviewed by George Staikos.

Source/JavaScriptCore:

* assembler/ARMv7Assembler.h:
(JSC::ARMv7Assembler::computeJumpType):
(JSC::ARMv7Assembler::link):
* assembler/LinkBuffer.h:
(JSC::LinkBuffer::linkCode):
* heap/MarkStack.cpp:
(JSC::SlotVisitor::copyAndAppend):
* runtime/JSArray.cpp:
(JSC::JSArray::visitChildren):
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::Header::payload):

Source/WebCore:

* platform/graphics/WOFFFileFormat.cpp:
(WebCore::readUInt32):
(WebCore::readUInt16):
* platform/image-encoders/skia/JPEGImageEncoder.cpp:
(WebCore::preMultipliedBGRAtoRGB):
* platform/network/MIMESniffing.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9be7456e
2012-04-06 Rob Buis <rbuis@rim.com>
Fix cast-align warnings in JSC
https://bugs.webkit.org/show_bug.cgi?id=80790
Reviewed by George Staikos.
* assembler/ARMv7Assembler.h:
(JSC::ARMv7Assembler::computeJumpType):
(JSC::ARMv7Assembler::link):
* assembler/LinkBuffer.h:
(JSC::LinkBuffer::linkCode):
* heap/MarkStack.cpp:
(JSC::SlotVisitor::copyAndAppend):
* runtime/JSArray.cpp:
(JSC::JSArray::visitChildren):
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::Header::payload):
2012-04-06 Darin Adler <darin@apple.com>
Streamline strtod and fix some related problems
......@@ -1830,29 +1830,29 @@ public:
if (jumpType == JumpCondition) {
// 2-byte conditional T1
const uint16_t* jumpT1Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT1)));
const uint16_t* jumpT1Location = reinterpret_cast_ptr<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT1)));
if (canBeJumpT1(jumpT1Location, to))
return LinkJumpT1;
// 4-byte conditional T3
const uint16_t* jumpT3Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT3)));
const uint16_t* jumpT3Location = reinterpret_cast_ptr<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT3)));
if (canBeJumpT3(jumpT3Location, to, mayTriggerErrata)) {
if (!mayTriggerErrata)
return LinkJumpT3;
}
// 4-byte conditional T4 with IT
const uint16_t* conditionalJumpT4Location =
reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkConditionalJumpT4)));
reinterpret_cast_ptr<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkConditionalJumpT4)));
if (canBeJumpT4(conditionalJumpT4Location, to, mayTriggerErrata)) {
if (!mayTriggerErrata)
return LinkConditionalJumpT4;
}
} else {
// 2-byte unconditional T2
const uint16_t* jumpT2Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT2)));
const uint16_t* jumpT2Location = reinterpret_cast_ptr<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT2)));
if (canBeJumpT2(jumpT2Location, to))
return LinkJumpT2;
// 4-byte unconditional T4
const uint16_t* jumpT4Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT4)));
const uint16_t* jumpT4Location = reinterpret_cast_ptr<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT4)));
if (canBeJumpT4(jumpT4Location, to, mayTriggerErrata)) {
if (!mayTriggerErrata)
return LinkJumpT4;
......@@ -1891,25 +1891,25 @@ public:
{
switch (record.linkType()) {
case LinkJumpT1:
linkJumpT1(record.condition(), reinterpret_cast<uint16_t*>(from), to);
linkJumpT1(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), to);
break;
case LinkJumpT2:
linkJumpT2(reinterpret_cast<uint16_t*>(from), to);
linkJumpT2(reinterpret_cast_ptr<uint16_t*>(from), to);
break;
case LinkJumpT3:
linkJumpT3(record.condition(), reinterpret_cast<uint16_t*>(from), to);
linkJumpT3(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), to);
break;
case LinkJumpT4:
linkJumpT4(reinterpret_cast<uint16_t*>(from), to);
linkJumpT4(reinterpret_cast_ptr<uint16_t*>(from), to);
break;
case LinkConditionalJumpT4:
linkConditionalJumpT4(record.condition(), reinterpret_cast<uint16_t*>(from), to);
linkConditionalJumpT4(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), to);
break;
case LinkConditionalBX:
linkConditionalBX(record.condition(), reinterpret_cast<uint16_t*>(from), to);
linkConditionalBX(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), to);
break;
case LinkBX:
linkBX(reinterpret_cast<uint16_t*>(from), to);
linkBX(reinterpret_cast_ptr<uint16_t*>(from), to);
break;
default:
ASSERT_NOT_REACHED();
......
......@@ -260,9 +260,9 @@ private:
// Copy the instructions from the last jump to the current one.
size_t regionSize = jumpsToLink[i].from() - readPtr;
uint16_t* copySource = reinterpret_cast<uint16_t*>(inData + readPtr);
uint16_t* copyEnd = reinterpret_cast<uint16_t*>(inData + readPtr + regionSize);
uint16_t* copyDst = reinterpret_cast<uint16_t*>(outData + writePtr);
uint16_t* copySource = reinterpret_cast_ptr<uint16_t*>(inData + readPtr);
uint16_t* copyEnd = reinterpret_cast_ptr<uint16_t*>(inData + readPtr + regionSize);
uint16_t* copyDst = reinterpret_cast_ptr<uint16_t*>(outData + writePtr);
ASSERT(!(regionSize % 2));
ASSERT(!(readPtr % 2));
ASSERT(!(writePtr % 2));
......
......@@ -493,7 +493,7 @@ void SlotVisitor::copyAndAppend(void** ptr, size_t bytes, JSValue* values, unsig
if (newPtr) {
size_t jsValuesOffset = static_cast<size_t>(reinterpret_cast<char*>(values) - static_cast<char*>(oldPtr));
JSValue* newValues = reinterpret_cast<JSValue*>(static_cast<char*>(newPtr) + jsValuesOffset);
JSValue* newValues = reinterpret_cast_ptr<JSValue*>(static_cast<char*>(newPtr) + jsValuesOffset);
for (unsigned i = 0; i < length; i++) {
JSValue& value = values[i];
newValues[i] = value;
......
......@@ -1390,7 +1390,7 @@ void JSArray::visitChildren(JSCell* cell, SlotVisitor& visitor)
visitor.copyAndAppend(reinterpret_cast<void**>(&baseStorage), storageSize(thisObject->m_vectorLength + thisObject->m_indexBias), storage->m_vector->slot(), thisObject->m_vectorLength);
if (baseStorage != thisObject->m_storage->m_allocBase) {
thisObject->m_storage = reinterpret_cast<ArrayStorage*>(static_cast<char*>(baseStorage) + sizeof(JSValue) * thisObject->m_indexBias);
thisObject->m_storage = reinterpret_cast_ptr<ArrayStorage*>(static_cast<char*>(baseStorage) + sizeof(JSValue) * thisObject->m_indexBias);
thisObject->m_storage->m_allocBase = baseStorage;
ASSERT(thisObject->m_storage->m_allocBase);
}
......
......@@ -145,7 +145,7 @@ private:
{
char* result = reinterpret_cast<char*>(this) + size();
ASSERT(!(bitwise_cast<uintptr_t>(result) & 7));
return reinterpret_cast<T*>(result);
return reinterpret_cast_ptr<T*>(result);
}
static Header* fromPayload(T* payload)
......
2012-04-06 Rob Buis <rbuis@rim.com>
Fix cast-align warnings in JSC
https://bugs.webkit.org/show_bug.cgi?id=80790
Reviewed by George Staikos.
* platform/graphics/WOFFFileFormat.cpp:
(WebCore::readUInt32):
(WebCore::readUInt16):
* platform/image-encoders/skia/JPEGImageEncoder.cpp:
(WebCore::preMultipliedBGRAtoRGB):
* platform/network/MIMESniffing.cpp:
2012-04-06 Darin Adler <darin@apple.com>
Streamline strtod and fix some related problems
......@@ -63,7 +63,7 @@ static bool readUInt32(SharedBuffer* buffer, size_t& offset, uint32_t& value)
if (buffer->size() - offset < sizeof(value))
return false;
value = ntohl(*reinterpret_cast<const uint32_t*>(buffer->data() + offset));
value = ntohl(*reinterpret_cast_ptr<const uint32_t*>(buffer->data() + offset));
offset += sizeof(value);
return true;
......@@ -75,7 +75,7 @@ static bool readUInt16(SharedBuffer* buffer, size_t& offset, uint16_t& value)
if (buffer->size() - offset < sizeof(value))
return false;
value = ntohs(*reinterpret_cast<const uint16_t*>(buffer->data() + offset));
value = ntohs(*reinterpret_cast_ptr<const uint16_t*>(buffer->data() + offset));
offset += sizeof(value);
return true;
......
......@@ -81,7 +81,7 @@ static void handleError(j_common_ptr common)
static void preMultipliedBGRAtoRGB(const unsigned char* pixels, unsigned int pixelCount, unsigned char* output)
{
const SkPMColor* input = reinterpret_cast<const SkPMColor*>(pixels);
const SkPMColor* input = reinterpret_cast_ptr<const SkPMColor*>(pixels);
for (; pixelCount-- > 0; ++input) {
*output++ = SkGetPackedR32(*input);
*output++ = SkGetPackedG32(*input);
......
......@@ -22,6 +22,7 @@
#include <cstring>
#include <stdint.h>
#include <wtf/StdLibExtras.h>
using namespace std;
......@@ -237,9 +238,9 @@ static inline bool maskedCompare(const MagicNumbers& info, const char* data, siz
if (dataSize < info.size)
return false;
const uint32_t* pattern32 = reinterpret_cast<const uint32_t*>(info.pattern);
const uint32_t* mask32 = reinterpret_cast<const uint32_t*>(info.mask);
const uint32_t* data32 = reinterpret_cast<const uint32_t*>(data);
const uint32_t* pattern32 = reinterpret_cast_ptr<const uint32_t*>(info.pattern);
const uint32_t* mask32 = reinterpret_cast_ptr<const uint32_t*>(info.mask);
const uint32_t* data32 = reinterpret_cast_ptr<const uint32_t*>(data);
size_t count = info.size >> 2;
......
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