Skip to content

Commit

Permalink
Use memmove() instead of memcpy() in several key places.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2672 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Oct 11, 2002
1 parent fddb73a commit be58513
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGES
@@ -1,5 +1,8 @@
CHANGES IN FLTK 1.1.1

- Replaced several memcpy's with memmove's for
portability (memmove allows for overlapping copies,
memcpy does not)
- Bug #621737: Fl_Bitmap::copy(), Fl_Pixmap::copy(), and
Fl_RGB_Image::copy() now range-check the new width and
height to make sure they are positive integers.
Expand Down
2 changes: 1 addition & 1 deletion FL/Fl_Help_Dialog.H
@@ -1,4 +1,4 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0100
// generated by Fast Light User Interface Designer (fluid) version 1.0101

#ifndef Fl_Help_Dialog_H
#define Fl_Help_Dialog_H
Expand Down
8 changes: 4 additions & 4 deletions FL/Fl_Image.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Image.H,v 1.5.2.3.2.15 2002/08/14 16:19:48 easysw Exp $"
// "$Id: Fl_Image.H,v 1.5.2.3.2.16 2002/10/11 14:17:20 easysw Exp $"
//
// Image header file for the Fast Light Tool Kit (FLTK).
//
Expand All @@ -24,7 +24,7 @@
//

#ifndef Fl_Image_H
#define Fl_Image_H
# define Fl_Image_H

# include "x.H"

Expand Down Expand Up @@ -97,8 +97,8 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
virtual void uncache();
};

#endif
#endif // !Fl_Image_H

//
// End of "$Id: Fl_Image.H,v 1.5.2.3.2.15 2002/08/14 16:19:48 easysw Exp $".
// End of "$Id: Fl_Image.H,v 1.5.2.3.2.16 2002/10/11 14:17:20 easysw Exp $".
//
6 changes: 3 additions & 3 deletions src/Fl_Chart.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.10 2002/09/04 20:33:18 easysw Exp $"
// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.11 2002/10/11 14:17:21 easysw Exp $"
//
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -315,7 +315,7 @@ void Fl_Chart::add(double val, const char *str, unsigned col) {
}
// Shift entries as needed
if (numb >= maxnumb && maxnumb > 0) {
memcpy(entries, entries + 1, sizeof(FL_CHART_ENTRY) * (numb - 1));
memmove(entries, entries + 1, sizeof(FL_CHART_ENTRY) * (numb - 1));
numb --;
}
entries[numb].val = float(val);
Expand Down Expand Up @@ -384,5 +384,5 @@ void Fl_Chart::maxsize(int m) {
}

//
// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.10 2002/09/04 20:33:18 easysw Exp $".
// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.11 2002/10/11 14:17:21 easysw Exp $".
//
6 changes: 3 additions & 3 deletions src/Fl_Help_Dialog.cxx
@@ -1,4 +1,4 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0100
// generated by Fast Light User Interface Designer (fluid) version 1.0101

#include "../FL/Fl_Help_Dialog.H"
#include "flstring.h"
Expand All @@ -11,8 +11,8 @@ inline void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) {

if (index_ >= 100)
{
memcpy(line_, line_ + 10, sizeof(line_[0]) * 90);
memcpy(file_, file_ + 10, sizeof(file_[0]) * 90);
memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
index_ -= 10;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Fl_Help_Dialog.fl
Expand Up @@ -25,8 +25,8 @@ class Fl_Help_Dialog {open

if (index_ >= 100)
{
memcpy(line_, line_ + 10, sizeof(line_[0]) * 90);
memcpy(file_, file_ + 10, sizeof(file_[0]) * 90);
memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
index_ -= 10;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Fl_Shared_Image.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Shared_Image.cxx,v 1.23.2.16 2002/08/09 01:09:49 easysw Exp $"
// "$Id: Fl_Shared_Image.cxx,v 1.23.2.17 2002/10/11 14:17:24 easysw Exp $"
//
// Shared image code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -189,7 +189,7 @@ Fl_Shared_Image::release() {
num_images_ --;

if (i < num_images_) {
memcpy(images_ + i, images_ + i + 1,
memmove(images_ + i, images_ + i + 1,
(num_images_ - i) * sizeof(Fl_Shared_Image *));
}

Expand Down Expand Up @@ -448,12 +448,12 @@ Fl_Shared_Image::remove_handler(Fl_Shared_Handler f) {

if (i < num_handlers_) {
// Shift later handlers down 1...
memcpy(handlers_ + i, handlers_ + i + 1,
memmove(handlers_ + i, handlers_ + i + 1,
(num_handlers_ - i) * sizeof(Fl_Shared_Handler ));
}
}


//
// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.16 2002/08/09 01:09:49 easysw Exp $".
// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.17 2002/10/11 14:17:24 easysw Exp $".
//

0 comments on commit be58513

Please sign in to comment.