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 <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
bb10
Volker Krause 2015-05-01 13:15:22 +02:00 committed by Giuseppe D'Angelo
parent 3287e7a68a
commit 337c279215
18 changed files with 24 additions and 24 deletions

View File

@ -121,7 +121,7 @@ struct MibToName {
short index;
};
static MibToName mibToName[] = {
static const MibToName mibToName[] = {
{ 3, 0 },
{ 4, 9 },
{ 5, 20 },

View File

@ -128,7 +128,7 @@ QDebug operator<<(QDebug d, const QOpenGLConfig::Gpu &g)
}
enum Operator { NotEqual, LessThan, LessEqualThan, Equals, GreaterThan, GreaterEqualThan };
static const char *operators[] = {"!=", "<", "<=", "=", ">", ">="};
static const char operators[][3] = {"!=", "<", "<=", "=", ">", ">="};
static inline QString valueKey() { return QStringLiteral("value"); }
static inline QString opKey() { return QStringLiteral("op"); }

View File

@ -511,7 +511,7 @@ GLuint QOpenGLEngineShaderManager::getUniformLocation(Uniform id)
if (uniformLocations.isEmpty())
uniformLocations.fill(GLuint(-1), NumUniforms);
static const char *uniformNames[] = {
static const char *const uniformNames[] = {
"imageTexture",
"patternColor",
"globalOpacity",

View File

@ -3568,7 +3568,7 @@ void QOpenGLExtensions::flushShared()
d->flushIsSufficientToSyncContexts = false; // default to false, not guaranteed by the spec
const char *vendor = (const char *) glGetString(GL_VENDOR);
if (vendor) {
static const char *flushEnough[] = { "Apple", "ATI", "Intel", "NVIDIA" };
static const char *const flushEnough[] = { "Apple", "ATI", "Intel", "NVIDIA" };
for (size_t i = 0; i < sizeof(flushEnough) / sizeof(const char *); ++i) {
if (strstr(vendor, flushEnough[i])) {
d->flushIsSufficientToSyncContexts = true;

View File

@ -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",

View File

@ -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<QPixelLayout::BPP1MSB>, // BPP1MSB
fetchPixels<QPixelLayout::BPP1LSB>, // BPP1LSB
@ -685,7 +685,7 @@ FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = {
fetchPixels<QPixelLayout::BPP32> // BPP32
};
StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = {
const StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = {
0, // BPPNone
storePixels<QPixelLayout::BPP1MSB>, // BPP1MSB
storePixels<QPixelLayout::BPP1LSB>, // 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<QPixelLayout::BPP1MSB>, // BPP1MSB
fetchPixel<QPixelLayout::BPP1LSB>, // BPP1LSB

View File

@ -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];

View File

@ -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,

View File

@ -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"

View File

@ -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",

View File

@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
//#define DEBUG_HEADER
//#define DEBUG_FONTENGINE
static QFontEngineQPF2::TagType tagTypes[QFontEngineQPF2::NumTags] = {
static const QFontEngineQPF2::TagType tagTypes[QFontEngineQPF2::NumTags] = {
QFontEngineQPF2::StringType, // FontName
QFontEngineQPF2::StringType, // FileName
QFontEngineQPF2::UInt32Type, // FileIndex

View File

@ -670,7 +670,7 @@ void QZipReaderPrivate::scanFiles()
void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const QByteArray &contents/*, QFile::Permissions permissions, QZip::Method m*/)
{
#ifndef NDEBUG
static const char *entryTypes[] = {
static const char *const entryTypes[] = {
"directory",
"file ",
"symlink " };

View File

@ -499,7 +499,7 @@ static const char zones[] =
"eet\0" // 2
"jst\0" // 9
"\0";
static int zoneOffsets[] = {-8, -8, -7, -7, -6, -6, -5, -5, -4, -3, 0, 0, 0, 1, 2, 9 };
static const int zoneOffsets[] = {-8, -8, -7, -7, -6, -6, -5, -5, -4, -3, 0, 0, 0, 1, 2, 9 };
static const char months[] =
"jan\0"

View File

@ -594,7 +594,7 @@ bool QSslCertificate::importPkcs12(QIODevice *device,
// These certificates are known to be fraudulent and were created during the comodo
// compromise. See http://www.comodo.com/Comodo-Fraud-Incident-2011-03-23.html
static const char *certificate_blacklist[] = {
static const char *const certificate_blacklist[] = {
"04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e", "mail.google.com", // Comodo
"f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06", "www.google.com", // Comodo
"d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3", "login.yahoo.com", // Comodo

View File

@ -508,7 +508,7 @@ GLuint QGLEngineShaderManager::getUniformLocation(Uniform id)
if (uniformLocations.isEmpty())
uniformLocations.fill(GLuint(-1), NumUniforms);
static const char *uniformNames[] = {
static const char *const uniformNames[] = {
"imageTexture",
"patternColor",
"globalOpacity",

View File

@ -198,7 +198,7 @@ namespace QTest
}
QSpontaneKeyEvent::setSpontaneous(&me);
if (!qApp->notify(widget, &me)) {
static const char *mouseActionNames[] =
static const char *const mouseActionNames[] =
{ "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" };
QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving widget");
QTest::qWarn(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toLatin1().data());

View File

@ -348,7 +348,7 @@ static const char * const qt_unshade_xpm[] = {
"..........",
".........."};
static const char * dock_widget_close_xpm[] = {
static const char * const dock_widget_close_xpm[] = {
"8 8 2 1",
"# c #000000",
". c None",

View File

@ -586,7 +586,7 @@ public:
};
///////////////////////////////////////////////////////////////////////////////////////////
static const char *knownStyleHints[] = {
static const char *const knownStyleHints[] = {
"activate-on-singleclick",
"alignment",
"arrow-keys-navigate-into-children",