]> git.lyx.org Git - features.git/commitdiff
Do not return copies of string members
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 5 May 2023 18:35:23 +0000 (20:35 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 5 May 2023 18:35:23 +0000 (20:35 +0200)
This fixes the g++ 12 warnings below.

../../master/src/Converter.cpp:714:55: warning: possibly dangling reference to a temporary [-Wdangling-reference]
  714 |                                         Mover const & mover = getMover(conv.to());
      |                                                       ^~~~~
../../master/src/Converter.cpp:714:71: note: the temporary was destroyed at the end of the full expression ‘lyx::getMover(lyx::Converter::to() const())’
  714 |                                         Mover const & mover = getMover(conv.to());
      |                                                               ~~~~~~~~^~~~~~~~~~~
../../master/src/Converter.cpp:786:39: warning: possibly dangling reference to a temporary [-Wdangling-reference]
  786 |                         Mover const & mover = getMover(conv.from());
      |                                       ^~~~~
../../master/src/Converter.cpp:786:55: note: the temporary was destroyed at the end of the full expression ‘lyx::getMover(lyx::Converter::from() const())’
  786 |                         Mover const & mover = getMover(conv.from());

src/Converter.h

index 091dbcd394e4b8075f3d4d04af6ad279c96a3d7d..9e8249d72db125cc6b99950f6a56b94d0925e546 100644 (file)
@@ -52,15 +52,15 @@ public:
        ///
        void readFlags();
        ///
-       std::string const from() const { return from_; }
+       std::string const from() const { return from_; }
        ///
-       std::string const to() const { return to_; }
+       std::string const to() const { return to_; }
        ///
-       std::string const command() const { return command_; }
+       std::string const command() const { return command_; }
        ///
        void setCommand(std::string const & command);
        ///
-       std::string const flags() const { return flags_; }
+       std::string const flags() const { return flags_; }
        ///
        void setFlags(std::string const & flags) { flags_ = flags; }
        ///
@@ -74,7 +74,7 @@ public:
        ///
        bool latex() const { return latex_; }
        ///
-       std::string const latex_flavor() const { return latex_flavor_; }
+       std::string const latex_flavor() const { return latex_flavor_; }
        ///
        bool docbook() const { return docbook_; }
        ///
@@ -84,13 +84,13 @@ public:
        ///
        bool nice() const { return nice_; }
        ///
-       std::string const result_dir() const { return result_dir_; }
+       std::string const result_dir() const { return result_dir_; }
        ///
-       std::string const result_file() const { return result_file_; }
+       std::string const result_file() const { return result_file_; }
        ///
-       std::string const parselog() const { return parselog_; }
+       std::string const parselog() const { return parselog_; }
        ///
-       std::string const hyperref_driver() const { return href_driver_; }
+       std::string const hyperref_driver() const { return href_driver_; }
 
 private:
        ///