[nemiver] Fix error when showing mixed asm/source



commit 75e5b5fb99e7f1586e1a195537709a32140f4d1a
Author: Dodji Seketeli <dodji redhat com>
Date:   Thu Jul 22 15:03:32 2010 +0200

    Fix error when showing mixed asm/source
    
    	* src/uicommon/nmv-source-editor.cc
    	(SourceEditor::Priv::address_2_line): Do not return returns the
    	previous address. This is useless and can lead to issues with
    	mixed source/assembly, where the previous line can be a source
    	one.
    	(SourceEditor::assembly_buf_addr_to_line_previous): Remove this
    	useless function definition.
    	* src/uicommon/nmv-source-editor.h
    	(SourceEditor::assembly_buf_addr_to_line_previous): Remove fn declaration.

 src/uicommon/nmv-source-editor.cc |   43 ++----------------------------------
 src/uicommon/nmv-source-editor.h  |    4 ---
 2 files changed, 3 insertions(+), 44 deletions(-)
---
diff --git a/src/uicommon/nmv-source-editor.cc b/src/uicommon/nmv-source-editor.cc
index 8d712eb..9532532 100644
--- a/src/uicommon/nmv-source-editor.cc
+++ b/src/uicommon/nmv-source-editor.cc
@@ -317,29 +317,18 @@ struct SourceEditor::Priv {
 
     bool
     address_2_line (Glib::RefPtr<SourceBuffer> a_buf,
-                    const Address an_addr,
-                    int &a_line) const
-    {
-        Address prev_address;
-        return address_2_line (a_buf, an_addr, a_line, prev_address);
-    }
-
-    bool
-    address_2_line (Glib::RefPtr<SourceBuffer> a_buf,
-                    const Address an_addr,
-                    int &a_line,
-                    Address &a_prev_addr) const
+		    const Address an_addr,
+		    int &a_line) const
     {
         if (!a_buf)
             return false;
 
         Gtk::TextBuffer::iterator it = a_buf->begin ();
         size_t  i;
-        std::string addr, prev_addr;
+        std::string addr;
         while (!it.is_end ()) {
             // We must always be at the beginning of a line here.
             THROW_IF_FAIL (it.starts_line ());
-            prev_addr = addr;
             addr.clear ();
             for (i = 0;
                  !isspace (it.get_char ()) && it.ends_line () != true
@@ -350,7 +339,6 @@ struct SourceEditor::Priv {
             bool match = (addr == an_addr.to_string ());
             if (match) {
                 a_line = it.get_line () + 1;
-                a_prev_addr = prev_addr;
                 return true;
             } else {
                 // Go to next line.
@@ -1183,31 +1171,6 @@ SourceEditor::assembly_buf_addr_to_line (const Address &a_addr, int &a_line) con
 }
 
 bool
-SourceEditor::assembly_buf_addr_to_line_previous (const Address &a_addr,
-                                                  int &a_prev_line) const
-{
-    Address prev_addr;
-    return assembly_buf_addr_to_line_previous (a_addr, a_prev_line, prev_addr);
-}
-
-bool
-SourceEditor::assembly_buf_addr_to_line_previous (const Address &a_addr,
-                                                  int &a_prev_line,
-                                                  Address &a_prev_address) const
-{
-    Glib::RefPtr<SourceBuffer> buf = get_assembly_source_buffer ();
-    int line = 0;
-    bool ok = m_priv->address_2_line (buf, a_addr,
-                                      line,
-                                      a_prev_address);
-    if (ok) {
-        THROW_IF_FAIL (line > 0);
-        a_prev_line = line - 1;
-    }
-    return ok;
-}
-
-bool
 SourceEditor::assembly_buf_line_to_addr (int a_line, Address &a_address) const
 {
     Glib::RefPtr<SourceBuffer> buf = get_assembly_source_buffer ();
diff --git a/src/uicommon/nmv-source-editor.h b/src/uicommon/nmv-source-editor.h
index 371b3c2..5349bcb 100644
--- a/src/uicommon/nmv-source-editor.h
+++ b/src/uicommon/nmv-source-editor.h
@@ -137,10 +137,6 @@ public:
     bool switch_to_non_assembly_source_buffer ();
 
     bool assembly_buf_addr_to_line (const Address&, int&) const;
-    bool assembly_buf_addr_to_line_previous (const Address&, int&) const;
-    bool assembly_buf_addr_to_line_previous (const Address&,
-                                             int&,
-                                             Address&) const;
     bool assembly_buf_line_to_addr (int, Address &) const;
     bool get_assembly_address_range (common::Range &a) const;
     bool move_where_marker_to_address (const Address &address,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]