~cmiller/ubuntu/trusty/icewm/translations-cause-crash-lp447883

« back to all changes in this revision

Viewing changes to debian/patches/network_load_incator_fix.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Jerome Marant
  • Date: 2002-03-23 13:06:05 UTC
  • Revision ID: james.westby@ubuntu.com-20020323130605-qvzaillwdk3j8x24
Tags: 1.0.9.2-7
* Integrated more fixes from Julien Lemoine:
  - Improved again window position patch.
    Closes: Bug#138784, Bug#126214.
  - Improved patch fixing taskbar display in hide mode. Closes: Bug#139426.
  - Fixed non-functional logout entry in icewm-lite. Closes: Bug#130466.
* Applied patch from Rob Funk fixing the broken POP3 mailcheck with
  some servers. Closes: Bug#139401.
* Applied patch removing src/.targets when cleaning so targets are
  calculated for each icewm flavour. Closes: Bug#139370.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
 
 
3
# DP: Owerflow in the network load indicator
 
4
#     
 
5
 
 
6
if [ $# -ne 1 ]; then
 
7
    echo >&2 "$0: script expects -patch|-unpatch as argument"
 
8
    exit 1
 
9
fi
 
10
case "$1" in
 
11
    -patch) patch -f -p0 < $0;;
 
12
    -unpatch) patch -f -R -p0 < $0;;
 
13
    *)
 
14
        echo >&2 "$0: script expects -patch|-unpatch as argument"
 
15
        exit 1
 
16
esac
 
17
exit 0
 
18
 
 
19
--- src/apppstatus.cc.orig
 
20
+++ src/apppstatus.cc
 
21
@@ -118,19 +118,19 @@
 
22
     char status[400];
 
