Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

webkit: Fix build in ISO C++11 mode

Assorted ISO C++11 fixes:
- constexpr additions
- macro constructs that could be mistaken for string literals
- enum typesafety

Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
  • Loading branch information...
commit 7444a29917ce8f43ceccde1903c87982e0cbee29 1 parent 2e336b9
Bernhard Rosenkraenzer authored aeroevan committed
View
5 Source/JavaScriptCore/wtf/NullPtr.h
@@ -35,10 +35,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define __has_feature(feature) 0
#endif
-#if __has_feature(cxx_nullptr) || (defined(_MSC_VER) && _MSC_VER >= 1600)
+#if __has_feature(cxx_nullptr) || (defined(_MSC_VER) && _MSC_VER >= 1600) || defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
#define HAVE_NULLPTR 1
+namespace std {
+ typedef decltype(nullptr) nullptr_t; // nullptr_t seems to be missing in gcc 4.7?
+}
#else
namespace std {
View
2  Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp
@@ -49,7 +49,7 @@ DoubleBufferedTexture::DoubleBufferedTexture(EGLContext sharedContext, SharedTex
m_pContext = EGL_NO_CONTEXT;
m_cContext = sharedContext;
m_writeableTexture = m_textureA;
- m_lockedConsumerTexture = GL_NO_TEXTURE;
+ m_lockedConsumerTexture = (SharedTexture*)GL_NO_TEXTURE;
m_supportsEGLImage = GLUtils::isEGLImageSupported();
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("DoubleBufferedTexture");
View
6 Source/WebCore/platform/graphics/android/LayerAndroid.h
@@ -41,6 +41,10 @@
#define bzero(b, len) (memset((b), '\0', (len)), (void) 0)
#endif
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus<201103L && !defined(constexpr)
+#define constexpr const
+#endif
+
class SkBitmapRef;
class SkCanvas;
class SkMatrix;
@@ -398,7 +402,7 @@ class TEST_EXPORT LayerAndroid : public Layer {
float m_scale;
// We try to not always compute the texture size, as this is quite heavy
- static const double s_computeTextureDelay = 0.2; // 200 ms
+ static constexpr double s_computeTextureDelay = 0.2; // 200 ms
double m_lastComputeTextureSize;
// This mutex serves two purposes. (1) It ensures that certain operations
View
6 Source/WebCore/platform/graphics/android/TiledTexture.h
@@ -35,6 +35,10 @@
#include "TextureOwner.h"
#include "TilePainter.h"
+#if __cplusplus < 201103L && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(constexpr)
+#define constexpr const
+#endif
+
class SkCanvas;
namespace WebCore {
@@ -132,7 +136,7 @@ class DualTiledTexture {
private:
// Delay before we schedule a new tile at the new scale factor
- static const double s_zoomUpdateDelay = 0.2; // 200 ms
+ static constexpr double s_zoomUpdateDelay = 0.2; // 200 ms
TiledTexture* m_frontTexture;
TiledTexture* m_backTexture;
View
16 Source/WebCore/platform/graphics/android/ZoomManager.h
@@ -30,6 +30,10 @@
#include "SkRect.h"
+#if __cplusplus < 201103L && !defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(constexpr)
+#define constexpr const
+#endif
+
namespace WebCore {
class GLWebViewState;
@@ -88,16 +92,16 @@ class ZoomManager {
private:
// Delay between scheduling a new page when the scale
// factor changes (i.e. zooming in or out)
- static const double s_updateInitialDelay = 0.3; // 300 ms
+ static constexpr double s_updateInitialDelay = 0.3; // 300 ms
// If the scale factor continued to change and we completed
// the original delay, we push back the update by this value
- static const double s_updateDelay = 0.1; // 100 ms
+ static constexpr double s_updateDelay = 0.1; // 100 ms
// Delay for the transition between the two pages
- static const double s_zoomInTransitionDelay = 0.1; // 100 ms
- static const double s_invZoomInTransitionDelay = 10;
- static const double s_zoomOutTransitionDelay = 0.2; // 200 ms
- static const double s_invZoomOutTransitionDelay = 5;
+ static constexpr double s_zoomInTransitionDelay = 0.1; // 100 ms
+ static constexpr double s_invZoomInTransitionDelay = 10;
+ static constexpr double s_zoomOutTransitionDelay = 0.2; // 200 ms
+ static constexpr double s_invZoomOutTransitionDelay = 5;
GLScaleState m_scaleRequestState;
float m_currentScale;
View
4 Source/WebCore/platform/sql/SQLiteFileSystem.cpp
@@ -77,10 +77,10 @@ String SQLiteFileSystem::getFileNameForNewDatabase(const String& dbDir, const St
String fileName;
do {
++seq;
- fileName = pathByAppendingComponent(dbDir, String::format("%016"PRIx64".db", seq));
+ fileName = pathByAppendingComponent(dbDir, String::format("%016" PRIx64 ".db", seq));
} while (fileExists(fileName));
- return String::format("%016"PRIx64".db", seq);
+ return String::format("%016" PRIx64 ".db", seq);
}
String SQLiteFileSystem::appendDatabaseFileNameToPath(const String& path, const String& fileName)
Please sign in to comment.
Something went wrong with that request. Please try again.