<http://webkit.org/b/56381> Objective-C classes should be typedef-ed as structs ...
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 18:22:50 +0000 (18:22 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 18:22:50 +0000 (18:22 +0000)
Reviewed by Simon Fraser.

Typedef-ing Objective-C classes as void* for pure C++ makes it
easier for bugs to creep in because compilers can't do any type
checking for void pointers.

* platform/graphics/GraphicsContext3D.h: Changed typedef
declarations for CALayer and WebGLLayer from void* to structs.
(WebCore::GraphicsContext3D::platformLayer): Changed
static_cast<CALayer*> to reinterpret_cast<CALayer*> now that
CALayer and WebGLLayer are not void pointers.
* platform/graphics/GraphicsLayer.h: Changed typedef declaration
for PlatformLayer from void* to struct CALayer.
* platform/graphics/ca/PlatformCAAnimation.h: Changed typedef
declaration for CAPropertyAnimation from void* to a struct.
Extracted typdef for PlatformAnimationRef.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81156 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h

index f55a765..b757bee 100644 (file)
@@ -1,3 +1,24 @@
+2011-03-15  David Kilzer  <ddkilzer@apple.com>
+
+        <http://webkit.org/b/56381> Objective-C classes should be typedef-ed as structs (not void*) in C++
+
+        Reviewed by Simon Fraser.
+
+        Typedef-ing Objective-C classes as void* for pure C++ makes it
+        easier for bugs to creep in because compilers can't do any type
+        checking for void pointers.
+
+        * platform/graphics/GraphicsContext3D.h: Changed typedef
+        declarations for CALayer and WebGLLayer from void* to structs.
+        (WebCore::GraphicsContext3D::platformLayer): Changed
+        static_cast<CALayer*> to reinterpret_cast<CALayer*> now that
+        CALayer and WebGLLayer are not void pointers.
+        * platform/graphics/GraphicsLayer.h: Changed typedef declaration
+        for PlatformLayer from void* to struct CALayer.
+        * platform/graphics/ca/PlatformCAAnimation.h: Changed typedef
+        declaration for CAPropertyAnimation from void* to a struct.
+        Extracted typdef for PlatformAnimationRef.
+
 2011-03-15  Ilya Sherman  <isherman@chromium.org>
 
         Reviewed by Tony Chang.
 2011-03-15  Ilya Sherman  <isherman@chromium.org>
 
         Reviewed by Tony Chang.
index a9db650..9772780 100644 (file)
@@ -51,8 +51,8 @@
 @class CALayer;
 @class WebGLLayer;
 #else
 @class CALayer;
 @class WebGLLayer;
 #else
-typedef void* CALayer;
-typedef void* WebGLLayer;
+typedef struct CALayer CALayer;
+typedef struct WebGLLayer WebGLLayer;
 #endif
 #elif PLATFORM(QT)
 QT_BEGIN_NAMESPACE
 #endif
 #elif PLATFORM(QT)
 QT_BEGIN_NAMESPACE
@@ -450,7 +450,7 @@ public:
 #if PLATFORM(MAC)
     PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
     Platform3DObject platformTexture() const { return m_texture; }
 #if PLATFORM(MAC)
     PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
     Platform3DObject platformTexture() const { return m_texture; }
-    CALayer* platformLayer() const { return static_cast<CALayer*>(m_webGLLayer.get()); }
+    CALayer* platformLayer() const { return reinterpret_cast<CALayer*>(m_webGLLayer.get()); }
 #elif PLATFORM(CHROMIUM)
     PlatformGraphicsContext3D platformGraphicsContext3D() const;
     Platform3DObject platformTexture() const;
 #elif PLATFORM(CHROMIUM)
     PlatformGraphicsContext3D platformGraphicsContext3D() const;
     Platform3DObject platformTexture() const;
index 486b69a..f534b84 100644 (file)
@@ -50,7 +50,7 @@
 @class CALayer;
 typedef CALayer PlatformLayer;
 #else
 @class CALayer;
 typedef CALayer PlatformLayer;
 #else
-typedef void* PlatformLayer;
+typedef struct CALayer PlatformLayer;
 #endif
 #elif PLATFORM(WIN)
 typedef struct _CACFLayer PlatformLayer;
 #endif
 #elif PLATFORM(WIN)
 typedef struct _CACFLayer PlatformLayer;
index a8528fd..9cd3e2b 100644 (file)
 #if PLATFORM(MAC)
 #ifdef __OBJC__
 @class CAPropertyAnimation;
 #if PLATFORM(MAC)
 #ifdef __OBJC__
 @class CAPropertyAnimation;
-typedef CAPropertyAnimation* PlatformAnimationRef;
 #else
 #else
-typedef void* CAPropertyAnimation; // So the m_animation declaration works
-typedef void* PlatformAnimationRef;
+typedef struct CAPropertyAnimation CAPropertyAnimation;
 #endif
 #endif
+typedef CAPropertyAnimation* PlatformAnimationRef;
 #elif PLATFORM(WIN)
 typedef struct _CACFAnimation* CACFAnimationRef;
 typedef CACFAnimationRef PlatformAnimationRef;
 #elif PLATFORM(WIN)
 typedef struct _CACFAnimation* CACFAnimationRef;
 typedef CACFAnimationRef PlatformAnimationRef;