toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN/internal mbase.hh


From: Edward Rosten
Subject: [Toon-members] TooN/internal mbase.hh
Date: Wed, 26 Aug 2009 11:22:35 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/08/26 11:22:35

Modified files:
        internal       : mbase.hh 

Log message:
        Added bounds checking

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/mbase.hh?cvsroot=toon&r1=1.33&r2=1.34

Patches:
Index: mbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/mbase.hh,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- mbase.hh    24 Aug 2009 13:22:13 -0000      1.33
+++ mbase.hh    26 Aug 2009 11:22:35 -0000      1.34
@@ -132,18 +132,26 @@
        using Mem::num_rows;
 
        Precision& operator()(int r, int c){
+               Internal::check_index(num_rows(), r);
+               Internal::check_index(num_cols(), c);
                return my_data[r*rowstride() + c*colstride()];
        }
 
        const Precision& operator()(int r, int c) const {
+               Internal::check_index(num_rows(), r);
+               Internal::check_index(num_cols(), c);
                return my_data[r*rowstride() + c*colstride()];
        }
 
        Precision& operator[](const std::pair<int, int>& index) {
+               Internal::check_index(num_rows(), index.first);
+               Internal::check_index(num_cols(), index.second);
                return (*this)(index.first, index.second);
        }
 
        const Precision& operator[](const std::pair<int, int>& index) const {
+               Internal::check_index(num_rows(), index.first);
+               Internal::check_index(num_cols(), index.second);
                return (*this)(index.first, index.second);
        }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]