Skip to content

Commit 0776ae6

Browse files
committed
Use C++11 constexpr char instead of static const char
1 parent bf3978c commit 0776ae6

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

ipc/http.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
#include "platform/devicemanager.h"
1212
#include "platform/unify.h"
1313

14-
static const char httpVersion[] = "HTTP/1.1";
15-
static const char errorDocument[] = "<html><head><title>%1</title></head>"
14+
constexpr char httpVersion[] = "HTTP/1.1";
15+
constexpr char errorDocument[] = "<html><head><title>%1</title></head>"
1616
"<body><h1>%1</h1></body></html>";
17-
static const char mimeFormUrlEncoded[] = "application/x-www-form-urlencoded";
18-
static const char mimeHtml[] = "text/html";
19-
static const char dateZero[] = "1970.01.01 00:00";
17+
constexpr char mimeFormUrlEncoded[] = "application/x-www-form-urlencoded";
18+
constexpr char mimeHtml[] = "text/html";
19+
constexpr char dateZero[] = "1970.01.01 00:00";
2020

2121
static QMap<HttpResponse::HttpStatus,QString> statusToText = {
2222
{ HttpResponse::Http200Ok, "200 OK" },
@@ -80,7 +80,7 @@ HttpResponse::HttpResponse()
8080

8181
void HttpResponse::fillHeaders()
8282
{
83-
static const char dateFmt[] = "ddd, dd MMM yyyy HH:mm:ss t";
83+
constexpr char dateFmt[] = "ddd, dd MMM yyyy HH:mm:ss t";
8484
headers["Date"] = dateResponse.toString(dateFmt);
8585
if (!headers.contains("Server"))
8686
headers["Server"] = QCoreApplication::applicationName();
@@ -227,7 +227,7 @@ QString HttpServer::urlEncode(QString plainText)
227227
map[(byte)']'] = 1;
228228
return map;
229229
}();
230-
static const char hexadecimal[] = "0123456789ABCDEF";
230+
constexpr char hexadecimal[] = "0123456789ABCDEF";
231231
QByteArray ba = plainText.toUtf8();
232232
QByteArray dest;
233233
const byte *data = reinterpret_cast<const byte*>(ba.constData());

main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929

3030
//---------------------------------------------------------------------------
3131

32-
static const char flatpakDesktopFile[] = "io.github.mpc_qt.Mpc-Qt";
32+
constexpr char flatpakDesktopFile[] = "io.github.mpc_qt.Mpc-Qt";
3333

34-
static const char keyCommand[] = "command";
35-
static const char keyDirectory[] = "directory";
36-
static const char keyFiles[] = "files";
37-
static const char keyStreams[] = "streams";
34+
constexpr char keyCommand[] = "command";
35+
constexpr char keyDirectory[] = "directory";
36+
constexpr char keyFiles[] = "files";
37+
constexpr char keyStreams[] = "streams";
3838

3939
static const char fileFavorites[] = "favorites";
4040
static const char fileGeometryV2[] = "geometry_v2";

mainwindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#include <QStyle>
2929

3030
using namespace Helpers;
31-
static const char SKIPACTION[] = "Skip";
32-
static const char textWindowTitle[] = "Media Player Classic Qute Theater";
31+
constexpr char SKIPACTION[] = "Skip";
32+
constexpr char textWindowTitle[] = "Media Player Classic Qute Theater";
3333

3434

3535
MainWindow::MainWindow(QWidget *parent) :

manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include "logger.h"
55

66
using namespace Helpers;
7-
static const char strTrue[] = "true";
8-
static const char strFalse[] = "false";
7+
constexpr char strTrue[] = "true";
8+
constexpr char strFalse[] = "false";
99

1010
Q_GLOBAL_STATIC_WITH_ARGS(QRegularExpression, wordSplitter, ("\\W+"));
1111

platform/windowmanager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include "mainwindow.h"
88
#include "windowmanager.h"
99

10-
static const char keyGeometry[] = "geometry";
11-
static const char keyMaximized[] = "maximized";
12-
static const char keyQtState[] = "qtState";
13-
static const char keyState[] = "state";
10+
constexpr char keyGeometry[] = "geometry";
11+
constexpr char keyMaximized[] = "maximized";
12+
constexpr char keyQtState[] = "qtState";
13+
constexpr char keyState[] = "state";
1414

1515
WindowManager::WindowManager(QObject *parent)
1616
: QObject{parent}

thumbnailerwindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#include "ui_thumbnailerwindow.h"
1212

1313
// NOTE: do we configure the thumb format in the settings dialog?
14-
static const char logModule[] = "thumbnailer";
15-
static const char friendlyName[] = "Media Player Classic Qute Theater - Thumbnailer";
16-
static const char thumbFormat[] = "%f_thumbs_[%t{yyyy.MM.dd_hh.mm.ss}]";
17-
static const char saveDialogFilter[] = "Images (*.png *.jpg *.jpeg)";
14+
constexpr char logModule[] = "thumbnailer";
15+
constexpr char friendlyName[] = "Media Player Classic Qute Theater - Thumbnailer";
16+
constexpr char thumbFormat[] = "%f_thumbs_[%t{yyyy.MM.dd_hh.mm.ss}]";
17+
constexpr char saveDialogFilter[] = "Images (*.png *.jpg *.jpeg)";
1818

1919
constexpr int thumbMargin = 8;
2020
constexpr int pageMargin = 10;

0 commit comments

Comments
 (0)