From: Carlos Maddela Date: Thu, 22 Dec 2016 11:19:20 +1100 Subject: Fix all warnings except for those related to deprecated API. Description: Fix all warnings except for those related to deprecated API. Author: Carlos Maddela Bug-Debian: https://bugs.debian.org/748416 Forwarded: no Last-Update: 2017-01-05 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- closure.c | 8 +++++--- curve.c | 2 +- menubar.c | 2 +- rs01-create.c | 10 +++++----- rs01-verify.c | 2 +- rs03-create.c | 24 ++++++++++++------------ rs03-fix.c | 8 ++++---- scsi-layer.c | 4 ++++ smart-lec.c | 10 +++++----- 9 files changed, 38 insertions(+), 32 deletions(-) diff --git a/closure.c b/closure.c index 51e91a2..40bb225 100644 --- a/closure.c +++ b/closure.c @@ -196,7 +196,7 @@ void ReadDotfile() /* Get first MAX_LINE_LEN bytes of line, discard the rest */ line[MAX_LINE_LEN-1] = 1; - fgets(line, MAX_LINE_LEN, dotfile); + if(!fgets(line, MAX_LINE_LEN, dotfile)) break; if(!line[MAX_LINE_LEN-1]) /* line longer than buffer */ while(!feof(dotfile) && fgetc(dotfile) != '\n') ; @@ -225,12 +225,14 @@ void ReadDotfile() if(!strcmp(symbol, "last-image")) { g_free(Closure->imageName); if(!strcmp(value, "none")) Closure->imageName = g_strdup(""); - else Closure->imageName = g_strdup(value); continue; + else Closure->imageName = g_strdup(value); + continue; } if(!strcmp(symbol, "last-ecc")) { g_free(Closure->eccName); if(!strcmp(value, "none")) Closure->eccName = g_strdup(""); - else Closure->eccName = g_strdup(value); continue; + else Closure->eccName = g_strdup(value); + continue; } if(!strcmp(symbol, "adaptive-read")) { Closure->adaptiveRead = atoi(value); continue; } if(!strcmp(symbol, "auto-suffix")) { Closure->autoSuffix = atoi(value); continue; } diff --git a/curve.c b/curve.c index 668bc40..61b81a9 100644 --- a/curve.c +++ b/curve.c @@ -123,7 +123,7 @@ int CurveLogY(Curve *curve, gdouble y) /* not really a log */ hfact = (gdouble)(curve->bottomLY - curve->topLY); if(y==1) return curve->bottomLY - ((log(2)/log(curve->logMaxY)) * hfact)/2; - return curve->bottomLY - (log(y)/log(curve->logMaxY)) * hfact; + return curve->bottomLY - (log(y)/log(curve->logMaxY)) * hfact; } /*** diff --git a/menubar.c b/menubar.c index 8258cfd..12f1933 100644 --- a/menubar.c +++ b/menubar.c @@ -414,7 +414,7 @@ void set_path(GtkWidget *entry, char *path) else { char buf[PATH_MAX + strlen(path) + 2]; - getcwd(buf, PATH_MAX); + if(!getcwd(buf, PATH_MAX)) return; strcat(buf,"/"); strcat(buf,path); diff --git a/rs01-create.c b/rs01-create.c index 5cad591..88c352a 100644 --- a/rs01-create.c +++ b/rs01-create.c @@ -107,12 +107,12 @@ static void unlink_image(GtkWidget *label) _("\nImage file %s deleted.\n"), Closure->imageName); } else - { if(!Closure->guiMode) - PrintLog("\n"); + { if(!Closure->guiMode) + PrintLog("\n"); - ModalWarning(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, NULL, - _("Image file %s not deleted: %s\n"), - Closure->imageName, strerror(errno)); + ModalWarning(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, NULL, + _("Image file %s not deleted: %s\n"), + Closure->imageName, strerror(errno)); } } diff --git a/rs01-verify.c b/rs01-verify.c index 3315659..431a6d0 100644 --- a/rs01-verify.c +++ b/rs01-verify.c @@ -830,7 +830,7 @@ process_ecc: { if(!Closure->guiMode) PrintProgress(_("- ecc md5sum : %3d%%"),percent); else SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%3d%%", percent); - last_percent = percent; + last_percent = percent; } if(Closure->stopActions) diff --git a/rs03-create.c b/rs03-create.c index 40066d2..b2c6033 100644 --- a/rs03-create.c +++ b/rs03-create.c @@ -31,9 +31,9 @@ //#define VERBOSE 1 #ifdef VERBOSE - #define verbose(format,args...) printf(format, ## args) + #define verbose(format,...) printf(format, __VA_ARGS__) #else - #define verbose(format,args...) + #define verbose(format,...) #endif #ifdef HAVE_MMAP @@ -688,7 +688,7 @@ static void flush_crc(ecc_closure *ec, LargeFile *file_out) /* Write out the CRC layer */ - verbose("IO: writing CRC layer\n"); + verbose("%s", "IO: writing CRC layer\n"); crc_sect = 2048*(ec->encoderChunk+lay->firstCrcPos); if(!LargeSeek(file_out, crc_sect)) { ec->abortImmediately = TRUE; @@ -709,7 +709,7 @@ static void flush_parity(ecc_closure *ec, LargeFile *file_out) /* Write out the created parity. */ - verbose("IO: writing parity...\n"); + verbose("%s", "IO: writing parity...\n"); for(k=0; knroots; k++) { gint64 idx=0; @@ -726,7 +726,7 @@ static void flush_parity(ecc_closure *ec, LargeFile *file_out) } } } - verbose("IO: parity written.\n"); + verbose("%s", "IO: parity written.\n"); } static gpointer io_thread(ecc_closure *ec) @@ -741,7 +741,7 @@ static gpointer io_thread(ecc_closure *ec) int parity_available = 0; int i; - verbose("Reader thread initializing\n"); + verbose("%s", "Reader thread initializing\n"); /*** Allocate local parity buffer aligned at 128bit boundary */ @@ -809,7 +809,7 @@ static gpointer io_thread(ecc_closure *ec) { read_next_chunk(ec, chunk); // flush_crc(ec, file_out); // FIXME needs_preload = 0; - verbose("IO: first chunk loaded\n"); + verbose("%s", "IO: first chunk loaded\n"); continue; } @@ -856,7 +856,7 @@ static gpointer io_thread(ecc_closure *ec) g_mutex_lock(ec->lock); cpu_bound = ec->buffersToEncode; while(ec->buffersToEncode) - { verbose("IO: Waiting for encoders to finish\n"); + { verbose("%s", "IO: Waiting for encoders to finish\n"); g_cond_wait(ec->ioCond, ec->lock); } g_mutex_unlock(ec->lock); @@ -898,7 +898,7 @@ static gpointer io_thread(ecc_closure *ec) ec->slicesFree = TRUE; /* we have saved the slices; go ahead */ g_cond_broadcast(ec->ioCond); while(ec->buffersToEncode) - { verbose("IO: Waiting for encoders to finish last chunk\n"); + { verbose("%s", "IO: Waiting for encoders to finish last chunk\n"); g_cond_wait(ec->ioCond, ec->lock); } g_mutex_unlock(ec->lock); @@ -911,7 +911,7 @@ static gpointer io_thread(ecc_closure *ec) flush_crc(ec, file_out); flush_parity(ec, file_out); - verbose("IO: finished\n"); fflush(stdout); + verbose("%s", "IO: finished\n"); fflush(stdout); return NULL; } @@ -1098,7 +1098,7 @@ static gpointer encoder_thread(ecc_closure *ec) ec->buffersToEncode-=enc_size; if(!ec->buffersToEncode) { g_cond_broadcast(ec->ioCond); - verbose("ENC: processed last buffer; telling IO process.\n"); + verbose("%s", "ENC: processed last buffer; telling IO process.\n"); fflush(stdout); } g_mutex_unlock(ec->lock); @@ -1198,7 +1198,7 @@ static void create_reed_solomon(ecc_closure *ec) verbose("SCHED: joined with worker %d\n", i); fflush(stdout); } - verbose("SCHED: scheduler finished.\n"); + verbose("%s", "SCHED: scheduler finished.\n"); } /*** diff --git a/rs03-fix.c b/rs03-fix.c index 0a7a1d3..e162e5e 100644 --- a/rs03-fix.c +++ b/rs03-fix.c @@ -829,10 +829,10 @@ void RS03Fix(Image *image) if we were processing an augmented image. */ if(lay->target == ECC_FILE && i >= ndata-1) - { - if(!LargeSeek(image->eccFile, (gint64)(2048*sec))) - Stop(_("Failed seeking to sector %lld in ecc file [%s]: %s"), - sec, "FW", strerror(errno)); + { + if(!LargeSeek(image->eccFile, (gint64)(2048*sec))) + Stop(_("Failed seeking to sector %lld in ecc file [%s]: %s"), + sec, "FW", strerror(errno)); n = LargeWrite(image->eccFile, cache_offset+fc->imgBlock[i], 2048); if(n != 2048) diff --git a/scsi-layer.c b/scsi-layer.c index 64a3dba..3be21ff 100644 --- a/scsi-layer.c +++ b/scsi-layer.c @@ -31,7 +31,9 @@ static int query_type(DeviceHandle*, int); static gint64 query_size(Image*); +#if 0 static int query_copyright(DeviceHandle*); +#endif static int read_dvd_sector(DeviceHandle*, unsigned char*, int, int); static int read_cd_sector(DeviceHandle*, unsigned char*, int, int); @@ -1649,6 +1651,7 @@ reset_mode_page: * Find out whether we are allowed to create an image from the DVD. */ +#if 0 static int query_copyright(DeviceHandle *dh) { Sense sense; AlignedBuffer *ab = CreateAlignedBuffer(2048); @@ -1709,6 +1712,7 @@ static int query_copyright(DeviceHandle *dh) return result; } +#endif /* * See whether a sector lies within the user area. diff --git a/smart-lec.c b/smart-lec.c index 8da74ff..0355879 100644 --- a/smart-lec.c +++ b/smart-lec.c @@ -27,9 +27,9 @@ #define VERBOSE 1 #ifdef VERBOSE - #define verbose(format,args...) printf(format, ## args) + #define verbose(format,...) printf(format, __VA_ARGS__) #else - #define verbose(format,args...) + #define verbose(format,...) #endif /*** @@ -432,7 +432,7 @@ static void update_pq_state(sh_context *shc) static void print_pq_state(sh_context *shc) { int i; - verbose("PQ states: \n"); + verbose("%s", "PQ states: \n"); for(i=0; ipState[i] == 1) @@ -1354,7 +1354,7 @@ static void swap_p_for_new_improvement(sh_context *shc) count++; if(count < 2) - { verbose(" pruned"); + { verbose("%s", " pruned"); goto decrement; } @@ -1417,7 +1417,7 @@ decrement: if(index >= n_q) break; selection[index]=0; - verbose("\n"); + verbose("%s", "\n"); } } }