[Pkg-electronics-commits] [gnucap] 12/49: node-count off-by-one bug fix

felix salfelder felix-guest at moszumanska.debian.org
Tue Feb 2 21:39:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch wip
in repository gnucap.

commit 7709e35e1744a51b0a8ca39d996151a96b4dcc8a
Author: al davis <al at floyd.freeelectron.net>
Date:   Fri Jul 4 14:48:36 2014 -0400

    node-count off-by-one bug fix
---
 lib/e_compon.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/e_compon.cc b/lib/e_compon.cc
index ca81a41..451c978 100644
--- a/lib/e_compon.cc
+++ b/lib/e_compon.cc
@@ -1,4 +1,4 @@
-/*$Id: e_compon.cc,v 26.137 2010/04/10 02:37:33 al Exp $ -*- C++ -*-
+/*$Id: e_compon.cc 2014/07/04 al $ -*- C++ -*-
  * Copyright (C) 2001 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
@@ -441,29 +441,29 @@ void COMPONENT::set_port_by_name(std::string& int_name, std::string& ext_name)
 /*--------------------------------------------------------------------------*/
 void COMPONENT::set_port_by_index(int num, std::string& ext_name)
 {
-  if (num <= max_nodes()) {
+  if (num < max_nodes()) {
     _n[num].new_node(ext_name, this);
     if (num+1 > _net_nodes) {
       // make the list bigger
       _net_nodes = num+1;
-    }else{itested();
+    }else{untested();
       // it's already big enough, probably assigning out of order
     }
   }else{untested();
-    throw Exception_Too_Many(num, max_nodes(), 0/*offset*/);
+    throw Exception_Too_Many(num+1, max_nodes(), 0/*offset*/);
   }
 }
 /*--------------------------------------------------------------------------*/
 void COMPONENT::set_port_to_ground(int num)
 {untested();
-  if (num <= max_nodes()) {untested();
+  if (num < max_nodes()) {untested();
     _n[num].set_to_ground(this);
     if (num+1 > _net_nodes) {untested();
       _net_nodes = num+1;
     }else{untested();
     }
   }else{untested();
-    throw Exception_Too_Many(num, max_nodes(), 0/*offset*/);
+    throw Exception_Too_Many(num+1, max_nodes(), 0/*offset*/);
   }
 }
 /*--------------------------------------------------------------------------*/

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git



More information about the Pkg-electronics-commits mailing list