File: fix-FTBFS-with-gcc-14.diff

package info (click to toggle)
dillo 3.0.5-7.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,560 kB
  • sloc: cpp: 33,618; ansic: 19,437; sh: 4,006; makefile: 561; perl: 131
file content (71 lines) | stat: -rw-r--r-- 2,251 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Description: fix FTBFS with GCC 14
Bug-Debian: https://bugs.debian.org/1074911
Author: mirabilos <tg@debian.org>
Forwarded: not-needed (new upstream says their code builds fine)

--- a/dpi/downloads.cc
+++ b/dpi/downloads.cc
@@ -520,7 +520,9 @@ void DLItem::log_text_add(const char *bu
          if (isdigit(*q++ = *p)) {
             // keep here
          } else if (*p == 'K') {
-            for (--q; isdigit(q[-1]); --q) ; log_state = ST_discard;
+            for (--q; isdigit(q[-1]); --q)
+               ;
+            log_state = ST_discard;
          } else {
             log_state = ST_copy;
          }
@@ -662,6 +664,8 @@ void DLItem::child_finished(int status)
    MSG("wget status %d\n", status);
 }
 
+#define secs2timestr_len 64
+
 /*
  * Convert seconds into human readable [hour]:[min]:[sec] string.
  */
@@ -672,11 +676,11 @@ static void secs2timestr(int et, char *s
    eh = et / 3600; em = (et % 3600) / 60; es = et % 60;
    if (eh == 0) {
       if (em == 0)
-         snprintf(str, 8, "%ds", es);
+         snprintf(str, secs2timestr_len, "%ds", es);
       else
-         snprintf(str, 8, "%dm%ds", em, es);
+         snprintf(str, secs2timestr_len, "%dm%ds", em, es);
    } else {
-      snprintf(str, 8, "%dh%dm", eh, em);
+      snprintf(str, secs2timestr_len, "%dh%dm", eh, em);
    }
 }
 
@@ -688,7 +692,7 @@ void DLItem::update()
    struct stat ss;
    time_t curr_time;
    float csec, tsec, rate, _rate = 0;
-   char str[64];
+   char str[secs2timestr_len];
    int et;
 
    if (updates_done())
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -1193,7 +1193,7 @@ void a_UIcmd_view_page_source(BrowserWin
    int buf_size;
    Dstr *dstr_url;
    DilloUrl *vs_url;
-   static int post_id = 0;
+   static unsigned short post_id = 0;
    char tag[8];
    const char *content_type = a_Nav_get_content_type(url);
 
@@ -1207,7 +1207,7 @@ void a_UIcmd_view_page_source(BrowserWin
       if (URL_FLAGS(url) & URL_Post) {
          /* append a custom string to differentiate POST URLs */
          post_id = (post_id < 9999) ? post_id + 1 : 0;
-         snprintf(tag, 8, "_%.4d", post_id);
+         snprintf(tag, 8, "_%.4u", post_id);
          dStr_append(dstr_url, tag);
       }
       vs_url = a_Url_new(dstr_url->str, NULL);