Author: bgbnbigben
Date: 2011-05-28 04:26:33 -0700 (Sat, 28 May 2011)
New Revision: 8750
Log:
Fixed all the warnings thrown by GCC on builds so that 2.0 now has a noiseless
compile under this compiler.
Note that the change in src/lock.cxx regarding recursive_attr may not be quite
kosher, but it's the only standard-defined behaviour. Here's to hoping the
pthreads API never ever ever changes.
Modified:
trunk/fluid/Fluid_Image.cxx
trunk/fluid/coding_style_func.cxx
trunk/images/pnmImage.cxx
trunk/images/xpmFileImage.cxx
trunk/src/HelpView.cxx
trunk/src/Preferences.cxx
trunk/src/SharedImage.cxx
trunk/src/TextBuffer.cxx
trunk/src/lock.cxx
trunk/test/demo.cxx
Modified: trunk/fluid/Fluid_Image.cxx
===================================================================
--- trunk/fluid/Fluid_Image.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/fluid/Fluid_Image.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -105,7 +105,7 @@
indentation += 2;
char s[MAX_CLINESIZE+1];
do {
- fgets(s, MAX_CLINESIZE+1, fp);
+ if(fgets(s, MAX_CLINESIZE+1, fp)); //ignore the return value
} while (!feof(fp) && !strchr(s, '{'));
while (!feof(fp) && fgets(s, MAX_CLINESIZE+1, fp)) {
write_c(indent());
@@ -293,7 +293,7 @@
// now see if we can identify the type, by reading in some data
// and asking all the types we know about:
char buffer[1025];
- fread(buffer, 1, 1024, f);
+ if(fread(buffer, 1, 1024, f)); // Ignore the return value
rewind(f);
buffer[1024] = 0; // null-terminate so strstr() works
if (generic_image::test_file(buffer)) {
Modified: trunk/fluid/coding_style_func.cxx
===================================================================
--- trunk/fluid/coding_style_func.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/fluid/coding_style_func.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -57,7 +57,7 @@
if(fp){
char buffer[256];
while(!feof(fp)){
- fgets(buffer, sizeof(buffer), fp);
+ if(fgets(buffer, sizeof(buffer), fp)); //ignore the return result
char *p = strtok(buffer, "=");
for(int i=0; options[i].name; i++)
if(strcasecmp(options[i].name, buffer) == 0)
Modified: trunk/images/pnmImage.cxx
===================================================================
--- trunk/images/pnmImage.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/images/pnmImage.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -160,7 +160,7 @@
case 5 :
case 6 :
if (maxval < 256) {
- fread(ptr, w, depth(), fp);
+ if(fread(ptr, w, depth(), fp)); //ignore the unused result
} else {
val = (uchar)getc(fp);
val = (val<<8)|(uchar)getc(fp);
Modified: trunk/images/xpmFileImage.cxx
===================================================================
--- trunk/images/xpmFileImage.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/images/xpmFileImage.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -66,7 +66,7 @@
while (*q != '\"' && p < buffer+MAXSIZE) {
if (*q == '\\') switch (*++q) {
case '\n':
- fgets(q,(buffer+MAXSIZE+20)-q,f); break;
+ if(fgets(q,(buffer+MAXSIZE+20)-q,f)) /*Ignore the unused result*/;
break;
case 0:
break;
case 'x': {
Modified: trunk/src/HelpView.cxx
===================================================================
--- trunk/src/HelpView.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/src/HelpView.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -2334,7 +2334,7 @@
} else if (name[0] != '/' && strchr(name, ':') == NULL) {
if (directory_[0]) snprintf(temp, sizeof(temp), "%s/%s", directory_, name);
else {
- getcwd(dir, sizeof(dir));
+ if(getcwd(dir, sizeof(dir))); //ignore the return value
snprintf(temp, sizeof(temp), "file:%s/%s", dir, name);
}
@@ -2458,7 +2458,7 @@
snprintf(temp, sizeof(temp), "%s/%s", directory_, linkp->filename);
else
{
- getcwd(dir, sizeof(dir));
+ if(getcwd(dir, sizeof(dir))); //ignore the return value
snprintf(temp, sizeof(temp), "file:%s/%s", dir, linkp->filename);
}
}
@@ -2675,7 +2675,7 @@
rewind(fp);
value_ = (const char *)calloc(len + 1, 1);
- fread((void *)value_, 1, len, fp);
+ if(fread((void *)value_, 1, len, fp)); //ignore the return value
fclose(fp);
}
else
Modified: trunk/src/Preferences.cxx
===================================================================
--- trunk/src/Preferences.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/src/Preferences.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -774,9 +774,9 @@
char buf[1024];
FILE *f = fopen( filename_, "rb" );
if ( !f ) return 0;
- fgets( buf, 1024, f );
- fgets( buf, 1024, f );
- fgets( buf, 1024, f );
+ if(fgets( buf, 1024, f ));
+ if(fgets( buf, 1024, f ));
+ if(fgets( buf, 1024, f )); //ignore these return values from fgets()
Node *nd = prefs_->node;
for (;;)
{
Modified: trunk/src/SharedImage.cxx
===================================================================
--- trunk/src/SharedImage.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/src/SharedImage.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -175,7 +175,7 @@
if (n && (*n) && (fp = fopen(n, "rb")) != NULL) {
- fread(header, 1, sizeof(header), fp);
+ if(fread(header, 1, sizeof(header), fp)); // ignore the return value
fclose(fp);
} else {
return NULL;
Modified: trunk/src/TextBuffer.cxx
===================================================================
--- trunk/src/TextBuffer.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/src/TextBuffer.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -355,7 +355,7 @@
* from the undo buffer.
*/
int TextBuffer::undo(int *cursorPos) {
- if (undowidget != this || !undocut && !undoinsert &&!mCanUndo) return 0;
+ if (undowidget != this || (!undocut && !undoinsert &&!mCanUndo)) return 0;
int ilen = undocut;
int xlen = undoinsert;
@@ -1799,7 +1799,7 @@
}
char *TextBuffer::selection_text_(TextSelection *sel) {
- int start, end, isRect, rectstart, rectend;
+ int start, end, isRect, rectstart = 0, rectend = 0;
char *s;
/* If there's no selection, return an allocated empty string */
@@ -1817,8 +1817,7 @@
}
void TextBuffer::remove_selection_(TextSelection *sel) {
- int start, end;
- int isRect, rectstart, rectend;
+ int start, end, isRect, rectstart = 0, rectend = 0;
if (!sel->position(&start, &end, &isRect, &rectstart, &rectend))
return;
@@ -1831,7 +1830,7 @@
}
void TextBuffer::replace_selection_(TextSelection *sel, const char *s) {
- int start, end, isRect, rectstart, rectend;
+ int start, end, isRect, rectstart = 0, rectend = 0;
TextSelection old_selection = *sel;
/* If there's no selection, return */
Modified: trunk/src/lock.cxx
===================================================================
--- trunk/src/lock.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/src/lock.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -157,7 +157,7 @@
# include <fltk/Threads.h>
# if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) && !defined(__CYGWIN__)
-static pthread_mutexattr_t recursive_attrib={PTHREAD_MUTEX_RECURSIVE_NP};
+static pthread_mutexattr_t recursive_attrib = {{PTHREAD_MUTEX_RECURSIVE_NP}};
fltk::RecursiveMutex::RecursiveMutex() : Mutex(&recursive_attrib) {}
# elif defined(PTHREAD_MUTEX_RECURSIVE)
static pthread_mutexattr_t* recursive_attrib() {
@@ -211,7 +211,7 @@
static void init_function() {
// Init threads communication pipe to let threads awake FLTK from wait
main_thread_id = pthread_self();
- pipe(thread_filedes);
+ if(pipe(thread_filedes)); //ignore the return value
fcntl(thread_filedes[0], F_SETFL, O_NONBLOCK);
fltk::add_fd(thread_filedes[0], fltk::READ, thread_awake_cb);
fl_lock_function = init_or_lock_function = lock_function;
@@ -228,7 +228,7 @@
}
void fltk::awake(void* msg) {
- write(thread_filedes[1], &msg, sizeof(void*));
+ if(write(thread_filedes[1], &msg, sizeof(void*))); //ignore the return value
}
// the following is already defined in CYGWIN
Modified: trunk/test/demo.cxx
===================================================================
--- trunk/test/demo.cxx 2011-05-28 05:05:08 UTC (rev 8749)
+++ trunk/test/demo.cxx 2011-05-28 11:26:33 UTC (rev 8750)
@@ -267,7 +267,7 @@
char* command = new char[icommand_length+5]; // 5 for extra './' and '
&\0'
sprintf(command, "./%s &", menus[men].icommand[bn]);
- system(command);
+ if(system(command)); // Kill the warn_unused_result error
delete command;
#endif // _WIN32
@@ -337,7 +337,7 @@
if (!load_the_menu(fname)) fltk::fatal("Can't open %s",fname);
strcpy(buf,fname);
const char *c = fltk::filename_name(buf);
- if (c > buf) {buf[c-buf] = 0; chdir(buf);}
+ if (c > buf) {buf[c-buf] = 0; if(chdir(buf)){/*Kill the warn_unused_result
error*/};}
push_menu("@main");
form->show(argc,argv);
fltk::run();
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit