From 337c279215fa6daf12a1cd1370bcbf10db809bb0 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 1 May 2015 13:15:22 +0200 Subject: Make data tables const. Moves some of them to the .rodata section, the rest at least to .data.rel.ro[.local]. Change-Id: I85676ddf22b0c0097f3f0dce4c3dc018dc29d045 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira Reviewed-by: Giuseppe D'Angelo --- src/gui/painting/qbrush.cpp | 2 +- src/gui/painting/qdrawhelper.cpp | 6 +++--- src/gui/painting/qdrawhelper_p.h | 4 ++-- src/gui/painting/qpaintengineex.cpp | 8 ++++---- src/gui/painting/qpdf.cpp | 2 +- src/gui/painting/qtransform.cpp | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 5bf8387400..670717c5f1 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -999,7 +999,7 @@ bool QBrush::operator==(const QBrush &b) const */ QDebug operator<<(QDebug dbg, const QBrush &b) { - static const char *BRUSH_STYLES[] = { + static const char *const BRUSH_STYLES[] = { "NoBrush", "SolidPattern", "Dense1Pattern", diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 37f2de98b6..d34b2b9a44 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -675,7 +675,7 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = { { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertGrayscale8ToRGB32, convertGrayscale8FromARGB32PM, convertGrayscale8FromRGB32 } // Format_Grayscale8 }; -FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = { +const FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = { 0, // BPPNone fetchPixels, // BPP1MSB fetchPixels, // BPP1LSB @@ -685,7 +685,7 @@ FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = { fetchPixels // BPP32 }; -StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = { +const StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = { 0, // BPPNone storePixels, // BPP1MSB storePixels, // BPP1LSB @@ -697,7 +697,7 @@ StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = { typedef uint (QT_FASTCALL *FetchPixelFunc)(const uchar *src, int index); -FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = { +static const FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = { 0, // BPPNone fetchPixel, // BPP1MSB fetchPixel, // BPP1LSB diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 0d391b2cec..66ef5949d9 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1126,8 +1126,8 @@ typedef const uint *(QT_FASTCALL *FetchPixelsFunc)(uint *buffer, const uchar *sr typedef void (QT_FASTCALL *StorePixelsFunc)(uchar *dest, const uint *src, int index, int count); extern QPixelLayout qPixelLayouts[QImage::NImageFormats]; -extern FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount]; -extern StorePixelsFunc qStorePixels[QPixelLayout::BPPCount]; +extern const FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount]; +extern const StorePixelsFunc qStorePixels[QPixelLayout::BPPCount]; diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 0f80cd18a0..f00bc8d9df 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -238,7 +238,7 @@ bool QPaintEngineExPrivate::hasClipOperations() const * */ -static QPainterPath::ElementType qpaintengineex_ellipse_types[] = { +static const QPainterPath::ElementType qpaintengineex_ellipse_types[] = { QPainterPath::MoveToElement, QPainterPath::CurveToElement, QPainterPath::CurveToDataElement, @@ -257,7 +257,7 @@ static QPainterPath::ElementType qpaintengineex_ellipse_types[] = { QPainterPath::CurveToDataElement }; -static QPainterPath::ElementType qpaintengineex_line_types_16[] = { +static const QPainterPath::ElementType qpaintengineex_line_types_16[] = { QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::MoveToElement, QPainterPath::LineToElement, @@ -276,7 +276,7 @@ static QPainterPath::ElementType qpaintengineex_line_types_16[] = { QPainterPath::MoveToElement, QPainterPath::LineToElement }; -static QPainterPath::ElementType qpaintengineex_rect4_types_32[] = { +static const QPainterPath::ElementType qpaintengineex_rect4_types_32[] = { QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 1 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 2 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 3 @@ -312,7 +312,7 @@ static QPainterPath::ElementType qpaintengineex_rect4_types_32[] = { }; -static QPainterPath::ElementType qpaintengineex_roundedrect_types[] = { +static const QPainterPath::ElementType qpaintengineex_roundedrect_types[] = { QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::CurveToElement, diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 3f2ebb92a0..6ea0800538 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -384,7 +384,7 @@ QByteArray QPdf::generateDashes(const QPen &pen) -static const char* pattern_for_brush[] = { +static const char* const pattern_for_brush[] = { 0, // NoBrush 0, // SolidPattern "0 J\n" diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 31d7a2300b..a3e9db2057 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1078,7 +1078,7 @@ QDataStream & operator>>(QDataStream &s, QTransform &t) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QTransform &m) { - static const char *typeStr[] = + static const char *const typeStr[] = { "TxNone", "TxTranslate", -- cgit v1.2.3