[LyX/master] Add default TransformID enum value
Yuriy Skalko
yuriy.skalko at gmail.com
Wed Nov 25 18:30:51 UTC 2020
>
> Now I get this warning (with gcc 5.4, if it matters):
>
> ../../master/src/insets/ExternalSupport.cpp: In function ‘const string lyx::external::{anonymous}::substituteIt(const string&, lyx::external::TransformID, const string&, const lyx::external::Template::Format&, const lyx::InsetExternalParams&) [with TransformType = lyx::external::TransformOption; std::__cxx11::string = std::__cxx11::basic_string<char>]’: ../../master/src/insets/ExternalSupport.cpp:470:9: warning: enumeration value ‘None’ not handled in switch [-Wswitch]
>
> switch (id) {
> ^
>
> JMarc
>
Fixed this and several other issues. Patches attached.
Yuriy
-------------- next part --------------
From 507c03e031e6b4953c271b96ce8d038d12189485 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Wed, 25 Nov 2020 00:00:28 +0200
Subject: [PATCH 1/4] Update CMake for minimum GCC version: 4.9
---
CMakeLists.txt | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0e6a6482f..796ea9afff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,9 +77,9 @@ if(NOT help AND NOT HELP)
# 'project' triggers the searching for a compiler
project(${LYX_PROJECT})
if (CMAKE_COMPILER_IS_GNUCXX)
- if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
message(STATUS "Gnu CXX compiler version = ${CMAKE_CXX_COMPILER_VERSION}")
- message(STATUS "is too old, should be >= 4.0")
+ message(STATUS "is too old, should be >= 4.9")
message(FATAL_ERROR "Exiting")
endif()
endif()
@@ -396,9 +396,8 @@ if(UNIX OR MINGW)
#message(STATUS "dumpversion: error = ${_error}, result = ${_err}")
endif()
message(STATUS "Using GCC version ${GCC_VERSION}")
- if(GCC_VERSION VERSION_LESS 4.6)
- message(FATAL_ERROR "gcc >= 4.6 is required.")
- elseif(GCC_VERSION VERSION_LESS 4.9)
+ if(GCC_VERSION VERSION_LESS 4.9)
+ message(FATAL_ERROR "gcc >= 4.9 is required.")
# <regex> in gcc is unusable in versions less than 4.9.0
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
set(LYX_USE_STD_REGEX 0)
--
2.28.0.windows.1
-------------- next part --------------
From 045a002ecc3a6fc93ac01327af70c650bd1b1da9 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Wed, 25 Nov 2020 02:12:04 +0200
Subject: [PATCH 2/4] Better PNG detection in guessFormatFromContents
---
src/Format.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/Format.cpp b/src/Format.cpp
index 6a3d49ca53..62c09d0fa4 100644
--- a/src/Format.cpp
+++ b/src/Format.cpp
@@ -255,8 +255,12 @@ string guessFormatFromContents(FileName const & fn)
} else if (stamp == "\377\330") {
format = "jpg";
+ } else if (prefixIs(str, "\x89PNG")) {
+ format = "png";
+
} else if (stamp == "\001\332") {
format = "sgi";
+
} else if (prefixIs(str, binEPSStamp)) {
format = "eps";
@@ -319,9 +323,6 @@ string guessFormatFromContents(FileName const & fn)
else if (contains(str, " EMF"))
format = "emf";
- else if (contains(str, "PNG"))
- format = "png";
-
else if (contains(str, "%!PS-Adobe")) {
// eps or ps
ifs >> str;
--
2.28.0.windows.1
-------------- next part --------------
From 364b31a93a09f6e990ee18d6ff4308443dcb4b67 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Wed, 25 Nov 2020 20:24:36 +0200
Subject: [PATCH 3/4] Fix loop variable, amend d8e8a93a58
---
src/frontends/qt/GuiView.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index d9e7fb2008..31c8f88dc7 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -2500,19 +2500,17 @@ static bool import(GuiView * lv, FileName const & filename,
string loader_format;
vector<string> loaders = theConverters().loaders();
if (find(loaders.begin(), loaders.end(), format) == loaders.end()) {
- vector<string>::const_iterator it = loaders.begin();
- vector<string>::const_iterator en = loaders.end();
for (string const & loader : loaders) {
if (!theConverters().isReachable(format, loader))
continue;
string const tofile =
support::changeExtension(filename.absFileName(),
- theFormats().extension(*it));
+ theFormats().extension(loader));
if (theConverters().convert(nullptr, filename, FileName(tofile),
- filename, format, *it, errorList) != Converters::SUCCESS)
+ filename, format, loader, errorList) != Converters::SUCCESS)
return false;
- loader_format = *it;
+ loader_format = loader;
break;
}
if (loader_format.empty()) {
--
2.28.0.windows.1
-------------- next part --------------
From 469fc42252470a90d0e0529d882da2c134fccf92 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Wed, 25 Nov 2020 20:27:35 +0200
Subject: [PATCH 4/4] Fix warnings regarding switches on enum values
---
src/Server.cpp | 3 +++
src/insets/ExternalSupport.cpp | 2 ++
2 files changed, 5 insertions(+)
diff --git a/src/Server.cpp b/src/Server.cpp
index dfc932c674..fe503926de 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -378,6 +378,9 @@ bool LyXComm::pipeServer()
if (!resetPipe(i, !success))
return false;
break;
+ case CONNECTING_STATE:
+ LYXERR0("Wrong pipe state");
+ break;
}
}
diff --git a/src/insets/ExternalSupport.cpp b/src/insets/ExternalSupport.cpp
index 24a228cb55..33c14d38be 100644
--- a/src/insets/ExternalSupport.cpp
+++ b/src/insets/ExternalSupport.cpp
@@ -480,6 +480,8 @@ string const substituteIt<TransformOption>(string const & input,
case Resize:
ptr = store.getOptionTransformer(params.resizedata);
break;
+ case None:
+ break;
}
if (!ptr)
--
2.28.0.windows.1
More information about the lyx-devel
mailing list