Don't use <regex>
for trivial cases (#4056)
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include <regex>
|
|
||||||
#include "rtwindow.h"
|
#include "rtwindow.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
@@ -315,23 +314,14 @@ void RTWindow::on_realize ()
|
|||||||
|
|
||||||
// Display release notes only if new major version.
|
// Display release notes only if new major version.
|
||||||
// Pattern matches "5.1" from "5.1-23-g12345678"
|
// Pattern matches "5.1" from "5.1-23-g12345678"
|
||||||
std::string vs[] = {versionString, options.version};
|
const std::string vs[] = {versionString, options.version};
|
||||||
std::regex pat ("(^[0-9.]+).*");
|
|
||||||
std::smatch sm;
|
|
||||||
std::vector<std::string> vMajor;
|
std::vector<std::string> vMajor;
|
||||||
|
|
||||||
for (const auto &v : vs) {
|
for (const auto& v : vs) {
|
||||||
if (std::regex_match (v, sm, pat)) {
|
vMajor.emplace_back(v, 0, v.find_first_not_of("0123456789."));
|
||||||
if (sm.size() == 2) {
|
|
||||||
std::ssub_match smsub = sm[1];
|
|
||||||
vMajor.push_back (smsub.str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vMajor.size() == 2) {
|
if (vMajor.size() == 2 && vMajor[0] != vMajor[1]) {
|
||||||
if (vMajor[0] != vMajor[1]) {
|
|
||||||
|
|
||||||
// Update the version parameter with the right value
|
// Update the version parameter with the right value
|
||||||
options.version = versionString;
|
options.version = versionString;
|
||||||
|
|
||||||
@@ -347,7 +337,6 @@ void RTWindow::on_realize ()
|
|||||||
splash = nullptr;
|
splash = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTWindow::on_configure_event (GdkEventConfigure* event)
|
bool RTWindow::on_configure_event (GdkEventConfigure* event)
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#include "xtransprocess.h"
|
#include "xtransprocess.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include <regex>
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
using namespace rtengine::procparams;
|
using namespace rtengine::procparams;
|
||||||
|
|
||||||
@@ -30,8 +30,30 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP
|
|||||||
method = Gtk::manage (new MyComboBoxText ());
|
method = Gtk::manage (new MyComboBoxText ());
|
||||||
|
|
||||||
for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) {
|
for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) {
|
||||||
static const std::regex what ("[() -]");
|
const std::string langKey =
|
||||||
const std::string langKey = std::regex_replace (procparams::RAWParams::XTransSensor::methodstring[i], what, "");
|
[i]() -> std::string
|
||||||
|
{
|
||||||
|
const std::string str(procparams::RAWParams::XTransSensor::methodstring[i]);
|
||||||
|
|
||||||
|
std::string res;
|
||||||
|
for (const auto& c : str) {
|
||||||
|
switch (c) {
|
||||||
|
case '(':
|
||||||
|
case ')':
|
||||||
|
case ' ':
|
||||||
|
case '-': {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
res += c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}();
|
||||||
method->append(M("TP_RAW_" + Glib::ustring(langKey).uppercase()));
|
method->append(M("TP_RAW_" + Glib::ustring(langKey).uppercase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user