Add CF type cast function templates and use them in KeyedDecoder in WebKit2
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2014 18:03:16 +0000 (18:03 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2014 18:03:16 +0000 (18:03 +0000)
commitaef72ec0e1d6facf7bd421dbd78314f323bd7f91
tree06c20d12726cfa26e5ffba39e438de057e37adc4
parent660e56d4b1f9cbba2927b92af370a2cebdd67d36
Add CF type cast function templates and use them in KeyedDecoder in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=134033

Reviewed by Sam Weinig.

Source/WebKit2:
* Shared/cf/KeyedDecoder.cpp:
(WebKit::KeyedDecoder::KeyedDecoder):
(WebKit::KeyedDecoder::decodeBytes):
(WebKit::KeyedDecoder::decodeBool):
(WebKit::KeyedDecoder::decodeInt32):
(WebKit::KeyedDecoder::decodeInt64):
(WebKit::KeyedDecoder::decodeFloat):
(WebKit::KeyedDecoder::decodeDouble):
(WebKit::KeyedDecoder::decodeString):
(WebKit::KeyedDecoder::beginObject):
(WebKit::KeyedDecoder::beginArray):
(WebKit::KeyedDecoder::beginArrayElement):

Source/WTF:
* WTF.xcodeproj/project.pbxproj:
* wtf/cf/TypeCasts.h: Added.
(WTF::dynamic_cf_cast):
Returns null if the given CFTypeRef object doesn't have the right type.

(WTF::checked_cf_cast):
ASSERTs (with security implication) if the given CFTypeRef object is null or doesn't have the right type.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/cf/TypeCasts.h [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/cf/KeyedDecoder.cpp