]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathExtern.cpp
Revert "Fix a number of signedness warnings"
[lyx.git] / src / mathed / MathExtern.cpp
index 24f2672b8cd537f981e087de938540d7fd8d25e9..4d53b28245679d47f90fbad8591f7395c9339601 100644 (file)
@@ -75,7 +75,7 @@ static char const * function_names[] = {
        "det", "dim", "exp", "gcd", "hom", "inf", "ker",
        "lg", "lim", "liminf", "limsup", "ln", "log",
        "max", "min", "sec", "sin", "sinh", "sup",
-       "tan", "tanh", "Pr", 0
+       "tan", "tanh", "Pr", nullptr
 };
 
 static size_t const npos = lyx::docstring::npos;
@@ -342,7 +342,7 @@ void replaceNested(
 
 
 //
-// split scripts into seperate super- and subscript insets. sub goes in
+// split scripts into separate super- and subscript insets. sub goes in
 // front of super...
 //
 
@@ -683,7 +683,7 @@ void extractIntegrals(MathData & ar, ExternalMath kind)
                if (!testIntegral(*it))
                        continue;
 
-               // core ist part from behind the scripts to the 'd'
+               // core is part from behind the scripts to the 'd'
                auto p = make_unique<InsetMathExInt>(buf, from_ascii("int"));
 
                // handle scripts if available
@@ -1026,7 +1026,7 @@ namespace {
                       << "\ninput: '" << data << "'" << endl;
                cmd_ret const ret = runCommand(command);
                cas_tmpfile.removeFile();
-               return ret.second;
+               return ret.result;
        }
 
        size_t get_matching_brace(string const & str, size_t i)
@@ -1431,7 +1431,7 @@ void writeString(docstring const & s, WriteStream & os)
                docstring cmd;
                for (char_type c : s) {
                        try {
-                               Encodings::latexMathChar(c, false, os.encoding(), cmd, space);
+                               Encodings::latexMathChar(c, true, os.encoding(), cmd, space);
                                os << cmd;
                                os.pendingSpace(space);
                        } catch (EncodingException const & e) {
@@ -1454,25 +1454,21 @@ void writeString(docstring const & s, WriteStream & os)
                                case WriteStream::wsDefault:
                                default:
                                        // throw again
-                                       throw(e);
+                                       throw;
                                }
                        }
                }
                return;
        }
 
-       docstring::const_iterator cit = s.begin();
-       docstring::const_iterator end = s.end();
-
        // We may already be inside an \ensuremath command.
        bool in_forced_mode = os.pendingBrace();
 
        // We will take care of matching braces.
        os.pendingBrace(false);
 
-       while (cit != end) {
+       for (char_type const c : s) {
                bool mathmode = in_forced_mode ? os.textMode() : !os.textMode();
-               char_type const c = *cit;
                docstring command(1, c);
                try {
                        bool termination = false;
@@ -1532,10 +1528,9 @@ void writeString(docstring const & s, WriteStream & os)
                        case WriteStream::wsDefault:
                        default:
                                // throw again
-                               throw(e);
+                               throw;
                        }
                }
-               ++cit;
        }
 
        if (in_forced_mode && os.textMode()) {
@@ -1591,19 +1586,19 @@ void mathematica(MathData const & dat, MathematicaStream & os)
 }
 
 
-void mathmlize(MathData const & dat, MathStream & os)
+void mathmlize(MathData const & dat, MathStream & ms)
 {
        MathData ar = dat;
        extractStructure(ar, MATHML);
        if (ar.empty())
-               os << "<mrow/>";
+               ms << "<" << from_ascii(ms.namespacedTag("mrow")) << "/>";
        else if (ar.size() == 1)
-               os << ar.front();
+               ms << ar.front();
        else {
-               os << MTag("mrow");
+               ms << MTag("mrow");
                for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
-                       (*it)->mathmlize(os);
-               os << ETag("mrow");
+                       (*it)->mathmlize(ms);
+               ms << ETag("mrow");
        }
 }