summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--src/Fl_GIF_Image.cxx12
-rw-r--r--src/Fl_Text_Buffer.cxx22
-rw-r--r--src/Fl_Text_Display.cxx12
-rw-r--r--src/fl_line_style.cxx7
5 files changed, 30 insertions, 27 deletions
diff --git a/CHANGES b/CHANGES
index 3e97a51f2..bd3bee2f7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
CHANGES IN FLTK 1.1.3
- Documentation updates.
+ - Changed some error messages to use Fl::error() instead
+ of fprintf()...
+ - Fl_Text_Buffer and Fl_Text_Display used free to free
+ memory that was allocated using the new operator.
- Tweeked the plastic scheme under MacOSX to better
match the colors.
- The Fl_Image.H always included the x.H header file,
diff --git a/src/Fl_GIF_Image.cxx b/src/Fl_GIF_Image.cxx
index 634aa2772..e139db57a 100644
--- a/src/Fl_GIF_Image.cxx
+++ b/src/Fl_GIF_Image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_GIF_Image.cxx,v 1.1.2.13 2002/11/19 16:37:34 easysw Exp $"
+// "$Id: Fl_GIF_Image.cxx,v 1.1.2.14 2003/01/12 14:49:32 easysw Exp $"
//
// Fl_GIF_Image routines.
//
@@ -81,7 +81,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
char **new_data; // Data array
if ((GifFile = fopen(infname, "rb")) == NULL) {
- Fl::error("Unable to open %s!", infname);
+ Fl::error("Fl_GIF_Image: Unable to open %s!", infname);
return;
}
@@ -92,7 +92,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
}
if (b[0]!='G' || b[1]!='I' || b[2] != 'F') {
fclose(GifFile);
- Fl::error("%s is not a GIF file.\n", infname);
+ Fl::error("Fl_GIF_Image: %s is not a GIF file.\n", infname);
return;
}
if (b[3]!='8' || b[4]>'9' || b[5]!= 'a')
@@ -135,7 +135,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
int i = NEXTBYTE;
if (i<0) {
fclose(GifFile);
- Fl::error("%s: unexpected EOF",infname);
+ Fl::error("Fl_GIF_Image: %s - unexpected EOF",infname);
return;
}
int blocklen;
@@ -257,7 +257,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
int i;
if (CurCode < FreeCode) i = CurCode;
else if (CurCode == FreeCode) {*tp++ = (uchar)FinChar; i = OldCode;}
- else {fprintf(stderr,"%s : LZW Barf!\n",infname); break;}
+ else {Fl::error("Fl_GIF_Image: %s - LZW Barf!", infname); break;}
while (i >= ColorMapSize) {*tp++ = Suffix[i]; i = Prefix[i];}
*tp++ = FinChar = i;
@@ -373,5 +373,5 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
//
-// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.13 2002/11/19 16:37:34 easysw Exp $".
+// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.14 2003/01/12 14:49:32 easysw Exp $".
//
diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx
index ffc30beba..e672ebf77 100644
--- a/src/Fl_Text_Buffer.cxx
+++ b/src/Fl_Text_Buffer.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.15 2002/11/12 22:48:36 matthiaswm Exp $"
+// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.16 2003/01/12 14:49:33 easysw Exp $"
//
// Copyright 2001-2002 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
@@ -130,12 +130,12 @@ Fl_Text_Buffer::Fl_Text_Buffer( int requestedSize ) {
Fl_Text_Buffer::~Fl_Text_Buffer() {
free( mBuf );
if ( mNModifyProcs != 0 ) {
- free( ( void * ) mNodifyProcs );
- free( ( void * ) mCbArgs );
+ delete[] mNodifyProcs;
+ delete[] mCbArgs;
}
if ( mNPredeleteProcs != 0 ) {
- free( ( void * ) mPredeleteProcs );
- free( ( void * ) mPredeleteCbArgs );
+ delete[] mPredeleteProcs;
+ delete[] mPredeleteCbArgs;
}
}
@@ -400,7 +400,7 @@ void Fl_Text_Buffer::insert_column( int column, int startPos, const char *s,
insert_column_( column, lineStartPos, s, &insertDeleted, &nInserted,
&mCursorPosHint );
if ( nDeleted != insertDeleted )
- fprintf( stderr, "internal consistency check ins1 failed" );
+ Fl::error("Fl_Text_Buffer::insert_column(): internal consistency check ins1 failed");
call_modify_callbacks( lineStartPos, nDeleted, nInserted, 0, deletedText );
free( (void *) deletedText );
if ( charsInserted != NULL )
@@ -429,7 +429,7 @@ void Fl_Text_Buffer::overlay_rectangular( int startPos, int rectStart,
overlay_rectangular_( lineStartPos, rectStart, rectEnd, s, &insertDeleted,
&nInserted, &mCursorPosHint );
if ( nDeleted != insertDeleted )
- fprintf( stderr, "internal consistency check ovly1 failed" );
+ Fl::error("Fl_Text_Buffer::overlay_rectangle(): internal consistency check ovly1 failed");
call_modify_callbacks( lineStartPos, nDeleted, nInserted, 0, deletedText );
free( (void *) deletedText );
if ( charsInserted != NULL )
@@ -491,7 +491,7 @@ void Fl_Text_Buffer::replace_rectangular( int start, int end, int rectStart,
/* Figure out how many chars were inserted and call modify callbacks */
if ( insertDeleted != deleteInserted + linesPadded )
- fprintf( stderr, "NEdit: internal consistency check repl1 failed\n" );
+ Fl::error("Fl_Text_Buffer::replace_rectangular(): internal consistency check repl1 failed");
call_modify_callbacks( start, end - start, insertInserted, 0, deletedText );
free( (void *) deletedText );
if ( nInsertedLines < nDeletedLines )
@@ -749,7 +749,7 @@ void Fl_Text_Buffer::remove_modify_callback( Fl_Text_Modify_Cb bufModifiedCB,
}
}
if ( toRemove == -1 ) {
- fprintf( stderr, "Internal Error: Can't find modify CB to remove\n" );
+ Fl::error("Fl_Text_Buffer::remove_modify_callback(): Can't find modify CB to remove");
return;
}
@@ -823,7 +823,7 @@ void Fl_Text_Buffer::remove_predelete_callback(
}
}
if (toRemove == -1) {
- fprintf(stderr, "Internal Error: Can't find pre-delete CB to remove\n");
+ Fl::error("Fl_Text_Buffer::remove_predelete_callback(): Can't find pre-delete CB to remove");
return;
}
@@ -2509,5 +2509,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {
//
-// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.15 2002/11/12 22:48:36 matthiaswm Exp $".
+// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.16 2003/01/12 14:49:33 easysw Exp $".
//
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index e95cc391b..dafebfa05 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Text_Display.cxx,v 1.12.2.40 2002/12/26 01:15:32 matthiaswm Exp $"
+// "$Id: Fl_Text_Display.cxx,v 1.12.2.41 2003/01/12 14:49:33 easysw Exp $"
//
// Copyright 2001-2002 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
@@ -1359,7 +1359,7 @@ int Fl_Text_Display::position_to_line( int pos, int *lineNum ) {
if ( empty_vlines() ) {
if ( mLastChar < mBuffer->length() ) {
if ( !position_to_line( mLastChar, lineNum ) ) {
- fprintf( stderr, "Consistency check ptvl failed\n" );
+ Fl::error("Fl_Text_Display::position_to_line(): Consistency check ptvl failed");
return 0;
}
return ++( *lineNum ) <= mNVisibleLines - 1;
@@ -1428,8 +1428,8 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
prevent a potential infinite loop if X does not advance */
stdCharWidth = TMPFONTWIDTH; //mFontStruct->max_bounds.width;
if ( stdCharWidth <= 0 ) {
- fprintf( stderr, "Internal Error, bad font measurement\n" );
- delete [] (char *)lineStr;
+ Fl::error("Fl_Text_Display::draw_vline(): bad font measurement");
+ free((void *)lineStr);
return;
}
@@ -1537,7 +1537,7 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
}
*/
if ( lineStr != NULL )
- delete [] (char *)lineStr;
+ free((void *)lineStr);
}
/*
@@ -3038,5 +3038,5 @@ int Fl_Text_Display::handle(int event) {
//
-// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.40 2002/12/26 01:15:32 matthiaswm Exp $".
+// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.41 2003/01/12 14:49:33 easysw Exp $".
//
diff --git a/src/fl_line_style.cxx b/src/fl_line_style.cxx
index 314986db1..135bfe625 100644
--- a/src/fl_line_style.cxx
+++ b/src/fl_line_style.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_line_style.cxx,v 1.3.2.3.2.10 2002/04/11 11:52:42 easysw Exp $"
+// "$Id: fl_line_style.cxx,v 1.3.2.3.2.11 2003/01/12 14:49:33 easysw Exp $"
//
// Line style code for the Fast Light Tool Kit (FLTK).
//
@@ -47,8 +47,7 @@ void fl_line_style(int style, int width, char* dashes) {
LOGBRUSH penbrush = {BS_SOLID,fl_RGB(),0}; // can this be fl_brush()?
HPEN newpen = ExtCreatePen(s1, width, &penbrush, n, n ? a : 0);
if (!newpen) {
- // CET - FIXME - remove this debug fprintf()?
- fprintf(stderr, "fl_line_style(): Could not create GDI pen object.\n");
+ Fl::error("fl_line_style(): Could not create GDI pen object.");
return;
}
HPEN oldpen = (HPEN)SelectObject(fl_gc, newpen);
@@ -104,5 +103,5 @@ void fl_line_style(int style, int width, char* dashes) {
//
-// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.10 2002/04/11 11:52:42 easysw Exp $".
+// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.11 2003/01/12 14:49:33 easysw Exp $".
//