Make constants const, saves a few symbols in the .data section.

icc-effect-5.14.5
Volker Krause 2014-09-27 20:30:49 +02:00
parent 1bb1ab44af
commit 5db2d5a556
11 changed files with 51 additions and 51 deletions

View File

@ -1812,13 +1812,13 @@ QString Client::readName() const
}
// The list is taken from http://www.unicode.org/reports/tr9/ (#154840)
QChar LRM(0x200E);
QChar RLM(0x200F);
QChar LRE(0x202A);
QChar RLE(0x202B);
QChar LRO(0x202D);
QChar RLO(0x202E);
QChar PDF(0x202C);
static const QChar LRM(0x200E);
static const QChar RLM(0x200F);
static const QChar LRE(0x202A);
static const QChar RLE(0x202B);
static const QChar LRO(0x202D);
static const QChar RLO(0x202E);
static const QChar PDF(0x202C);
void Client::setCaption(const QString& _s, bool force)
{

View File

@ -202,7 +202,7 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
m_picture.reset(new XRenderPicture(m_pixmap, 32));
}
#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536))
static xcb_render_transform_t identity = {
static const xcb_render_transform_t identity = {
DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)

View File

@ -276,10 +276,10 @@ void MouseClickEffect::paintScreenFinish(int mask, QRegion region, ScreenPaintDa
void MouseClickEffect::drawCircleGl(const QColor& color, float cx, float cy, float r)
{
static int num_segments = 80;
static float theta = 2 * 3.1415926 / float(num_segments);
static float c = cosf(theta); //precalculate the sine and cosine
static float s = sinf(theta);
static const int num_segments = 80;
static const float theta = 2 * 3.1415926 / float(num_segments);
static const float c = cosf(theta); //precalculate the sine and cosine
static const float s = sinf(theta);
float t;
float x = r;//we start at angle = 0

View File

@ -45,31 +45,31 @@ struct ParameterSet {
int move_factor;
};
ParameterSet set_0 = {
static const ParameterSet set_0 = {
15,
80,
10
};
ParameterSet set_1 = {
static const ParameterSet set_1 = {
10,
85,
10
};
ParameterSet set_2 = {
static const ParameterSet set_2 = {
6,
90,
10
};
ParameterSet set_3 = {
static const ParameterSet set_3 = {
3,
92,
20
};
ParameterSet set_4 = {
static const ParameterSet set_4 = {
1,
97,
25

View File

@ -380,7 +380,7 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (xrenderPicture) {
#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536))
static xcb_render_transform_t xrenderIdentity = {
static const xcb_render_transform_t xrenderIdentity = {
DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)

View File

@ -36,7 +36,7 @@
// close.xbm:
#define close_width 12
#define close_height 12
static unsigned char close_bits[] = {
static const unsigned char close_bits[] = {
0x00, 0x00, 0x06, 0x06, 0x0e, 0x07, 0x9c, 0x03, 0xf8, 0x01, 0xf0, 0x00,
0xf0, 0x00, 0xf8, 0x01, 0x9c, 0x03, 0x0e, 0x07, 0x06, 0x06, 0x00, 0x00
};
@ -44,7 +44,7 @@ static unsigned char close_bits[] = {
// help.xbm:
#define help_width 12
#define help_height 12
static unsigned char help_bits[] = {
static const unsigned char help_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xfc, 0x01, 0x8c, 0x01, 0xc0, 0x01,
0xe0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00
};
@ -52,7 +52,7 @@ static unsigned char help_bits[] = {
// keepaboveothers.xbm:
#define keepaboveothers_width 12
#define keepaboveothers_height 12
static unsigned char keepaboveothers_bits[] = {
static const unsigned char keepaboveothers_bits[] = {
0x00, 0x00, 0x60, 0x00, 0xf0, 0x00, 0xf8, 0x01, 0x60, 0x00, 0xfe, 0x07,
0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
@ -60,7 +60,7 @@ static unsigned char keepaboveothers_bits[] = {
// keepbelowothers.xbm:
#define keepbelowothers_width 12
#define keepbelowothers_height 12
static unsigned char keepbelowothers_bits[] = {
static const unsigned char keepbelowothers_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07,
0xfe, 0x07, 0x60, 0x00, 0xf8, 0x01, 0xf0, 0x00, 0x60, 0x00, 0x00, 0x00
};
@ -68,7 +68,7 @@ static unsigned char keepbelowothers_bits[] = {
// maximize.xbm:
#define maximize_width 12
#define maximize_height 12
static unsigned char maximize_bits[] = {
static const unsigned char maximize_bits[] = {
0x00, 0x00, 0xfe, 0x07, 0xfe, 0x07, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04,
0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0xfe, 0x07, 0x00, 0x00
};
@ -76,7 +76,7 @@ static unsigned char maximize_bits[] = {
// menu.xbm:
#define menu_width 12
#define menu_height 12
static unsigned char menu_bits[] = {
static const unsigned char menu_bits[] = {
0x00, 0x00, 0xfc, 0x03, 0xf4, 0x02, 0x04, 0x02, 0xf4, 0x02, 0x04, 0x02,
0xf4, 0x02, 0x04, 0x02, 0xf4, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00
};
@ -84,7 +84,7 @@ static unsigned char menu_bits[] = {
// minimize.xbm:
#define minimize_width 12
#define minimize_height 12
static unsigned char minimize_bits[] = {
static const unsigned char minimize_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0xfe, 0x07, 0x00, 0x00
};
@ -92,7 +92,7 @@ static unsigned char minimize_bits[] = {
// onalldesktops.xbm:
#define onalldesktops_width 12
#define onalldesktops_height 12
static unsigned char onalldesktops_bits[] = {
static const unsigned char onalldesktops_bits[] = {
0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xfe, 0x07,
0xfe, 0x07, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00
};
@ -100,7 +100,7 @@ static unsigned char onalldesktops_bits[] = {
// resize.xbm:
#define resize_width 12
#define resize_height 12
static unsigned char resize_bits[] = {
static const unsigned char resize_bits[] = {
0x00, 0x00, 0xfe, 0x07, 0x42, 0x04, 0x42, 0x04, 0x42, 0x04, 0x42, 0x04,
0x7e, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0xfe, 0x07, 0x00, 0x00
};
@ -108,7 +108,7 @@ static unsigned char resize_bits[] = {
// shade.xbm:
#define shade_width 12
#define shade_height 12
static unsigned char shade_bits[] = {
static const unsigned char shade_bits[] = {
0x00, 0x00, 0xfe, 0x07, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
@ -116,7 +116,7 @@ static unsigned char shade_bits[] = {
// spacer.xbm:
#define spacer_width 12
#define spacer_height 12
static unsigned char spacer_bits[] = {
static const unsigned char spacer_bits[] = {
0x00, 0x00, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x54, 0x03,
0xac, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x00, 0x00
};

View File

@ -277,7 +277,7 @@ const char* const tbl_All[] = {
""
};
const char* tbl_TiWAc[] = {
const char* const tbl_TiWAc[] = {
"Raise/Lower",
"Shade/Unshade",
"Maximize/Restore",
@ -289,7 +289,7 @@ const char* tbl_TiWAc[] = {
""
};
const char* tbl_AllW[] = {
const char* const tbl_AllW[] = {
"Raise/Lower",
"Shade/Unshade",
"Maximize/Restore",

View File

@ -29,7 +29,7 @@ QDebug operator<<(QDebug dbg, const KWin::AniData &a)
}
using namespace KWin;
static int Gaussian = 46;
static const int Gaussian = 46;
AniData::AniData()
{

View File

@ -254,9 +254,9 @@ void GLTexture::update(const QImage &image, const QPoint &offset, const QRect &s
Q_D(GLTexture);
#ifdef KWIN_HAVE_OPENGLES
static bool s_supportsUnpack = hasGLExtension(QByteArrayLiteral("GL_EXT_unpack_subimage"));
static const bool s_supportsUnpack = hasGLExtension(QByteArrayLiteral("GL_EXT_unpack_subimage"));
#else
static bool s_supportsUnpack = true;
static const bool s_supportsUnpack = true;
#endif
int width = image.width();

View File

@ -565,7 +565,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)
};
static xcb_render_transform_t identity = {
static const xcb_render_transform_t identity = {
DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0),
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)
@ -1065,10 +1065,10 @@ void SceneXrender::EffectFrame::renderUnstyled(xcb_render_picture_t pict, const
xcb_render_color_t tranparent = {0, 0, 0, 0};
xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, *s_effectFrameCircle, tranparent, 1, &xrect);
static int num_segments = 80;
static qreal theta = 2 * M_PI / qreal(num_segments);
static qreal c = qCos(theta); //precalculate the sine and cosine
static qreal s = qSin(theta);
static const int num_segments = 80;
static const qreal theta = 2 * M_PI / qreal(num_segments);
static const qreal c = qCos(theta); //precalculate the sine and cosine
static const qreal s = qSin(theta);
qreal t;
qreal x = roundness;//we start at angle = 0

View File

@ -496,18 +496,18 @@ void TabBox::key(const char *actionName, Slot slot, const QKeySequence &shortcut
globalShortcutChanged(a, cuts.isEmpty() ? QKeySequence() : cuts.first());
}
static const char *s_windows = I18N_NOOP("Walk Through Windows");
static const char *s_windowsRev = I18N_NOOP("Walk Through Windows (Reverse)");
static const char *s_windowsAlt = I18N_NOOP("Walk Through Windows Alternative");
static const char *s_windowsAltRev = I18N_NOOP("Walk Through Windows Alternative (Reverse)");
static const char *s_app = I18N_NOOP("Walk Through Windows of Current Application");
static const char *s_appRev = I18N_NOOP("Walk Through Windows of Current Application (Reverse)");
static const char *s_appAlt = I18N_NOOP("Walk Through Windows of Current Application Alternative");
static const char *s_appAltRev = I18N_NOOP("Walk Through Windows of Current Application Alternative (Reverse)");
static const char *s_desktops = I18N_NOOP("Walk Through Desktops");
static const char *s_desktopsRev = I18N_NOOP("Walk Through Desktops (Reverse)");
static const char *s_desktopList = I18N_NOOP("Walk Through Desktop List");
static const char *s_desktopListRev = I18N_NOOP("Walk Through Desktop List (Reverse)");
static const char s_windows[] = I18N_NOOP("Walk Through Windows");
static const char s_windowsRev[] = I18N_NOOP("Walk Through Windows (Reverse)");
static const char s_windowsAlt[] = I18N_NOOP("Walk Through Windows Alternative");
static const char s_windowsAltRev[] = I18N_NOOP("Walk Through Windows Alternative (Reverse)");
static const char s_app[] = I18N_NOOP("Walk Through Windows of Current Application");
static const char s_appRev[] = I18N_NOOP("Walk Through Windows of Current Application (Reverse)");
static const char s_appAlt[] = I18N_NOOP("Walk Through Windows of Current Application Alternative");
static const char s_appAltRev[] = I18N_NOOP("Walk Through Windows of Current Application Alternative (Reverse)");
static const char s_desktops[] = I18N_NOOP("Walk Through Desktops");
static const char s_desktopsRev[] = I18N_NOOP("Walk Through Desktops (Reverse)");
static const char s_desktopList[] = I18N_NOOP("Walk Through Desktop List");
static const char s_desktopListRev[] = I18N_NOOP("Walk Through Desktop List (Reverse)");
void TabBox::initShortcuts()
{