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 adplug/cff.cpp:381
> W: deadbeef sequence-point adplug/dmo.cpp:323, 343, 367
> W: deadbeef sequence-point lh5dec.c:95
> W: deadbeef sequence-point 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 libsc68/conf68.c:198:12
> E: deadbeef bufferoverflowstrncat libsc68/conf68.c:258:14
>
> I: Program returns random data in a function
> E: deadbeef no-return-in-nonvoid-function pltbrowser.c:748, 759
> E: deadbeef no-return-in-nonvoid-function search.c:308
> E: deadbeef no-return-in-nonvoid-function widgets.c:3347
>
> I: Program returns random data in a function
> E: deadbeef no-return-in-nonvoid-function pltbrowser.c:748, 759
> E: deadbeef no-return-in-nonvoid-function search.c:308
> E: deadbeef no-return-in-nonvoid-function widgets.c:3347
---
--- a/plugins/adplug/adplug/cff.cpp
+++ b/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;
--- a/plugins/adplug/adplug/dmo.cpp
+++ b/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++;
--- a/plugins/gtkui/plcommon.c
+++ b/plugins/gtkui/plcommon.c
@@ -1525,14 +1525,26 @@
static void
_make_format (char *format, size_t size, DdbListviewGroupFormat *fmt) {
- format[0] = 0;
+ char *p = format;
+ size_t remaining = sizeof(format) - 1;
+ size_t copy_len, sep_len = strlen(SUBGROUP_DELIMITER);
while (fmt) {
- if (format[0] != 0) {
- strncat(format, SUBGROUP_DELIMITER, size - strlen(format) - 1);
+ copy_len = strlen(fmt->format);
+ if (copy_len > remaining)
+ break;
+ if (p != format) {
+ if (copy_len + sep_len > remaining)
+ break;
+ memcpy(p, SUBGROUP_DELIMITER, sep_len);
+ remaining -= sep_len;
+ p += sep_len;
}
- strncat(format, fmt->format, size - strlen(format) - 1);
+ memcpy(p, fmt->format, copy_len);
+ remaining -= copy_len;
+ p += copy_len;
fmt = fmt->next;
}
+ *p = '\0';
}
static void
--- a/plugins/gtkui/search.c
+++ b/plugins/gtkui/search.c
@@ -299,7 +299,7 @@ submit_refresh (void) {
}
}
-static gboolean
+static void
playlistswitch_cb (void) {
DdbListview *listview = playlist_visible();
if (listview) {
--- a/plugins/gtkui/widgets.c
+++ b/plugins/gtkui/widgets.c
@@ -3338,7 +3338,7 @@ spectrum_realize (GtkWidget *widget, gpo
#endif
}
-static int
+static void
w_spectrum_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
switch (id) {
case DB_EV_SONGCHANGED: {
--- a/plugins/pltbrowser/pltbrowser.c
+++ b/plugins/pltbrowser/pltbrowser.c
@@ -736,7 +736,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,
@@ -748,7 +748,7 @@ on_pltbrowser_drag_begin_event
return FALSE;
}
-static gboolean
+static void
on_pltbrowser_drag_end_event (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
--- a/plugins/tta/ttadec.c
+++ b/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);
--- a/plugins/vtx/lh5dec.c
+++ b/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)) {