File deadbeef-compiler-warnings.patch of Package deadbeef
> I: Program causes undefined operation
> (likely same variable used twiceand post/pre incremented in the same expression).
> e.g. x = x++; Split it in two operations.
> W: deadbeef sequence-point ./../plugins/adplug/adplug/cff.cpp:381
> W: deadbeef sequence-point ./../plugins/adplug/adplug/dmo.cpp:323, 343, 367
> W: deadbeef sequence-point ../../plugins/vtx/lh5dec.c:95
> W: deadbeef sequence-point ../../plugins/tta/ttadec.c:515
>
> I: Statement might be overflowing a buffer in strncat. Common mistake:
> BAD: strncat(buffer,charptr,sizeof(buffer)) is wrong, it takes the left over size as 3rd argument
> GOOD: strncat(buffer,charptr,sizeof(buffer)-strlen(buffer)-1)
> E: deadbeef bufferoverflowstrncat ../../plugins/sc68/libsc68/conf68.c:198, 258
>
> I: Program returns random data in a function
> E: deadbeef no-return-in-nonvoid-function ../../plugins/pltbrowser/pltbrowser.c:719, 730
>
> I: Program returns random data in a function
> E: deadbeef no-return-in-nonvoid-function ../../plugins/pltbrowser/pltbrowser.c:719, 730
>
> I: Expression compares a char* pointer with a string literal.
> Usually a strcmp() was intended by the programmer
> E: deadbeef stringcompare ../../plugins/gtkui/widgets.c:1188, 1221
---
Index: deadbeef-0.7.0/plugins/adplug/adplug/cff.cpp
===================================================================
--- deadbeef-0.7.0.orig/plugins/adplug/adplug/cff.cpp
+++ deadbeef-0.7.0/plugins/adplug/adplug/cff.cpp
@@ -377,8 +377,10 @@ long CcffLoader::cff_unpacker::unpack(un
goto out;
}
- for (unsigned int i=0;i<repeat_counter*repeat_length;i++)
- output[output_length++] = output[output_length - repeat_length];
+ for (unsigned int i=0;i<repeat_counter*repeat_length;i++) {
+ output[output_length] = output[output_length - repeat_length];
+ output_length++;
+ }
code_length = old_code_length;
Index: deadbeef-0.7.0/plugins/adplug/adplug/dmo.cpp
===================================================================
--- deadbeef-0.7.0.orig/plugins/adplug/adplug/dmo.cpp
+++ deadbeef-0.7.0/plugins/adplug/adplug/dmo.cpp
@@ -319,8 +319,10 @@ short CdmoLoader::dmo_unpacker::unpack_b
if(opos + cx >= oend)
return -1;
- for(int i=0;i<cx;i++)
- *opos++ = *(opos - ax);
+ for(int i=0;i<cx;i++) {
+ *opos = *(opos - ax);
+ *opos++;
+ }
continue;
}
@@ -339,8 +341,10 @@ short CdmoLoader::dmo_unpacker::unpack_b
if(opos + bx + cx >= oend)
return -1;
- for(i=0;i<cx;i++)
- *opos++ = *(opos - ax);
+ for(i=0;i<cx;i++) {
+ *opos = *(opos - ax);
+ *opos++;
+ }
for (i=0;i<bx;i++)
*opos++ = *ipos++;
@@ -363,8 +367,10 @@ short CdmoLoader::dmo_unpacker::unpack_b
if(opos + ax + cx >= oend)
return -1;
- for(i=0;i<cx;i++)
- *opos++ = *(opos - bx);
+ for(i=0;i<cx;i++) {
+ *opos = *(opos - bx);
+ *opos++;
+ }
for (i=0;i<ax;i++)
*opos++ = *ipos++;
Index: deadbeef-0.7.0/plugins/gtkui/widgets.c
===================================================================
--- deadbeef-0.7.0.orig/plugins/gtkui/widgets.c
+++ deadbeef-0.7.0/plugins/gtkui/widgets.c
@@ -1185,7 +1185,7 @@ w_splitter_lock (w_splitter_t *w) {
}
w->locked = 1;
- int vert = w->base.type == "vsplitter";
+ int vert = g_strcmp0(w->base.type, "vsplitter") == 0;
GtkAllocation a;
gtk_widget_get_allocation (w->base.widget, &a);
@@ -1218,7 +1218,7 @@ w_splitter_unlock (w_splitter_t *w) {
}
w->locked = 0;
- int vert = w->base.type == "vsplitter";
+ int vert = g_strcmp0(w->base.type, "vsplitter") == 0;
// convert back to vpaned
GtkWidget *paned = vert ? gtk_vpaned_new () : gtk_hpaned_new ();
gtk_widget_set_can_focus (paned, FALSE);
Index: deadbeef-0.7.0/plugins/pltbrowser/pltbrowser.c
===================================================================
--- deadbeef-0.7.0.orig/plugins/pltbrowser/pltbrowser.c
+++ deadbeef-0.7.0/plugins/pltbrowser/pltbrowser.c
@@ -707,7 +707,7 @@ add_treeview_column (w_pltbrowser_t *w,
static gboolean drag_row_active = FALSE;
-static gboolean
+static void
on_pltbrowser_drag_begin_event (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
@@ -718,7 +718,7 @@ on_pltbrowser_drag_begin_event
drag_row_active = TRUE;
}
-static gboolean
+static void
on_pltbrowser_drag_end_event (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
Index: deadbeef-0.7.0/plugins/sc68/libsc68/conf68.c
===================================================================
--- deadbeef-0.7.0.orig/plugins/sc68/libsc68/conf68.c
+++ deadbeef-0.7.0/plugins/sc68/libsc68/conf68.c
@@ -195,7 +195,7 @@ int config68_save(const char * confname)
const int sizeof_config_hd = sizeof(config_header)-1;
strncpy(tmp, "sc68://config/", sizeof(tmp));
- strncat(tmp, confname, sizeof(tmp));
+ strncat(tmp, confname, sizeof(tmp)-strlen(tmp)-1);
os = uri68_vfs(tmp, 2, 0);
err = vfs68_open(os);
if (!err) {
@@ -255,7 +255,7 @@ static int load_from_registry(const char
for (k=0; k<2; ++k) {
strncpy(path, paths[k], sizeof(path));
- strncat(path, opt->name, sizeof(path));
+ strncat(path, opt->name, sizeof(path)-strlen(path)-1);
TRACE68(config68_cat, "conf68: trying -- '%s'\n", path);
switch (opt->type) {
Index: deadbeef-0.7.0/plugins/tta/ttadec.c
===================================================================
--- deadbeef-0.7.0.orig/plugins/tta/ttadec.c
+++ deadbeef-0.7.0/plugins/tta/ttadec.c
@@ -459,7 +459,7 @@ int get_samples (tta_info *info, byte *b
byte *p = buffer;
decoder *dec = info->tta;
int *prev = info->cache;
- int value, res;
+ int value, res, tmp;
for (res = 0; p < buffer + info->pcm_buffer_size;) {
fltst *fst = &dec->fst;
@@ -512,7 +512,8 @@ int get_samples (tta_info *info, byte *b
rice->k0++;
}
- value = DEC(value);
+ tmp = DEC(value);
+ value = tmp;
// decompress stage 1: adaptive hybrid filter
hybrid_filter(fst, &value);
Index: deadbeef-0.7.0/plugins/vtx/lh5dec.c
===================================================================
--- deadbeef-0.7.0.orig/plugins/vtx/lh5dec.c
+++ deadbeef-0.7.0/plugins/vtx/lh5dec.c
@@ -92,7 +92,7 @@ static void make_table(int nchar, unsign
start[i] >>= jutbits;
weight[i] = 1U << (tablebits - i);
}
- while (i <= 16) weight[i++] = 1U << (16 - i);
+ while (i <= 16) { weight[i] = 1U << (16 - i); i++; }
i = start[tablebits + 1] >> jutbits;
if (i != (unsigned short)(1U << 16)) {