diff options
author | Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> | 2012-05-08 18:16:34 +0200 |
---|---|---|
committer | Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> | 2012-05-08 18:16:34 +0200 |
commit | b73cb9dd573688dddf75ed5c18f7a0b7a5c50fb0 (patch) | |
tree | 43aa7a4d94e9bbc5fbfd604d3a18804a0b11e32d | |
parent | 24507b746e798b0231697c60d18ef0e242526fe3 (diff) | |
download | webkit-linaro_android_4.0.4.tar.gz |
webkit: Fix build in ISO C++11 modelinaro_android_4.0.4
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>
6 files changed, 27 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/wtf/NullPtr.h b/Source/JavaScriptCore/wtf/NullPtr.h index 08ece565d..8d1564d54 100644 --- a/Source/JavaScriptCore/wtf/NullPtr.h +++ b/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 { diff --git a/Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp b/Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp index 4c5af9e68..5c14d1928 100644 --- a/Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp +++ b/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"); diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.h b/Source/WebCore/platform/graphics/android/LayerAndroid.h index c1f1bc956..0e0d6f35c 100644 --- a/Source/WebCore/platform/graphics/android/LayerAndroid.h +++ b/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 @@ private: 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 diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.h b/Source/WebCore/platform/graphics/android/TiledTexture.h index 444ab14ce..9238c0e08 100644 --- a/Source/WebCore/platform/graphics/android/TiledTexture.h +++ b/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 @@ public: 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; diff --git a/Source/WebCore/platform/graphics/android/ZoomManager.h b/Source/WebCore/platform/graphics/android/ZoomManager.h index dd04c5d82..173d35010 100644 --- a/Source/WebCore/platform/graphics/android/ZoomManager.h +++ b/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 @@ public: 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; diff --git a/Source/WebCore/platform/sql/SQLiteFileSystem.cpp b/Source/WebCore/platform/sql/SQLiteFileSystem.cpp index 362005c66..c4ca6aa5e 100644 --- a/Source/WebCore/platform/sql/SQLiteFileSystem.cpp +++ b/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) |