Zandronum Chat @
Get the latest version: 3.0
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003809Doomseeker[All Projects] Cleanuppublic2020-06-07 03:542020-06-08 01:04
Assigned To 
PlatformOSOS Version
Product Version1.3.1 
Target VersionFixed in Version 
Summary0003809: Some string literals with escaped characters are not raw string literals (modernize-raw-string-literal)
DescriptionUgly escape characters in some source code, impeding readability.
Steps To ReproduceSome examples from a common regex:
$ grep -r "a-z" src/
src/plugins/zandronum/zandronumserver.cpp:const QRegExp ZandronumVersion::versionExpression(R"((\d+).(\d+)(?:.(\d+)(?:.(\d+))?)?(?:-([a-zA-Z]*)?)?(?:-r(\d+)(?:-(\d+))?)?)");

src/plugins/zandronum/zandronumrconprotocol.cpp:        static const QRegExp colorCode(R"(\\c(\[[a-zA-Z0-9]*\]|[a-v+\-!*]))");

src/core/gui/widgets/serverconsole.cpp:         static const QRegExp colorCode("\034(\\[[a-zA-Z0-9]*\\]|[a-v+\\-!*])");

src/core/irc/ircnicknamecompleter.cpp:          const QString NICKNAME_MATCH = R"(\[\]\{\}\-\^\`\|\\A-Za-z0-9_)";

src/core/commandline.cpp:       QRegExp reallySafestCharsIHope = QRegExp("[^a-z0-9/\\_-+]", 
src/core/serverapi/serverstructs.cpp:   return name.toLower().remove(QRegExp("[^a-z0-9]"));

Notice serverconsole.cpp and commandline.cpp containing a double backslash (escape characters).

Some of these may be better as raw string literals:
$ grep -r '\\\"' src/ | wc -l
Additional Information [^]
Attached Files

- Relationships

-  Notes
User avatar (0021362)
WubTheCaptain (developer)
2020-06-07 03:56

Also looking closer, some of those regexes might look suspect while being parsed as raw string literals (instead of just string literals).
User avatar (0021404)
Blzut3 (administrator)
2020-06-08 01:04

Actually somehow missed that C++ had these raw string literally until a few weeks ago. Converting the escape heavy strings (like the regexps) would be a nice way to tidy things up, but yeah you would definitely need to make sure that they're coming out of the transformation correctly.

Issue Community Support
Only registered users can voice their support. Click here to register, or here to log in.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2020-06-07 03:54 WubTheCaptain New Issue
2020-06-07 03:56 WubTheCaptain Note Added: 0021362
2020-06-07 19:57 Pol M Status new => confirmed
2020-06-08 01:04 Blzut3 Note Added: 0021404

Questions or other issues? Contact Us.


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker