On Thu, Sep 27, 2012 at 3:53 PM, Scott Kostyshak <skost...@lyx.org> wrote:
> On Thu, Sep 27, 2012 at 1:51 PM, Julien Rioux
> <jri...@physics.utoronto.ca> wrote:
>> On 27/09/2012 7:17 AM, Scott Kostyshak wrote:
>>>
>>> -               ::write(pipefd, cmd.c_str(), cmd.length());
>>> +                if (::write(pipefd, cmd.c_str(), cmd.length()) < 0)
>>> +                        LYXERR0("Cannot write to pipe!");
>>
>>
>> You're space-indenting in a tab-indented file here.
>>
>
> Good catch. I thought I had git set up to detect these white space
> errors but I guess not.
>
> Attached is the updated patch.
>

Attached are the three patches for branch (they are the same as in the
last two emails but I wanted to put them all in one place).

Should they go in?

Thanks,

Scott
From 877398ce2faa5751a62639c9c20978eb3ff33c35 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Sun, 23 Sep 2012 04:58:19 -0400
Subject: [PATCH 1/3] Remove unused function find_matching_brace

find_matching_brace came over from a backport and is not being used.
---
 src/lyxfind.cpp |   21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index f2c941b..a103d76 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -562,27 +562,6 @@ string apply_escapes(string s, Escapes const & escape_map)
        return s;
 }
 
-/** Return the position of the closing brace matching the open one at s[pos],
- ** or s.size() if not found.
- **/
-static size_t find_matching_brace(string const & s, size_t pos)
-{
-       LASSERT(s[pos] == '{', /* */);
-       int open_braces = 1;
-       for (++pos; pos < s.size(); ++pos) {
-               if (s[pos] == '\\')
-                       ++pos;
-               else if (s[pos] == '{')
-                       ++open_braces;
-               else if (s[pos] == '}') {
-                       --open_braces;
-                       if (open_braces == 0)
-                               return pos;
-               }
-       }
-       return s.size();
-}
-
 /// Within \regexp{} apply get_lyx_unescapes() only (i.e., preserve regexp 
semantics of the string),
 /// while outside apply get_lyx_unescapes()+get_regexp_escapes().
 /// If match_latex is true, then apply regexp_latex_escapes() to \regexp{} 
contents as well.
-- 
1.7.9.5

From 35dcd7f6fb88a47bda9342e53d528cb521f34505 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Thu, 27 Sep 2012 06:29:27 -0400
Subject: [PATCH] Use a return value to report an unsuccessful write

Use a return value in LyXComm::loadFilesInOtherInstance to give an
error for a failed write to pipe.
---
 src/Server.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Server.cpp b/src/Server.cpp
index 7ec096e..1e673e6 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -1015,7 +1015,8 @@ bool LyXComm::loadFilesInOtherInstance()
                        break;
                string const cmd = "LYXCMD:pipe:file-open:" +
                                        fname.absFileName() + '\n';
-               ::write(pipefd, cmd.c_str(), cmd.length());
+               if (::write(pipefd, cmd.c_str(), cmd.length()) < 0)
+                       LYXERR0("Cannot write to pipe!");
                ::close(pipefd);
                ++loaded_files;
                it = theFilesToLoad().erase(it);
-- 
1.7.9.5

From b7582fc12ac0b8130ff26f7a735b12e200e5a714 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Thu, 27 Sep 2012 06:26:46 -0400
Subject: [PATCH 2/3] Get rid of unused variable to eliminate warning

The variable 'c' in Lexer::Pimpl::setFile was not being used.
---
 src/Lexer.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Lexer.cpp b/src/Lexer.cpp
index d824da0..664e1b9 100644
--- a/src/Lexer.cpp
+++ b/src/Lexer.cpp
@@ -274,9 +274,9 @@ bool Lexer::Pimpl::setFile(FileName const & filename)
 
        // Skip byte order mark.
        if (is.peek() == 0xef) {
-               int c = is.get();
+               is.get();
                if (is.peek() == 0xbb) {
-                       c = is.get();
+                       is.get();
                        LASSERT(is.get() == 0xbf, /**/);
                } else
                        is.unget();
-- 
1.7.9.5

Reply via email to