[Scummvm-git-logs] scummvm master -> eda69db63ce0a0bc5ef96ace3e5c570185879acd
sev-
noreply at scummvm.org
Tue Dec 26 19:24:04 UTC 2023
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5b1b14ad80 COMMON: Mark more symbols as const
30b977c272 DETECTION: Mark more symbols as const
6522c6e11d GRAPHICS: Make the Graphics::PixelFormat constructors constexpr
eda69db63c COMMON: Allow passing const pointers to BitArray::set_bits()
Commit: 5b1b14ad8087d773f11a16f52afbbea983070f2b
https://github.com/scummvm/scummvm/commit/5b1b14ad8087d773f11a16f52afbbea983070f2b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-12-26T20:23:59+01:00
Commit Message:
COMMON: Mark more symbols as const
Changed paths:
audio/adlib.cpp
audio/adlib_ms.cpp
audio/adlib_ms.h
audio/decoders/3do.cpp
audio/decoders/vorbis.cpp
audio/miles_adlib.cpp
audio/softsynth/fmtowns_pc98/towns_audio.cpp
backends/cloud/cloudicon.cpp
backends/cloud/cloudicon.h
backends/cloud/cloudicon_data.h
backends/cloud/cloudicon_disabled_data.h
backends/graphics/opengl/pipelines/libretro.cpp
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
backends/graphics3d/opengl/surfacerenderer.cpp
backends/keymapper/standard-actions.cpp
backends/keymapper/standard-actions.h
backends/networking/enet/source/protocol.cpp
backends/platform/sdl/kolibrios/kolibrios.cpp
backends/platform/sdl/posix/posix.cpp
backends/saves/default/default-saves.cpp
backends/saves/default/default-saves.h
base/detection/detection.cpp
base/plugins.cpp
base/plugins.h
common/compression/gentee_installer.cpp
common/compression/gzio.cpp
common/formats/cue.cpp
common/formats/cue.h
common/formats/markdown.cpp
common/formats/winexe_ne.cpp
common/lua/ldo.cpp
devtools/credits.pl
engines/logo_data.h
graphics/macgui/macfontmanager.cpp
graphics/nanosvg/nanosvg.h
graphics/opengl/shader.cpp
graphics/tinygl/clip.cpp
graphics/tinygl/list.cpp
gui/about.cpp
gui/credits.h
gui/options.cpp
gui/shaderbrowser-dialog.cpp
icons/scummvm.xpm
image/codecs/indeo4.cpp
image/codecs/indeo4.h
image/codecs/svq1_vlc.h
math/sinewindows.cpp
diff --git a/audio/adlib.cpp b/audio/adlib.cpp
index 83d557d6a9f..88500b0670a 100644
--- a/audio/adlib.cpp
+++ b/audio/adlib.cpp
@@ -463,7 +463,7 @@ static const AdLibInstrument g_gmInstruments[128] = {
{ 0x00, 0x3F, 0x4C, 0xFB, 0x00, 0x00, 0x3F, 0x0A, 0xE9, 0x7C, 0x0E, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0x05 }
};
-static AdLibInstrument g_gmPercussionInstruments[39] = {
+static const AdLibInstrument g_gmPercussionInstruments[39] = {
{ 0x1A, 0x3F, 0x15, 0x05, 0x7C, 0x02, 0x21, 0x2B, 0xE4, 0x7C, 0x0E, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0x06 },
{ 0x11, 0x12, 0x04, 0x07, 0x7C, 0x02, 0x23, 0x0B, 0xE5, 0x7C, 0x0E, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0x05 },
{ 0x0A, 0x3F, 0x0B, 0x01, 0x7C, 0x1F, 0x1C, 0x46, 0xD0, 0x7C, 0x0E, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0x01 },
diff --git a/audio/adlib_ms.cpp b/audio/adlib_ms.cpp
index 3b866cd21b9..e2284c15047 100644
--- a/audio/adlib_ms.cpp
+++ b/audio/adlib_ms.cpp
@@ -325,10 +325,10 @@ OplInstrumentDefinition MidiDriver_ADLIB_Multisource::OPL_RHYTHM_BANK[62] = {
// Rhythm mode uses OPL channels 6, 7 and 8. The remaining channels are
// available for melodic instruments.
-uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
-uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL2_RHYTHM[] = { 0, 1, 2, 3, 4, 5 };
-uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL3[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 };
-uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL3_RHYTHM[] = { 0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17 };
+const uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
+const uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL2_RHYTHM[] = { 0, 1, 2, 3, 4, 5 };
+const uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL3[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 };
+const uint8 MidiDriver_ADLIB_Multisource::MELODIC_CHANNELS_OPL3_RHYTHM[] = { 0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17 };
const uint8 MidiDriver_ADLIB_Multisource::OPL_REGISTER_RHYTHM_OFFSETS[OPL_NUM_RHYTHM_INSTRUMENTS] = { 0x11, 0x15, 0x12, 0x14, 0x10 };
diff --git a/audio/adlib_ms.h b/audio/adlib_ms.h
index 29f7017d2b2..3e9a8459ee4 100644
--- a/audio/adlib_ms.h
+++ b/audio/adlib_ms.h
@@ -344,22 +344,22 @@ public:
* The melodic channel numbers available on an OPL2 chip with rhythm mode
* disabled.
*/
- static uint8 MELODIC_CHANNELS_OPL2[9];
+ static const uint8 MELODIC_CHANNELS_OPL2[9];
/**
* The melodic channel numbers available on an OPL2 chip with rhythm mode
* enabled.
*/
- static uint8 MELODIC_CHANNELS_OPL2_RHYTHM[6];
+ static const uint8 MELODIC_CHANNELS_OPL2_RHYTHM[6];
/**
* The melodic channel numbers available on an OPL3 chip with rhythm mode
* disabled.
*/
- static uint8 MELODIC_CHANNELS_OPL3[18];
+ static const uint8 MELODIC_CHANNELS_OPL3[18];
/**
* The melodic channel numbers available on an OPL3 chip with rhythm mode
* enabled.
*/
- static uint8 MELODIC_CHANNELS_OPL3_RHYTHM[15];
+ static const uint8 MELODIC_CHANNELS_OPL3_RHYTHM[15];
/**
* The number of rhythm instruments available in OPL rhythm mode.
*/
@@ -1182,7 +1182,7 @@ protected:
// the static channel allocation mode.
uint8 _channelAllocations[MAXIMUM_SOURCES][MIDI_CHANNEL_COUNT];
// Array containing the numbers of the available melodic channels.
- uint8 *_melodicChannels;
+ const uint8 *_melodicChannels;
// The number of available melodic channels (length of _melodicChannels).
uint8 _numMelodicChannels;
// The amount of notes played since the driver was opened / reset.
diff --git a/audio/decoders/3do.cpp b/audio/decoders/3do.cpp
index 32ebaa66250..375a908e7dd 100644
--- a/audio/decoders/3do.cpp
+++ b/audio/decoders/3do.cpp
@@ -165,7 +165,7 @@ int Audio3DO_ADP4_Stream::readBuffer(int16 *buffer, const int numSamples) {
}
// ============================================================================
-static int16 audio_3DO_SDX2_SquareTable[256] = {
+static const int16 audio_3DO_SDX2_SquareTable[256] = {
-32768,-32258,-31752,-31250,-30752,-30258,-29768,-29282,-28800,-28322,
-27848,-27378,-26912,-26450,-25992,-25538,-25088,-24642,-24200,-23762,
-23328,-22898,-22472,-22050,-21632,-21218,-20808,-20402,-20000,-19602,
diff --git a/audio/decoders/vorbis.cpp b/audio/decoders/vorbis.cpp
index 455718429fc..58bdc35d9aa 100644
--- a/audio/decoders/vorbis.cpp
+++ b/audio/decoders/vorbis.cpp
@@ -76,7 +76,7 @@ static long tell_stream_wrap(void *datasource) {
return stream->pos();
}
-static ov_callbacks g_stream_wrap = {
+static const ov_callbacks g_stream_wrap = {
read_stream_wrap, seek_stream_wrap, close_stream_wrap, tell_stream_wrap
};
diff --git a/audio/miles_adlib.cpp b/audio/miles_adlib.cpp
index af36f1e9ac3..b7b619d89fa 100644
--- a/audio/miles_adlib.cpp
+++ b/audio/miles_adlib.cpp
@@ -58,17 +58,17 @@ enum kMilesAdLibUpdateFlags {
kMilesAdLibUpdateFlags_Reg_All = 0x3F
};
-uint16 milesAdLibOperator1Register[MILES_ADLIB_PHYSICAL_FMVOICES_COUNT_MAX] = {
+const uint16 milesAdLibOperator1Register[MILES_ADLIB_PHYSICAL_FMVOICES_COUNT_MAX] = {
0x0000, 0x0001, 0x0002, 0x0008, 0x0009, 0x000A, 0x0010, 0x0011, 0x0012,
0x0100, 0x0101, 0x0102, 0x0108, 0x0109, 0x010A, 0x0110, 0x0111, 0x0112
};
-uint16 milesAdLibOperator2Register[MILES_ADLIB_PHYSICAL_FMVOICES_COUNT_MAX] = {
+const uint16 milesAdLibOperator2Register[MILES_ADLIB_PHYSICAL_FMVOICES_COUNT_MAX] = {
0x0003, 0x0004, 0x0005, 0x000B, 0x000C, 0x000D, 0x0013, 0x0014, 0x0015,
0x0103, 0x0104, 0x0105, 0x010B, 0x010C, 0x010D, 0x0113, 0x0114, 0x0115
};
-uint16 milesAdLibChannelRegister[MILES_ADLIB_PHYSICAL_FMVOICES_COUNT_MAX] = {
+const uint16 milesAdLibChannelRegister[MILES_ADLIB_PHYSICAL_FMVOICES_COUNT_MAX] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108
};
@@ -91,7 +91,7 @@ struct InstrumentEntry {
};
// hardcoded, dumped from ADLIB.MDI
-uint16 milesAdLibFrequencyLookUpTable[] = {
+const uint16 milesAdLibFrequencyLookUpTable[] = {
0x02B2, 0x02B4, 0x02B7, 0x02B9, 0x02BC, 0x02BE, 0x02C1, 0x02C3, 0x02C6, 0x02C9, 0x02CB, 0x02CE,
0x02D0, 0x02D3, 0x02D6, 0x02D8, 0x02DB, 0x02DD, 0x02E0, 0x02E3, 0x02E5, 0x02E8, 0x02EB, 0x02ED,
0x02F0, 0x02F3, 0x02F6, 0x02F8, 0x02FB, 0x02FE, 0x0301, 0x0303, 0x0306, 0x0309, 0x030C, 0x030F,
@@ -111,13 +111,13 @@ uint16 milesAdLibFrequencyLookUpTable[] = {
};
// hardcoded, dumped from ADLIB.MDI
-uint16 milesAdLibVolumeSensitivityTable[] = {
+const uint16 milesAdLibVolumeSensitivityTable[] = {
82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127
};
// MIDI panning to register volume table for dual OPL2
// hardcoded, dumped from ADLIB.MDI
-uint8 milesAdLibPanningVolumeLookUpTable[] = {
+const uint8 milesAdLibPanningVolumeLookUpTable[] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94,
diff --git a/audio/softsynth/fmtowns_pc98/towns_audio.cpp b/audio/softsynth/fmtowns_pc98/towns_audio.cpp
index ef5268f9aa0..768f30a50ed 100644
--- a/audio/softsynth/fmtowns_pc98/towns_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_audio.cpp
@@ -1364,7 +1364,7 @@ void TownsAudioInterfaceInternal::pcmReset() {
_pcmChan[i]->clear();
memset(_pcmInstruments, 0, 128 * 32);
- static uint8 name[] = { 0x4E, 0x6F, 0x20, 0x44, 0x61, 0x74, 0x61, 0x21 };
+ static const uint8 name[] = { 0x4E, 0x6F, 0x20, 0x44, 0x61, 0x74, 0x61, 0x21 };
for (int i = 0; i < 32; i++)
memcpy(_pcmInstruments + i * 128, name, 8);
diff --git a/backends/cloud/cloudicon.cpp b/backends/cloud/cloudicon.cpp
index b1b3168aef7..ccf031f493d 100644
--- a/backends/cloud/cloudicon.cpp
+++ b/backends/cloud/cloudicon.cpp
@@ -140,7 +140,7 @@ void CloudIcon::initIcons() {
loadIcon(_disabledIcon, cloudicon_disabled_data, ARRAYSIZE(cloudicon_disabled_data));
}
-void CloudIcon::loadIcon(Graphics::Surface &icon, byte *data, uint32 size) {
+void CloudIcon::loadIcon(Graphics::Surface &icon, const byte *data, uint32 size) {
Image::PNGDecoder decoder;
Common::MemoryReadStream stream(data, size);
if (!decoder.loadStream(stream)) {
diff --git a/backends/cloud/cloudicon.h b/backends/cloud/cloudicon.h
index 588fdcfe6c6..001ba809ef9 100644
--- a/backends/cloud/cloudicon.h
+++ b/backends/cloud/cloudicon.h
@@ -78,7 +78,7 @@ private:
uint32 _lastUpdateTime;
void initIcons();
- void loadIcon(Graphics::Surface &icon, byte *data, uint32 size);
+ void loadIcon(Graphics::Surface &icon, const byte *data, uint32 size);
void makeAlphaIcon(const Graphics::Surface &icon, float alpha);
void hide();
diff --git a/backends/cloud/cloudicon_data.h b/backends/cloud/cloudicon_data.h
index 4d00feecf1b..4c633226e8f 100644
--- a/backends/cloud/cloudicon_data.h
+++ b/backends/cloud/cloudicon_data.h
@@ -23,7 +23,7 @@
// $ recode data..d1 <dists/cloudicon.png >cloudicon_data.h
// The tool is from https://github.com/pinard/Recode
-byte cloudicon_data[] = {
+static const byte cloudicon_data[] = {
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68,
82, 0, 0, 0, 32, 0, 0, 0, 32, 8, 6, 0, 0, 0, 115,
122, 122, 244, 0, 0, 0, 4, 115, 66, 73, 84, 8, 8, 8, 8,
diff --git a/backends/cloud/cloudicon_disabled_data.h b/backends/cloud/cloudicon_disabled_data.h
index 87b3e555bb9..e0b51be912f 100644
--- a/backends/cloud/cloudicon_disabled_data.h
+++ b/backends/cloud/cloudicon_disabled_data.h
@@ -23,7 +23,7 @@
// $ recode data..d1 <dists/cloudicon_disabled.png >cloudicon_disabled_data.h
// The tool is from https://github.com/pinard/Recode
-byte cloudicon_disabled_data[] = {
+static const byte cloudicon_disabled_data[] = {
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68,
82, 0, 0, 0, 32, 0, 0, 0, 32, 8, 6, 0, 0, 0, 115,
122, 122, 244, 0, 0, 0, 4, 115, 66, 73, 84, 8, 8, 8, 8,
diff --git a/backends/graphics/opengl/pipelines/libretro.cpp b/backends/graphics/opengl/pipelines/libretro.cpp
index c5cfab26ff5..9c20a1eef23 100644
--- a/backends/graphics/opengl/pipelines/libretro.cpp
+++ b/backends/graphics/opengl/pipelines/libretro.cpp
@@ -105,7 +105,7 @@ static const char *const g_libretroShaderAttributes[] = {
};
// some libretro shaders use texture without checking version
-static const char *g_compatVertex =
+static const char *const g_compatVertex =
"#if defined(GL_ES)\n"
"#if !defined(HAS_ROUND)\n"
"#define round(x) (sign(x) * floor(abs(x) + .5))\n"
@@ -116,7 +116,7 @@ static const char *g_compatVertex =
"#endif\n"
"#endif\n";
-static const char *g_compatFragment =
+static const char *const g_compatFragment =
"#if defined(GL_ES)\n"
"#if !defined(HAS_ROUND)\n"
"#define round(x) (sign(x) * floor(abs(x) + .5))\n"
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index ec40c7918b1..6990aa19c73 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -62,7 +62,7 @@
#define SDL_FULLSCREEN 0x40000000
#endif
-static OSystem::GraphicsMode s_supportedGraphicsModes[] = {
+static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{"surfacesdl", _s("SDL Surface"), GFX_SURFACESDL},
{nullptr, nullptr, 0}
};
diff --git a/backends/graphics3d/opengl/surfacerenderer.cpp b/backends/graphics3d/opengl/surfacerenderer.cpp
index 141624b11d1..7d15fe44a14 100644
--- a/backends/graphics3d/opengl/surfacerenderer.cpp
+++ b/backends/graphics3d/opengl/surfacerenderer.cpp
@@ -173,7 +173,7 @@ void FixedSurfaceRenderer::restorePreviousState() {
#if defined(USE_OPENGL_SHADERS)
-static const char *boxVertex =
+static const char *const boxVertex =
"attribute vec2 position;\n"
"attribute vec2 texcoord;\n"
"uniform vec2 offsetXY;\n"
@@ -200,7 +200,7 @@ static const char *boxVertex =
"gl_Position = vec4(pos, 0.0, 1.0);\n"
"}\n";
-static const char *boxFragment =
+static const char *const boxFragment =
"#ifdef GL_ES\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"precision highp float;\n"
diff --git a/backends/keymapper/standard-actions.cpp b/backends/keymapper/standard-actions.cpp
index e8b440eaf99..720f0d26ab3 100644
--- a/backends/keymapper/standard-actions.cpp
+++ b/backends/keymapper/standard-actions.cpp
@@ -23,23 +23,23 @@
namespace Common {
-const char *kStandardActionLeftClick = "LCLK";
-const char *kStandardActionMiddleClick = "MCLK";
-const char *kStandardActionRightClick = "RCLK";
-const char *kStandardActionInteract = "INTRCT";
-const char *kStandardActionSkip = "SKIP";
-const char *kStandardActionPause = "PAUSE";
-const char *kStandardActionMoveUp = "UP";
-const char *kStandardActionMoveDown = "DOWN";
-const char *kStandardActionMoveLeft = "LEFT";
-const char *kStandardActionMoveRight = "RIGHT";
-const char *kStandardActionOpenMainMenu = "MENU";
-const char *kStandardActionLoad = "LOAD";
-const char *kStandardActionSave = "SAVE";
-const char *kStandardActionOpenSettings = "OPTS";
-const char *kStandardActionEE = "WTF";
-const char *kStandardActionCut = "CUT";
-const char *kStandardActionCopy = "COPY";
-const char *kStandardActionPaste = "PASTE";
+const char *const kStandardActionLeftClick = "LCLK";
+const char *const kStandardActionMiddleClick = "MCLK";
+const char *const kStandardActionRightClick = "RCLK";
+const char *const kStandardActionInteract = "INTRCT";
+const char *const kStandardActionSkip = "SKIP";
+const char *const kStandardActionPause = "PAUSE";
+const char *const kStandardActionMoveUp = "UP";
+const char *const kStandardActionMoveDown = "DOWN";
+const char *const kStandardActionMoveLeft = "LEFT";
+const char *const kStandardActionMoveRight = "RIGHT";
+const char *const kStandardActionOpenMainMenu = "MENU";
+const char *const kStandardActionLoad = "LOAD";
+const char *const kStandardActionSave = "SAVE";
+const char *const kStandardActionOpenSettings = "OPTS";
+const char *const kStandardActionEE = "WTF";
+const char *const kStandardActionCut = "CUT";
+const char *const kStandardActionCopy = "COPY";
+const char *const kStandardActionPaste = "PASTE";
} //namespace Common
diff --git a/backends/keymapper/standard-actions.h b/backends/keymapper/standard-actions.h
index da996021f26..23555d29e57 100644
--- a/backends/keymapper/standard-actions.h
+++ b/backends/keymapper/standard-actions.h
@@ -37,24 +37,24 @@
namespace Common {
-extern const char *kStandardActionLeftClick;
-extern const char *kStandardActionMiddleClick;
-extern const char *kStandardActionRightClick;
-extern const char *kStandardActionInteract;
-extern const char *kStandardActionSkip;
-extern const char *kStandardActionPause;
-extern const char *kStandardActionMoveUp;
-extern const char *kStandardActionMoveDown;
-extern const char *kStandardActionMoveLeft;
-extern const char *kStandardActionMoveRight;
-extern const char *kStandardActionOpenMainMenu;
-extern const char *kStandardActionLoad;
-extern const char *kStandardActionSave;
-extern const char *kStandardActionOpenSettings;
-extern const char *kStandardActionEE;
-extern const char *kStandardActionCut;
-extern const char *kStandardActionCopy;
-extern const char *kStandardActionPaste;
+extern const char *const kStandardActionLeftClick;
+extern const char *const kStandardActionMiddleClick;
+extern const char *const kStandardActionRightClick;
+extern const char *const kStandardActionInteract;
+extern const char *const kStandardActionSkip;
+extern const char *const kStandardActionPause;
+extern const char *const kStandardActionMoveUp;
+extern const char *const kStandardActionMoveDown;
+extern const char *const kStandardActionMoveLeft;
+extern const char *const kStandardActionMoveRight;
+extern const char *const kStandardActionOpenMainMenu;
+extern const char *const kStandardActionLoad;
+extern const char *const kStandardActionSave;
+extern const char *const kStandardActionOpenSettings;
+extern const char *const kStandardActionEE;
+extern const char *const kStandardActionCut;
+extern const char *const kStandardActionCopy;
+extern const char *const kStandardActionPaste;
} //namespace Common
diff --git a/backends/networking/enet/source/protocol.cpp b/backends/networking/enet/source/protocol.cpp
index 9e079e7be4c..96e72eacd38 100644
--- a/backends/networking/enet/source/protocol.cpp
+++ b/backends/networking/enet/source/protocol.cpp
@@ -9,7 +9,7 @@
#include "time.h"
#include "enet.h"
-static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] =
+static const size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] =
{
0,
sizeof (ENetProtocolAcknowledge),
diff --git a/backends/platform/sdl/kolibrios/kolibrios.cpp b/backends/platform/sdl/kolibrios/kolibrios.cpp
index 51ed11b44f1..f6a36417224 100644
--- a/backends/platform/sdl/kolibrios/kolibrios.cpp
+++ b/backends/platform/sdl/kolibrios/kolibrios.cpp
@@ -100,7 +100,7 @@ Common::Path OSystem_KolibriOS::getScreenshotsPath() {
return path;
}
- static const char *SCREENSHOTS_DIR_NAME = "ScummVM Screenshots";
+ static const char *const SCREENSHOTS_DIR_NAME = "ScummVM Screenshots";
if (!KolibriOS::assureDirectoryExists(SCREENSHOTS_DIR_NAME, _writablePath.toString(Common::Path::kNativeSeparator).c_str())) {
return "";
}
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 2d464c52931..d406eb7f77d 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -304,7 +304,7 @@ Common::Path OSystem_POSIX::getScreenshotsPath() {
picturesPath += "/";
}
- static const char *SCREENSHOTS_DIR_NAME = "ScummVM Screenshots";
+ static const char *const SCREENSHOTS_DIR_NAME = "ScummVM Screenshots";
if (!Posix::assureDirectoryExists(SCREENSHOTS_DIR_NAME, picturesPath.c_str())) {
return "";
}
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index 4dc0ab79288..957602a73e7 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -41,7 +41,7 @@
#include <errno.h> // for removeSavefile()
#if defined(USE_CLOUD) && defined(USE_LIBCURL)
-const char *DefaultSaveFileManager::TIMESTAMPS_FILENAME = "timestamps";
+const char *const DefaultSaveFileManager::TIMESTAMPS_FILENAME = "timestamps";
#endif
DefaultSaveFileManager::DefaultSaveFileManager() {
diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h
index 5c420884ecf..ad4b6b1def3 100644
--- a/backends/saves/default/default-saves.h
+++ b/backends/saves/default/default-saves.h
@@ -47,7 +47,7 @@ public:
#ifdef USE_LIBCURL
static const uint32 INVALID_TIMESTAMP = UINT_MAX;
- static const char *TIMESTAMPS_FILENAME;
+ static const char *const TIMESTAMPS_FILENAME;
static Common::HashMap<Common::String, uint32> loadTimestamps();
static void saveTimestamps(Common::HashMap<Common::String, uint32> ×tamps);
diff --git a/base/detection/detection.cpp b/base/detection/detection.cpp
index 934ef952e86..5770b07c012 100644
--- a/base/detection/detection.cpp
+++ b/base/detection/detection.cpp
@@ -40,7 +40,7 @@ public:
PluginList pl;
#define LINK_PLUGIN(ID) \
- extern PluginType g_##ID##_type; \
+ extern const PluginType g_##ID##_type; \
extern PluginObject *g_##ID##_getObject(); \
pl.push_back(new StaticPlugin(g_##ID##_getObject(), g_##ID##_type));
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 075dcefb1b6..59b92601cbe 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -36,7 +36,7 @@
// Plugin versioning
-int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
+const int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
PLUGIN_TYPE_ENGINE_DETECTION_VERSION,
PLUGIN_TYPE_ENGINE_VERSION,
PLUGIN_TYPE_MUSIC_VERSION,
@@ -81,7 +81,7 @@ public:
PluginList pl;
#define LINK_PLUGIN(ID) \
- extern PluginType g_##ID##_type; \
+ extern const PluginType g_##ID##_type; \
extern PluginObject *g_##ID##_getObject(); \
pl.push_back(new StaticPlugin(g_##ID##_getObject(), g_##ID##_type));
diff --git a/base/plugins.h b/base/plugins.h
index f2624e7aec4..823ab10828f 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -55,7 +55,7 @@ enum PluginType {
#define PLUGIN_TYPE_DETECTION_VERSION 1
#define PLUGIN_TYPE_SCALER_VERSION 1
-extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
+extern const int pluginTypeVersions[PLUGIN_TYPE_MAX];
// Plugin linking
@@ -85,7 +85,8 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
* @see REGISTER_PLUGIN_DYNAMIC
*/
#define REGISTER_PLUGIN_STATIC(ID,TYPE,PLUGINCLASS) \
- PluginType g_##ID##_type = TYPE; \
+ extern const PluginType g_##ID##_type; \
+ const PluginType g_##ID##_type = TYPE; \
PluginObject *g_##ID##_getObject() { \
return new PLUGINCLASS(); \
} \
diff --git a/common/compression/gentee_installer.cpp b/common/compression/gentee_installer.cpp
index a8cf832a5e3..7393012e675 100644
--- a/common/compression/gentee_installer.cpp
+++ b/common/compression/gentee_installer.cpp
@@ -237,7 +237,7 @@ private:
Common::ReadStream *_inputStream;
- static byte g_matchVLCLengths[kNumMatchVLCs];
+ static const byte g_matchVLCLengths[kNumMatchVLCs];
uint16 _matchVLCOffsets[kNumMatchVLCs];
private:
@@ -424,7 +424,7 @@ void DecompressorState::recordMatchOffset(uint matchOffset) {
_matchOffsetHistory[0] = matchOffset;
}
-byte DecompressorState::g_matchVLCLengths[DecompressorState::kNumMatchVLCs] = {
+const byte DecompressorState::g_matchVLCLengths[DecompressorState::kNumMatchVLCs] = {
0, 1, 1, 2, 2,
2, 3, 3, 3, 3,
4, 4, 5, 5, 6,
diff --git a/common/compression/gzio.cpp b/common/compression/gzio.cpp
index d5758e8974c..a2efc718f28 100644
--- a/common/compression/gzio.cpp
+++ b/common/compression/gzio.cpp
@@ -97,31 +97,31 @@ struct huft
/* Tables for deflate from PKZIP's appnote.txt. */
-static unsigned bitorder_zlib[] =
+static const unsigned bitorder_zlib[] =
{ /* Order of the bit length code lengths */
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
-static unsigned bitorder_clickteam[] =
+static const unsigned bitorder_clickteam[] =
{ /* Order of the bit length code lengths */
18, 17, 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
-static ush cplens[] =
+static const ush cplens[] =
{ /* Copy lengths for literal codes 257..285 */
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
/* note: see note #13 above about the 258 in this list. */
-static ush cplext[] =
+static const ush cplext[] =
{ /* Extra bits for literal codes 257..285 */
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */
-static ush cpdist[] =
+static const ush cpdist[] =
{ /* Copy offsets for distance codes 0..29 */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577};
-static ush cpdext[] =
+static const ush cpdext[] =
{ /* Extra bits for distance codes */
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
@@ -161,8 +161,8 @@ static ush cpdext[] =
*/
-static int lbits = 9; /* bits in base literal/length lookup table */
-static int dbits = 6; /* bits in base distance lookup table */
+static const int lbits = 9; /* bits in base literal/length lookup table */
+static const int dbits = 6; /* bits in base distance lookup table */
/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
@@ -200,7 +200,7 @@ static int dbits = 6; /* bits in base distance lookup table */
the stream.
*/
-static ush mask_bits[] =
+static const ush mask_bits[] =
{
0x0000,
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
@@ -337,7 +337,7 @@ GzioReadStream::parentSeek(int64 off)
}
/* more function prototypes */
-static int huft_build (unsigned *, unsigned, unsigned, ush *, ush *,
+static int huft_build (unsigned *, unsigned, unsigned, const ush *, const ush *,
struct huft **, int *);
static int huft_free (struct huft *);
@@ -352,8 +352,8 @@ static int
huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */
unsigned n, /* number of codes (assumed <= N_MAX) */
unsigned s, /* number of simple-valued codes (0..s-1) */
- ush * d, /* list of base values for non-simple codes */
- ush * e, /* list of extra bits for non-simple codes */
+ const ush * d, /* list of base values for non-simple codes */
+ const ush * e, /* list of extra bits for non-simple codes */
struct huft **t, /* result: starting table */
int *m) /* maximum lookup bits, returns actual */
{
@@ -809,7 +809,7 @@ GzioReadStream::init_dynamic_block ()
unsigned ll[286 + 30]; /* literal/length and distance code lengths */
ulg b; /* bit buffer */
unsigned k; /* number of bits in bit buffer */
- unsigned *bitorder = (_mode == GzioReadStream::Mode::CLICKTEAM) ? bitorder_clickteam : bitorder_zlib;
+ const unsigned *bitorder = (_mode == GzioReadStream::Mode::CLICKTEAM) ? bitorder_clickteam : bitorder_zlib;
/* make local bit buffer */
b = _bb;
diff --git a/common/formats/cue.cpp b/common/formats/cue.cpp
index 7b1374abcee..062645f0a01 100644
--- a/common/formats/cue.cpp
+++ b/common/formats/cue.cpp
@@ -127,7 +127,7 @@ struct CueSheet::LookupTable {
int value;
};
-int CueSheet::lookupInTable(LookupTable *table, const char *key) {
+int CueSheet::lookupInTable(const LookupTable *table, const char *key) {
while (table->key) {
if (!strcmp(key, table->key))
return table->value;
@@ -147,7 +147,7 @@ int CueSheet::parseMSF(const char *str) {
return frm + 75 * (sec + 60 * min);
}
-CueSheet::LookupTable fileTypes[] = {
+static const CueSheet::LookupTable fileTypes[] = {
{ "BINARY", CueSheet::kFileTypeBinary },
{ "AIFF", CueSheet::kFileTypeAIFF },
{ "WAVE", CueSheet::kFileTypeWave },
@@ -208,7 +208,7 @@ void CueSheet::parseHeaderContext(const char *line) {
}
}
-CueSheet::LookupTable trackTypes[] = {
+static const CueSheet::LookupTable trackTypes[] = {
{ "AUDIO", CueSheet::kTrackTypeAudio }, // Audio (sector size: 2352)
{ "CDG", CueSheet::kTrackTypeCDG }, // Karaoke CD+G (sector size: 2448)
{ "MODE1_RAW", CueSheet::kTrackTypeMode1_Raw }, // CD-ROM Mode 1 data (raw) (sector size: 2352), used by cdrdao
@@ -224,7 +224,7 @@ CueSheet::LookupTable trackTypes[] = {
{ 0, 0 }
};
-CueSheet::LookupTable trackTypesSectorSizes[] = {
+static const CueSheet::LookupTable trackTypesSectorSizes[] = {
{ "AUDIO", 2352 },
{ "CDG", 2448 },
{ "MODE1_RAW", 2352 },
@@ -275,7 +275,7 @@ void CueSheet::parseFilesContext(const char *line) {
}
-CueSheet::LookupTable trackFlags[] = {
+static const CueSheet::LookupTable trackFlags[] = {
{ "4CH", CueSheet::kTrackFlag4ch },
{ "DCP", CueSheet::kTrackFlagDCP },
{ "PRE", CueSheet::kTrackFlagPre },
diff --git a/common/formats/cue.h b/common/formats/cue.h
index f754f9bb3b8..e45ddd6b3c6 100644
--- a/common/formats/cue.h
+++ b/common/formats/cue.h
@@ -102,7 +102,7 @@ public:
private:
void parse(const char *sheet);
- int lookupInTable(LookupTable *table, const char *key);
+ int lookupInTable(const LookupTable *table, const char *key);
int parseMSF(const char *str);
void parseHeaderContext(const char *line);
diff --git a/common/formats/markdown.cpp b/common/formats/markdown.cpp
index 3366b30ec28..60951099886 100644
--- a/common/formats/markdown.cpp
+++ b/common/formats/markdown.cpp
@@ -138,7 +138,7 @@ enum markdown_char_t {
MD_CHAR_SUPERSCRIPT,
};
-static char_trigger markdown_char_ptrs[] = {
+static const char_trigger markdown_char_ptrs[] = {
NULL,
&char_emphasis,
&char_codespan,
@@ -687,7 +687,7 @@ static size_t char_codespan(SDDataBuffer *ob, SDMarkdown *rndr, byte *data, size
/* char_escape ⢠'\\' backslash escape */
static size_t char_escape(SDDataBuffer *ob, SDMarkdown *rndr, byte *data, size_t offset, size_t size) {
- static const char *escape_chars = "\\`*_{}[]()#+-.!:|&<>^~";
+ static const char *const escape_chars = "\\`*_{}[]()#+-.!:|&<>^~";
SDDataBuffer work = { 0, 0, 0, 0 };
if (size > 1) {
@@ -2510,7 +2510,7 @@ void SDMarkdown::version(int *ver_major, int *ver_minor, int *ver_revision) {
int sd_autolink_issafe(const byte *link, size_t link_len) {
static const size_t valid_uris_count = 5;
- static const char *valid_uris[] = {
+ static const char *const valid_uris[] = {
"/", "http://", "https://", "ftp://", "mailto:"
};
diff --git a/common/formats/winexe_ne.cpp b/common/formats/winexe_ne.cpp
index 491c57b59ed..cef2020cce7 100644
--- a/common/formats/winexe_ne.cpp
+++ b/common/formats/winexe_ne.cpp
@@ -157,7 +157,7 @@ bool NEResources::readNameTable(uint32 offset, uint32 size) {
return true;
}
-static const char *s_resTypeNames[] = {
+static const char *const s_resTypeNames[] = {
"", "cursor", "bitmap", "icon", "menu", "dialog", "string",
"font_dir", "font", "accelerator", "rc_data", "msg_table",
"group_cursor", "", "group_icon", "name_table", "version", "dlg_include",
diff --git a/common/lua/ldo.cpp b/common/lua/ldo.cpp
index e1de0cfbafc..6dd29a71fd4 100644
--- a/common/lua/ldo.cpp
+++ b/common/lua/ldo.cpp
@@ -101,7 +101,7 @@ static void resetstack (lua_State *L, int status) {
// Added in ScummVM. Refer to http://www.lua.org/manual/5.1/manual.html
-static const char* luaErrorDescription[] = {
+static const char *const luaErrorDescription[] = {
"No error",
"Coroutine yield", // not an actual error, see lua_resume
"Runtime error",
diff --git a/devtools/credits.pl b/devtools/credits.pl
index 1a684a79591..bd322f2aa20 100755
--- a/devtools/credits.pl
+++ b/devtools/credits.pl
@@ -223,7 +223,7 @@ sub begin_credits {
print "\n";
} elsif ($mode eq "CPP") {
print "// This file was generated by credits.pl. Do not edit by hand!\n";
- print "static const char *credits[] = {\n";
+ print "static const char *const credits[] = {\n";
} elsif ($mode eq "YAML") {
print "# This file was generated by credits.pl. Do not edit by hand!\n";
} elsif ($mode eq "RST") {
diff --git a/engines/logo_data.h b/engines/logo_data.h
index 3158db6e661..443a2c1c110 100644
--- a/engines/logo_data.h
+++ b/engines/logo_data.h
@@ -23,7 +23,7 @@
// recode ../d1 <dists/scummvm_logo.bmp >logo_data.h
// The tool is from https://github.com/pinard/Recode
-byte logo_data[] = {
+static const byte logo_data[] = {
66, 77, 176, 45, 0, 0, 0, 0, 0, 0, 54, 4, 0, 0, 40,
0, 0, 0, 44, 1, 0, 0, 83, 0, 0, 0, 1, 0, 8, 0,
1, 0, 0, 0, 122, 41, 0, 0, 19, 11, 0, 0, 19, 11, 0,
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 6220e5d2542..4d981d1cc9f 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -34,7 +34,7 @@ namespace Graphics {
// Source: Apple IIGS Technical Note #41, "Font Family Numbers"
// https://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.041.html
-static struct FontProto {
+static const struct FontProto {
int id;
Common::Language lang;
Common::CodePage encoding;
@@ -77,7 +77,7 @@ struct AliasProto {
const char *name;
};
-static AliasProto defaultAliases[] = {
+static const AliasProto defaultAliases[] = {
// English names for Japanese fonts
{ 16436, 16436, "OsakaMono" },
@@ -95,13 +95,13 @@ static AliasProto defaultAliases[] = {
{ -1, -1, NULL }
};
-static AliasProto latinModeAliases[] = {
+static const AliasProto latinModeAliases[] = {
{ 0, 16383, "System" }, // Chicago
{ 1, 3, "Application" }, // Geneva
{ -1, -1, NULL }
};
-static AliasProto japaneseModeAliases[] = {
+static const AliasProto japaneseModeAliases[] = {
{ 0, 16384, "System" }, // Osaka
{ 1, 16384, "Application" }, // Osaka
{ -1, -1, NULL }
@@ -146,7 +146,7 @@ Common::String cleanFontName(const Common::String fontname) {
MacFontManager::MacFontManager(uint32 mode, Common::Language language) : _mode(mode),
_language(language), _japaneseFontsLoaded(false) {
- for (FontProto *font = defaultFonts; font->name; font++) {
+ for (const FontProto *font = defaultFonts; font->name; font++) {
if (!_fontInfo.contains(font->id)) {
FontInfo *info = new FontInfo;
info->lang = font->lang;
@@ -158,7 +158,7 @@ MacFontManager::MacFontManager(uint32 mode, Common::Language language) : _mode(m
_fontIds[font->name] = font->id;
}
}
- for (AliasProto *alias = defaultAliases; alias->name; alias++) {
+ for (const AliasProto *alias = defaultAliases; alias->name; alias++) {
if (!_fontInfo.contains(alias->id)) {
FontInfo *info = new FontInfo;
info->aliasForId = alias->aliasForId;
@@ -194,12 +194,12 @@ MacFontManager::~MacFontManager() {
}
void MacFontManager::setLocalizedFonts() {
- AliasProto *aliases = latinModeAliases;
+ const AliasProto *aliases = latinModeAliases;
if (_language == Common::JA_JPN) {
aliases = japaneseModeAliases;
loadJapaneseFonts();
}
- for (AliasProto *alias = aliases; alias->name; alias++) {
+ for (const AliasProto *alias = aliases; alias->name; alias++) {
if (_fontInfo.contains(alias->id)) {
// Overwrite the font info that's already registered in case
// we're switching languages or something.
diff --git a/graphics/nanosvg/nanosvg.h b/graphics/nanosvg/nanosvg.h
index 2d506e468dc..a4e0882825c 100644
--- a/graphics/nanosvg/nanosvg.h
+++ b/graphics/nanosvg/nanosvg.h
@@ -1252,7 +1252,7 @@ typedef struct NSVGNamedColor {
unsigned int color;
} NSVGNamedColor;
-NSVGNamedColor nsvg__colors[] = {
+static const NSVGNamedColor nsvg__colors[] = {
{ "red", NSVG_RGB(255, 0, 0) },
{ "green", NSVG_RGB( 0, 128, 0) },
diff --git a/graphics/opengl/shader.cpp b/graphics/opengl/shader.cpp
index e5ed1611aed..eb092a0fea6 100644
--- a/graphics/opengl/shader.cpp
+++ b/graphics/opengl/shader.cpp
@@ -32,7 +32,7 @@
namespace OpenGL {
-static const char *compatVertex =
+static const char *const compatVertex =
"#if defined(GL_ES)\n"
"#define ROUND(x) (sign(x) * floor(abs(x) + .5))\n"
"#define in attribute\n"
@@ -46,7 +46,7 @@ static const char *compatVertex =
"#define ROUND(x) round(x)\n"
"#endif\n";
-static const char *compatFragment =
+static const char *const compatFragment =
"#if defined(GL_ES)\n"
"#define in varying\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
@@ -68,11 +68,11 @@ static const char *compatFragment =
// OGLES2 on AmigaOS doesn't support uniform booleans, let's introduce some shim
#if defined(AMIGAOS)
-static const char *compatUniformBool =
+static const char *const compatUniformBool =
"#define UBOOL mediump int\n"
"#define UBOOL_TEST(v) (v != 0)\n";
#else
-static const char *compatUniformBool =
+static const char *const compatUniformBool =
"#define UBOOL bool\n"
"#define UBOOL_TEST(v) v\n";
#endif
diff --git a/graphics/tinygl/clip.cpp b/graphics/tinygl/clip.cpp
index 7da5f29e5fc..d0b0b968873 100644
--- a/graphics/tinygl/clip.cpp
+++ b/graphics/tinygl/clip.cpp
@@ -215,7 +215,7 @@ clip_func(clip_ymax, +, Y, X, Z)
clip_func(clip_zmin, -, Z, X, Y)
clip_func(clip_zmax, +, Z, X, Y)
-float(*clip_proc[6])(Vector4 *, Vector4 *, Vector4 *) = {
+float(*const clip_proc[6])(Vector4 *, Vector4 *, Vector4 *) = {
clip_xmin, clip_xmax,
clip_ymin, clip_ymax,
clip_zmin, clip_zmax
diff --git a/graphics/tinygl/list.cpp b/graphics/tinygl/list.cpp
index 013dd7946db..32db4a5882b 100644
--- a/graphics/tinygl/list.cpp
+++ b/graphics/tinygl/list.cpp
@@ -37,17 +37,17 @@ static void glop ## aa (GLContext *c, GLParam *p) { \
}
#include "graphics/tinygl/opinfo.h"
-static const char *op_table_str[] = {
+static const char *const op_table_str[] = {
#define ADD_OP(a, b, c) "gl" #a " " #c,
#include "graphics/tinygl/opinfo.h"
};
-static void (*op_table_func[])(GLContext *, GLParam *) = {
+static void (*const op_table_func[])(GLContext *, GLParam *) = {
#define ADD_OP(a, b, c) glop ## a ,
#include "graphics/tinygl/opinfo.h"
};
-static int op_table_size[] = {
+static const int op_table_size[] = {
#define ADD_OP(a, b, c) b + 1 ,
#include "graphics/tinygl/opinfo.h"
};
diff --git a/gui/about.cpp b/gui/about.cpp
index c6cae225404..381f645a180 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -63,7 +63,7 @@ enum {
// TODO: Add different font sizes (for bigger headlines)
// TODO: Allow color change in the middle of a line...
-static const char *copyright_text[] = {
+static const char *const copyright_text[] = {
"",
"C0""Copyright (C) 2001-2023 The ScummVM Team",
"C0""https://www.scummvm.org",
@@ -72,7 +72,7 @@ static const char *copyright_text[] = {
"",
};
-static const char *gpl_text[] = {
+static const char *const gpl_text[] = {
"",
"C0""This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.",
"C0""",
@@ -1348,7 +1348,7 @@ static const int spcolors[10 * 3] = {
0, 0, 0, 12, 12, 12
};
-const char *codes =
+const char *const codes =
"Dvhgkm#Ztrsm|ffrs(#$%&'#$%&O}pes&}{1$M{tiq$%&'#$M{tiq${y5(Fsrv||hv%&'#$"
"Hutxxxjx'~v2%N|udr%&'#Gtsw}wiw&}{1$Hutxxxjx'#$%&'(#$%W|qw$%&'(#$%&'";
diff --git a/gui/credits.h b/gui/credits.h
index 3d9e3598bd5..23eed2dc5d5 100644
--- a/gui/credits.h
+++ b/gui/credits.h
@@ -1,5 +1,5 @@
// This file was generated by credits.pl. Do not edit by hand!
-static const char *credits[] = {
+static const char *const credits[] = {
"C1""ScummVM Team",
"",
"C1""Project Leaders",
diff --git a/gui/options.cpp b/gui/options.cpp
index c48869d9e3d..0625c15d049 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -146,10 +146,10 @@ enum {
kApplyCmd = 'appl'
};
-static const char *savePeriodLabels[] = { _s("Never"), _s("Every 5 mins"), _s("Every 10 mins"), _s("Every 15 mins"), _s("Every 30 mins"), nullptr };
+static const char *const savePeriodLabels[] = { _s("Never"), _s("Every 5 mins"), _s("Every 10 mins"), _s("Every 15 mins"), _s("Every 30 mins"), nullptr };
static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 };
-static const char *guiBaseLabels[] = {
+static const char *const guiBaseLabels[] = {
// I18N: Very large GUI scale
_s("Very large"),
// I18N: Large GUI scale
@@ -164,7 +164,7 @@ static const int guiBaseValues[] = { 150, 125, 100, 75, -1 };
// The keyboard mouse speed values range from 0 to 7 and correspond to speeds shown in the label
// "10" (value 3) is the default speed corresponding to the speed before introduction of this control
-static const char *kbdMouseSpeedLabels[] = { "3", "5", "8", "10", "13", "15", "18", "20", nullptr };
+static const char *const kbdMouseSpeedLabels[] = { "3", "5", "8", "10", "13", "15", "18", "20", nullptr };
OptionsDialog::OptionsDialog(const Common::String &domain, int x, int y, int w, int h)
: Dialog(x, y, w, h), _domain(domain), _graphicsTabId(-1), _midiTabId(-1), _pathsTabId(-1), _tabWidget(nullptr) {
diff --git a/gui/shaderbrowser-dialog.cpp b/gui/shaderbrowser-dialog.cpp
index d5388e6c7e4..c6e614a2ec9 100644
--- a/gui/shaderbrowser-dialog.cpp
+++ b/gui/shaderbrowser-dialog.cpp
@@ -44,8 +44,8 @@ enum {
kSearchClearCmd = 'SRCL',
};
-const char *kFileMask = "*.glslp";
-const char *kFileExt = "glslp";
+const char *const kFileMask = "*.glslp";
+const char *const kFileExt = "glslp";
ShaderBrowserDialog::ShaderBrowserDialog(const Common::Path &initialSelection) : Dialog("ShaderBrowser") {
diff --git a/icons/scummvm.xpm b/icons/scummvm.xpm
index ef6e61f72aa..be18145bfb9 100644
--- a/icons/scummvm.xpm
+++ b/icons/scummvm.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char *scummvm_icon[] = {
+static const char *const scummvm_icon[] = {
/* columns rows colors chars-per-pixel */
"32 32 25 1 ",
" c #222222",
diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp
index 32c4583b213..37d24106ab9 100644
--- a/image/codecs/indeo4.cpp
+++ b/image/codecs/indeo4.cpp
@@ -869,7 +869,7 @@ const uint Indeo4Decoder::_ivi4_common_pic_sizes[14] = {
640, 480, 320, 240, 160, 120, 704, 480, 352, 240, 352, 288, 176, 144
};
-Indeo4Decoder::Transform Indeo4Decoder::_transforms[18] = {
+const Indeo4Decoder::Transform Indeo4Decoder::_transforms[18] = {
{ IndeoDSP::ffIviInverseHaar8x8, IndeoDSP::ffIviDcHaar2d, 1 },
{ IndeoDSP::ffIviRowHaar8, IndeoDSP::ffIviDcHaar2d, 0 },
{ IndeoDSP::ffIviColHaar8, IndeoDSP::ffIviDcHaar2d, 0 },
diff --git a/image/codecs/indeo4.h b/image/codecs/indeo4.h
index 0cba883991c..efd95a7aa33 100644
--- a/image/codecs/indeo4.h
+++ b/image/codecs/indeo4.h
@@ -122,7 +122,7 @@ private:
/**
* Transformations list
*/
- static Transform _transforms[18];
+ static const Transform _transforms[18];
static const uint8 *const _scan_index_to_tab[15];
diff --git a/image/codecs/svq1_vlc.h b/image/codecs/svq1_vlc.h
index 3778e3fb981..3666a71e3cb 100644
--- a/image/codecs/svq1_vlc.h
+++ b/image/codecs/svq1_vlc.h
@@ -85,12 +85,12 @@ static const uint32 s_svq1IntraMultistageCodes5[8] = {
1, 1, 1, 1, 1, 1, 0, 1
};
-static const byte *s_svq1IntraMultistageLengths[6] = {
+static const byte *const s_svq1IntraMultistageLengths[6] = {
s_svq1IntraMultistageLengths0, s_svq1IntraMultistageLengths1, s_svq1IntraMultistageLengths2,
s_svq1IntraMultistageLengths3, s_svq1IntraMultistageLengths4, s_svq1IntraMultistageLengths5
};
-static const uint32 *s_svq1IntraMultistageCodes[6] = {
+static const uint32 *const s_svq1IntraMultistageCodes[6] = {
s_svq1IntraMultistageCodes0, s_svq1IntraMultistageCodes1, s_svq1IntraMultistageCodes2,
s_svq1IntraMultistageCodes3, s_svq1IntraMultistageCodes4, s_svq1IntraMultistageCodes5
};
@@ -143,12 +143,12 @@ static const uint32 s_svq1InterMultistageCodes5[8] = {
1, 1, 1, 3, 2, 1, 1, 0
};
-static const byte *s_svq1InterMultistageLengths[6] = {
+static const byte *const s_svq1InterMultistageLengths[6] = {
s_svq1InterMultistageLengths0, s_svq1InterMultistageLengths1, s_svq1InterMultistageLengths2,
s_svq1InterMultistageLengths3, s_svq1InterMultistageLengths4, s_svq1InterMultistageLengths5
};
-static const uint32 *s_svq1InterMultistageCodes[6] = {
+static const uint32 *const s_svq1InterMultistageCodes[6] = {
s_svq1InterMultistageCodes0, s_svq1InterMultistageCodes1, s_svq1InterMultistageCodes2,
s_svq1InterMultistageCodes3, s_svq1InterMultistageCodes4, s_svq1InterMultistageCodes5
};
diff --git a/math/sinewindows.cpp b/math/sinewindows.cpp
index 9efb89083bc..e9643d82d50 100644
--- a/math/sinewindows.cpp
+++ b/math/sinewindows.cpp
@@ -1067,7 +1067,7 @@ static const float sineWindow4096[4096] = {
0.999996f, 0.999997f, 0.999998f, 0.999999f, 0.999999f, 1.000000f, 1.000000f, 1.000000f
};
-static const float *sineWindows[13] = {
+static const float *const sineWindows[13] = {
nullptr , nullptr , nullptr , nullptr , nullptr ,
sineWindow32 , sineWindow64 , sineWindow128 , sineWindow256, sineWindow512,
sineWindow1024, sineWindow2048, sineWindow4096
Commit: 30b977c2720ef7a4c2ca6deca2d890dea75c2f9a
https://github.com/scummvm/scummvm/commit/30b977c2720ef7a4c2ca6deca2d890dea75c2f9a
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-12-26T20:23:59+01:00
Commit Message:
DETECTION: Mark more symbols as const
Changed paths:
engines/advancedDetector.cpp
engines/asylum/detection_tables.h
engines/buried/detection.cpp
engines/cge2/cge2.h
engines/cge2/cge2_main.cpp
engines/cge2/fileio.cpp
engines/cge2/fileio.h
engines/composer/detection.cpp
engines/cryomni3d/detection_tables.h
engines/director/detection.cpp
engines/director/detection.h
engines/director/detection_paths.h
engines/groovie/detection.cpp
engines/hopkins/detection.cpp
engines/mohawk/detection.cpp
engines/mtropolis/detection.cpp
engines/myst3/detection.cpp
engines/pink/detection.cpp
engines/prince/detection.cpp
engines/saga2/detection.cpp
engines/sci/detection.cpp
engines/sword25/detection.cpp
engines/tetraedge/detection.cpp
engines/touche/detection.cpp
engines/trecision/detection.cpp
engines/vcruise/detection.cpp
engines/wintermute/detection.cpp
engines/zvision/detection_tables.h
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index ca89caf534a..24c19fed278 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -979,7 +979,7 @@ PlainGameDescriptor AdvancedMetaEngineDetection::findGame(const char *gameId) co
return PlainGameDescriptor::empty();
}
-static const char *grayList[] = {
+static const char *const grayList[] = {
"game.exe",
"demo.exe",
"game",
diff --git a/engines/asylum/detection_tables.h b/engines/asylum/detection_tables.h
index e58eef955db..af38ff6d0bf 100644
--- a/engines/asylum/detection_tables.h
+++ b/engines/asylum/detection_tables.h
@@ -26,7 +26,7 @@ static const PlainGameDescriptor asylumGames[] = {
namespace Asylum {
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"Vids",
0
};
diff --git a/engines/buried/detection.cpp b/engines/buried/detection.cpp
index c4d9b6535f7..e43c0d33964 100644
--- a/engines/buried/detection.cpp
+++ b/engines/buried/detection.cpp
@@ -39,7 +39,7 @@ static const PlainGameDescriptor buriedGames[] = {
namespace Buried {
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"win31",
"manual",
nullptr
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index 672feb532e9..386dd1838b8 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -231,7 +231,7 @@ public:
int number(char *s);
char *token(char *s);
char *tail(char *s);
- int takeEnum(const char **tab, const char *text);
+ int takeEnum(const char *const *tab, const char *text);
ID ident(const char *s);
bool testBool(char *s);
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index aad6f380978..9479785168f 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -130,9 +130,9 @@ char *CGE2Engine::tail(char *s) {
return s;
}
-int CGE2Engine::takeEnum(const char **tab, const char *text) {
+int CGE2Engine::takeEnum(const char *const *tab, const char *text) {
if (text) {
- for (const char **e = tab; *e; e++) {
+ for (const char *const *e = tab; *e; e++) {
if (scumm_stricmp(text, *e) == 0)
return e - tab;
}
diff --git a/engines/cge2/fileio.cpp b/engines/cge2/fileio.cpp
index 7677f8e2419..75fbb1f93e5 100644
--- a/engines/cge2/fileio.cpp
+++ b/engines/cge2/fileio.cpp
@@ -271,7 +271,7 @@ EncryptedStream::~EncryptedStream() {
delete _readStream;
}
-const char *EncryptedStream::kIdTab[] = {
+const char *const EncryptedStream::kIdTab[] = {
"[near]", "[mtake]", "[ftake]", "[phase]", "[seq]",
"Name", "Type", "Front", "East",
"Portable", "Transparent",
diff --git a/engines/cge2/fileio.h b/engines/cge2/fileio.h
index 41a53550c95..4d507d2a0b9 100644
--- a/engines/cge2/fileio.h
+++ b/engines/cge2/fileio.h
@@ -121,7 +121,7 @@ public:
Common::String readLine();
int getLineCount() { return _lineCount; }
- static const char *kIdTab[];
+ static const char *const kIdTab[];
};
} // End of namespace CGE2
diff --git a/engines/composer/detection.cpp b/engines/composer/detection.cpp
index 159fc975241..0c129977d54 100644
--- a/engines/composer/detection.cpp
+++ b/engines/composer/detection.cpp
@@ -42,7 +42,7 @@ static const PlainGameDescriptor composerGames[] = {
using namespace Composer;
// we match from data too, to stop detection from a non-top-level directory
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"data",
"liam",
"programs",
diff --git a/engines/cryomni3d/detection_tables.h b/engines/cryomni3d/detection_tables.h
index d7390130fb7..80f35500d5a 100644
--- a/engines/cryomni3d/detection_tables.h
+++ b/engines/cryomni3d/detection_tables.h
@@ -570,7 +570,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
{ AD_TABLE_END_MARKER, 0, 0 }
};
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
/** Versailles 1685 **/
/* DATAS_V/ANIMACTI/LEVEL1/11D_LEB1.HNM
* DATAS_V/ANIMACTI/LEVEL7/COFBOUM.HNM */
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 1ea6dfd31cf..80c1659dfdd 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -33,7 +33,7 @@
#include "director/detection_tables.h"
#include "director/detection_paths.h"
-static struct CustomTarget {
+static const struct CustomTarget {
const char *name;
const char *platform;
const char *version;
diff --git a/engines/director/detection.h b/engines/director/detection.h
index 99b67cc6bb3..8743bd85405 100644
--- a/engines/director/detection.h
+++ b/engines/director/detection.h
@@ -39,7 +39,7 @@ struct DirectorGameDescription {
uint16 version;
};
-extern const char *directoryGlobs[];
+extern const char *const directoryGlobs[];
} // End of namespace Director
diff --git a/engines/director/detection_paths.h b/engines/director/detection_paths.h
index c626c28c8c2..cc0bbab5063 100644
--- a/engines/director/detection_paths.h
+++ b/engines/director/detection_paths.h
@@ -24,7 +24,7 @@
namespace Director {
-const char *directoryGlobs[] = {
+const char *const directoryGlobs[] = {
"install",
"win_data", // L-ZONE
"data",
diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp
index 918e2cc108a..2d6f7f8c3f9 100644
--- a/engines/groovie/detection.cpp
+++ b/engines/groovie/detection.cpp
@@ -268,7 +268,7 @@ static const GroovieGameDescription gameDescriptions[] = {
};
// clang-format on
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"MIDI",
"GROOVIE",
"MEDIA",
diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp
index b355f95d226..79efa7247e6 100644
--- a/engines/hopkins/detection.cpp
+++ b/engines/hopkins/detection.cpp
@@ -38,7 +38,7 @@ static const PlainGameDescriptor hopkinsGames[] = {
#include "hopkins/detection_tables.h"
-const static char *directoryGlobs[] = {
+const static char *const directoryGlobs[] = {
"voice",
"link",
nullptr
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index cac036cf895..7df3e337900 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -83,7 +83,7 @@ static const PlainGameDescriptor mohawkGames[] = {
#include "mohawk/detection_tables.h"
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"all",
"assets1",
"data",
diff --git a/engines/mtropolis/detection.cpp b/engines/mtropolis/detection.cpp
index 05783ad8554..b56adf7a274 100644
--- a/engines/mtropolis/detection.cpp
+++ b/engines/mtropolis/detection.cpp
@@ -42,7 +42,7 @@ static const PlainGameDescriptor mTropolisGames[] = {
#include "mtropolis/detection_tables.h"
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"Obsidian",
"RESOURCE",
"Saved Games",
diff --git a/engines/myst3/detection.cpp b/engines/myst3/detection.cpp
index 8eb56db4442..29648c31b4a 100644
--- a/engines/myst3/detection.cpp
+++ b/engines/myst3/detection.cpp
@@ -41,7 +41,7 @@ static const DebugChannelDef debugFlagList[] = {
DEBUG_CHANNEL_END
};
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"bin",
"M3Data",
"MYST3BIN",
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index c499fa27f73..bc213076f47 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -33,7 +33,7 @@ static const PlainGameDescriptor pinkGames[] = {
#include "pink/detection_tables.h"
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"install",
nullptr
};
diff --git a/engines/prince/detection.cpp b/engines/prince/detection.cpp
index 91d1d841ead..2e537d90735 100644
--- a/engines/prince/detection.cpp
+++ b/engines/prince/detection.cpp
@@ -156,7 +156,7 @@ static const PrinceGameDescription gameDescriptions[] = {
} // End of namespace Prince
-const static char *directoryGlobs[] = {
+const static char *const directoryGlobs[] = {
"all",
nullptr
};
diff --git a/engines/saga2/detection.cpp b/engines/saga2/detection.cpp
index 69ed4f5f90c..4572b16d027 100644
--- a/engines/saga2/detection.cpp
+++ b/engines/saga2/detection.cpp
@@ -121,7 +121,7 @@ static const SAGA2GameDescription gameDescriptions[] = {
};
} // End of namespace Saga2
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"res",
"win",
nullptr
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 3e48c5f4da8..f8e3bea2787 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -165,7 +165,7 @@ static const PlainGameDescriptor s_sciGameTitles[] = {
namespace Sci {
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"avi",
"english",
"french",
diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp
index bfc79e8dc64..1845418c9c6 100644
--- a/engines/sword25/detection.cpp
+++ b/engines/sword25/detection.cpp
@@ -37,7 +37,7 @@ static const DebugChannelDef debugFlagList[] = {
DEBUG_CHANNEL_END
};
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"system", // Used by extracted dats
0
};
diff --git a/engines/tetraedge/detection.cpp b/engines/tetraedge/detection.cpp
index d7094038435..bad5b25783f 100644
--- a/engines/tetraedge/detection.cpp
+++ b/engines/tetraedge/detection.cpp
@@ -38,7 +38,7 @@ TetraedgeMetaEngineDetection::TetraedgeMetaEngineDetection() : AdvancedMetaEngin
}
static const Common::Language *getGameLanguages() {
- static Common::Language languages[] = {
+ static const Common::Language languages[] = {
Common::EN_ANY,
Common::FR_FRA,
Common::DE_DEU,
diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp
index c838b0a26e6..301243d6380 100644
--- a/engines/touche/detection.cpp
+++ b/engines/touche/detection.cpp
@@ -133,7 +133,7 @@ static const ADFileBasedFallback fileBasedFallback[] = {
} // End of namespace Touche
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"database",
0
};
diff --git a/engines/trecision/detection.cpp b/engines/trecision/detection.cpp
index d93eacb6fdb..d0bcbd3d8e7 100644
--- a/engines/trecision/detection.cpp
+++ b/engines/trecision/detection.cpp
@@ -213,7 +213,7 @@ static const ADGameDescription gameDescriptions[] = {
} // End of namespace Trecision
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"autorun",
"data",
0
diff --git a/engines/vcruise/detection.cpp b/engines/vcruise/detection.cpp
index b88a1b7eb03..afb968ec6fc 100644
--- a/engines/vcruise/detection.cpp
+++ b/engines/vcruise/detection.cpp
@@ -34,7 +34,7 @@ static const PlainGameDescriptor g_vcruiseGames[] = {
{nullptr, nullptr}
};
-static const char *g_vcruiseDirectoryGlobs[] = {
+static const char *const g_vcruiseDirectoryGlobs[] = {
"Sfx",
"Log",
"Waves-12",
diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp
index 2f24ef8f3bd..77048f002f6 100644
--- a/engines/wintermute/detection.cpp
+++ b/engines/wintermute/detection.cpp
@@ -44,7 +44,7 @@ static const DebugChannelDef debugFlagList[] = {
namespace Wintermute {
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"language", // To detect the various languages
"languages", // To detect the various languages
"localization", // To detect the various languages
diff --git a/engines/zvision/detection_tables.h b/engines/zvision/detection_tables.h
index cdeba990c8a..fd7d648ed62 100644
--- a/engines/zvision/detection_tables.h
+++ b/engines/zvision/detection_tables.h
@@ -32,7 +32,7 @@ static const PlainGameDescriptor zVisionGames[] = {
{ 0, 0 }
};
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"znemscr",
"taunts", // zgi mac
0
Commit: 6522c6e11d2cfb60bef8972bfa4ee5716b012873
https://github.com/scummvm/scummvm/commit/6522c6e11d2cfb60bef8972bfa4ee5716b012873
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-12-26T20:23:59+01:00
Commit Message:
GRAPHICS: Make the Graphics::PixelFormat constructors constexpr
Changed paths:
graphics/pixelformat.h
diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h
index 5973dd18bab..539a4ded15b 100644
--- a/graphics/pixelformat.h
+++ b/graphics/pixelformat.h
@@ -142,11 +142,10 @@ struct PixelFormat {
byte rShift, gShift, bShift, aShift; /**< Binary left shift of each color component in the pixel value. */
/** Default constructor that creates a null pixel format. */
- inline PixelFormat() {
- bytesPerPixel =
- rLoss = gLoss = bLoss = aLoss =
- rShift = gShift = bShift = aShift = 0;
- }
+ constexpr PixelFormat() :
+ bytesPerPixel(0),
+ rLoss(0), gLoss(0), bLoss(0), aLoss(0),
+ rShift(0), gShift(0), bShift(0), aShift(0) {}
/** Construct a pixel format based on the provided arguments.
*
@@ -166,19 +165,18 @@ struct PixelFormat {
* @endcode
*/
- inline PixelFormat(byte BytesPerPixel,
+ constexpr PixelFormat(byte BytesPerPixel,
byte RBits, byte GBits, byte BBits, byte ABits,
- byte RShift, byte GShift, byte BShift, byte AShift) {
- bytesPerPixel = BytesPerPixel;
- rLoss = 8 - RBits;
- gLoss = 8 - GBits;
- bLoss = 8 - BBits;
- aLoss = 8 - ABits;
- rShift = RShift;
- gShift = GShift;
- bShift = BShift;
- aShift = AShift;
- }
+ byte RShift, byte GShift, byte BShift, byte AShift) :
+ bytesPerPixel(BytesPerPixel),
+ rLoss(8 - RBits),
+ gLoss(8 - GBits),
+ bLoss(8 - BBits),
+ aLoss(8 - ABits),
+ rShift(RShift),
+ gShift(GShift),
+ bShift(BShift),
+ aShift(AShift) {}
/** Define a CLUT8 pixel format. */
static inline PixelFormat createFormatCLUT8() {
Commit: eda69db63ce0a0bc5ef96ace3e5c570185879acd
https://github.com/scummvm/scummvm/commit/eda69db63ce0a0bc5ef96ace3e5c570185879acd
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-12-26T20:23:59+01:00
Commit Message:
COMMON: Allow passing const pointers to BitArray::set_bits()
Changed paths:
common/bitarray.h
diff --git a/common/bitarray.h b/common/bitarray.h
index 344ff54a0c7..bfb89823687 100644
--- a/common/bitarray.h
+++ b/common/bitarray.h
@@ -48,7 +48,7 @@ public:
_bits = (byte*)malloc((bitcount + 7) / 8);
clear();
}
- void set_bits(byte *bits) {
+ void set_bits(const byte *bits) {
memcpy(_bits, bits, (_bitcount + 7) / 8);
}
More information about the Scummvm-git-logs
mailing list