23
 
 
24
     if (isUp()) {
 
25
-       char const * const sizeUnits[] = { "b", "kb", "Mb", "Gb", "Tb", NULL };
 
26
-       char const * const rateUnits[] = { "bps", "kps", "Mps", NULL };
 
27
+       char const * const sizeUnits[] = { "b", "KiB", "MiB", "GiB", "TiB", NULL };
 
28
+       char const * const rateUnits[] = { "Bps", "Kps", "Mps", NULL };
 
29
 
 
30
        int const t(time(NULL) - start_time);
 
31
 
 
32
-       int vi(cur_ibytes - start_ibytes);
 
33
-       int vo(cur_obytes - start_obytes);
 
34
+       long long vi(cur_ibytes - start_ibytes);
 
35
+       long long vo(cur_obytes - start_obytes);
 
36
        
 
37
-       int ci(ppp_in[NET_SAMPLES - 1]);
 
38
-       int co(ppp_out[NET_SAMPLES - 1]);
 
39
+       long long ci(ppp_in[NET_SAMPLES - 1]);
 
40
+       long long co(ppp_out[NET_SAMPLES - 1]);
 
41
 
 
42
-       int ai(t ? vi / t : 0);
 
43
-       int ao(t ? vo / t : 0);
 
44
+       long long ai(t ? vi / t : 0);
 
45
+       long long ao(t ? vo / t : 0);
 
46
     
 
47
        const char * const viUnit(niceUnit(vi, sizeUnits));
 
48
        const char * const voUnit(niceUnit(vo, sizeUnits));
 
49
@@ -141,9 +141,9 @@
 
50
 
 
51
         snprintf(status, sizeof(status),
 
52
                _("Interface %s:\n"
 
53
-                 "  Current rate (in/out):\t%d %s/%d %s\n"
 
54
-                 "  Average rate (in/out):\t%d %s/%d %s\n"
 
55
-                 "  Transferred (in/out):\t%d %s/%d %s\n"
 
56
+                 "  Current rate (in/out):\t%lli %s/%lli %s\n"
 
57
+                 "  Average rate (in/out):\t%lli %s/%lli %s\n"
 
58
+                 "  Transferred (in/out):\t%lli %s/%lli %s\n"
 
59
                  "  Online time:\t%d:%02d:%02d"
 
60
                  "%s%s"),
 
61
                fNetDev,
 
62
@@ -176,15 +176,15 @@
 
63
 void NetStatus::paint(Graphics &g, int /*x*/, int /*y*/,
 
64
                       unsigned int /*width*/, unsigned int /*height*/ )
 
65
 {
 
66
-    int h = height();
 
67
+    long h = height();
 
68
 
 
69
     //!!! this should really be unified with acpustatus.cc
 
70
     for (int i = 0; i < NET_SAMPLES; i++) {
 
71
         if (ppp_tot[i] > 0) {
 
72
-            int in = (h * ppp_in[i] + maxBytes - 1) / maxBytes;
 
73
-            int out = (h * ppp_out[i] + maxBytes - 1) / maxBytes;
 
74
-            int t = h - in - 1;
 
75
-            int l = out;
 
76
+            long long in = (h * ppp_in[i] + maxBytes - 1) / maxBytes;
 
77
+            long long out = (h * ppp_out[i] + maxBytes - 1) / maxBytes;
 
78
+            long long t = h - in - 1;
 
79
+            long long l = out;
 
80
 
 
81
             //msg("in: %d:%d:%d, out: %d:%d:%d", in, t, ppp_in[i], out, l, ppp_out[i]);
 
82
 
 
83
@@ -258,7 +258,7 @@
 
84
     char *p = str;
 
85
     char busage;
 
86
     char bflags;
 
87
-    int len, i;
 
88
+    long long len, i;
 
89
     int f = open("/dev/isdninfo", O_RDONLY);
 
90
 
 
91
     if (f < 0)
 
92
@@ -337,7 +337,7 @@
 
93
     char buffer[32 * sizeof(struct ifreq)];
 
94
     struct ifconf ifc;
 
95
     struct ifreq *ifr;
 
96
-    int len;
 
97
+    long long len;
 
98
 
 
99
     if (fNetDev == 0)
 
100
         return false;
 
101
@@ -382,7 +382,7 @@
 
102
 }
 
103
 
 
104
 
 
105
-void NetStatus::getCurrent(int *in, int *out, int *tot) {
 
106
+void NetStatus::getCurrent(long long *in, long long *out, long long *tot) {
 
107
 #if 0
 
108
     struct ifpppstatsreq req; // from <net/if_ppp.h> in the linux world
 
109
 
 
110
@@ -428,24 +428,24 @@
 
111
         if (strncmp(p, fNetDev, strlen(fNetDev)) == 0 &&
 
112
             p[strlen(fNetDev)] == ':')
 
113
         {
 
114
-            int ipackets, opackets;
 
115
-            int ierrs, oerrs;
 
116
-            int idrop, odrop;
 
117
-            int ififo, ofifo;
 
118
-            int iframe;
 
119
-            int ocolls;
 
120
-            int ocarrier;
 
121
-            int icomp, ocomp;
 
122
-            int imcast;
 
123
+            long long ipackets, opackets;
 
124
+            long long ierrs, oerrs;
 
125
+            long long idrop, odrop;
 
126
+            long long ififo, ofifo;
 
127
+            long long iframe;
 
128
+            long long ocolls;
 
129
+            long long ocarrier;
 
130
+            long long icomp, ocomp;
 
131
+            long long imcast;
 
132
 
 
133
             p = strchr(p, ':') + 1;
 
134
 
 
135
-            if (sscanf(p, "%lu %d %d %d %d %d %d %d" " %lu %d %d %d %d %d %d %d",
 
136
+            if (sscanf(p, "%llu %lld %lld %lld %lld %lld %lld %lld" " %llu %lld %lld %lld %lld %lld %lld %lld",
 
137
                        &cur_ibytes, &ipackets, &ierrs, &idrop, &ififo, &iframe, &icomp, &imcast,
 
138
                        &cur_obytes, &opackets, &oerrs, &odrop, &ofifo, &ocolls, &ocarrier, &ocomp) != 16)
 
139
             {
 
140
                 ipackets = opackets = 0;
 
141
-                sscanf(p, "%d %d %d %d %d" " %d %d %d %d %d %d",
 
142
+                sscanf(p, "%lld %lld %lld %lld %lld" " %lld %lld %lld %lld %lld %lld",
 
143
                        &ipackets, &ierrs, &idrop, &ififo, &iframe,
 
144
                        &opackets, &oerrs, &odrop, &ofifo, &ocolls, &ocarrier);
 
145
                 // for linux<2.0 fake packets as bytes (we only need relative values anyway)
 
146
@@ -499,8 +499,8 @@
 
147
     double delta_t = (double) ((curr_time.tv_sec  - prev_time.tv_sec) * 1000000L
 
148
                              + (curr_time.tv_usec - prev_time.tv_usec)) / 1000000.0;
 
149
 
 
150
-    int ni = (int)((cur_ibytes - prev_ibytes) / delta_t);
 
151
-    int no = (int)((cur_obytes - prev_obytes) / delta_t);
 
152
+    long long ni = (long long)((cur_ibytes - prev_ibytes) / delta_t);
 
153
+    long long no = (long long)((cur_obytes - prev_obytes) / delta_t);
 
154
 
 
155
     //msg("%d %d", ni, no);
 
156
 
 
157
--- src/apppstatus.h.orig
 
158
+++ src/apppstatus.h
 
159
@@ -30,12 +30,12 @@
 
160
     YTimer *fUpdateTimer;
 
161
     int maxBytes;
 
162
 
 
163
-    int ppp_in[NET_SAMPLES];
 
164
-    int ppp_out[NET_SAMPLES];
 
165
-    int ppp_tot[NET_SAMPLES];
 
166
+    long long ppp_in[NET_SAMPLES];
 
167
+    long long ppp_out[NET_SAMPLES];
 
168
+    long long ppp_tot[NET_SAMPLES];
 
169
 
 
170
-    unsigned long prev_ibytes, start_ibytes, cur_ibytes;
 
171
-    unsigned long prev_obytes, start_obytes, cur_obytes;
 
172
+    unsigned long long prev_ibytes, start_ibytes, cur_ibytes;
 
173
+    unsigned long long prev_obytes, start_obytes, cur_obytes;
 
174
 
 
175
     time_t start_time;
 
176
 
 
177
@@ -50,7 +50,7 @@
 
178
     // methods local to this class
 
179
     bool isUp();
 
180
     bool isUpIsdn();
 
181
-    void getCurrent(int *in, int *out, int *tot);
 
182
+    void getCurrent(long long *in, long long *out, long long *tot);
 
183
     void updateStatus();
 
184
     void updateToolTip();
 
185