summaryrefslogtreecommitdiff
path: root/src/Fl_Input_.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2004-09-21 13:35:40 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2004-09-21 13:35:40 +0000
commitfdd10af508c8f8f992a1100a70222e94fb8a491f (patch)
treeb2ceed815c4e86ac1c84d568541c996bd67ce395 /src/Fl_Input_.cxx
parent0980e981484a5077b4f63c9fbd08e9f685ff81e1 (diff)
fl_old_shortcut() might read past the end of the shortcut string.
Add comment concerning pointer arithmetic in Fl_Input_::put(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3836 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Input_.cxx')
-rw-r--r--src/Fl_Input_.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index 79dd91b30..6f42e6e8a 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.31 2004/09/09 21:34:46 matthiaswm Exp $"
+// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.32 2004/09/21 13:35:39 easysw Exp $"
//
// Common input widget routines for the Fast Light Tool Kit (FLTK).
//
@@ -793,6 +793,15 @@ void Fl_Input_::put_in_buffer(int len) {
} else {
bufsize = len+1;
}
+ // Note: the following code is equivalent to:
+ //
+ // if (moveit) value_ = value_ - buffer;
+ // char* nbuffer = (char*)realloc(buffer, bufsize);
+ // if (moveit) value_ = value_ + nbuffer;
+ // buffer = nbuffer;
+ //
+ // We just optimized the pointer arithmetic for value_...
+ //
char* nbuffer = (char*)realloc(buffer, bufsize);
if (moveit) value_ += (nbuffer-buffer);
buffer = nbuffer;
@@ -857,5 +866,5 @@ Fl_Input_::~Fl_Input_() {
}
//
-// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.31 2004/09/09 21:34:46 matthiaswm Exp $".
+// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.32 2004/09/21 13:35:39 easysw Exp $".
//