wok-next view xplanet/stuff/patches/fix_warnings.diff @ rev 20559
rrdtool: syntax error
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sat Apr 07 17:41:33 2018 +0300 (2018-04-07) |
parents | |
children |
line source
1 diff --git a/src/libdisplay/DisplayBase.cpp b/src/libdisplay/DisplayBase.cpp
2 index 7287232..1fd086f 100644
3 --- a/src/libdisplay/DisplayBase.cpp
4 +++ b/src/libdisplay/DisplayBase.cpp
5 @@ -224,7 +224,7 @@ DisplayBase::drawLabel(PlanetProperties *planetProperties[])
6 tzSave = "TZ=";
7 tzSave += tzEnv;
8 }
9 - putenv("TZ=UTC");
10 + putenv((char *)"TZ=UTC");
11 tzset();
12 }
14 diff --git a/src/libdisplay/DisplayX11.cpp b/src/libdisplay/DisplayX11.cpp
15 index ad5a47d..f5cbff1 100644
16 --- a/src/libdisplay/DisplayX11.cpp
17 +++ b/src/libdisplay/DisplayX11.cpp
18 @@ -97,8 +97,8 @@ DisplayX11::DisplayX11(const int tr) : DisplayBase(tr)
19 // contributed by Dragan Stanojevic - Nevidljivi <invisible@hidden-city.net>
20 XClassHint classHint;
22 - classHint.res_name = "xplanet";
23 - classHint.res_class = "XPlanet";
24 + classHint.res_name = (char *)"xplanet";
25 + classHint.res_class = (char *)"XPlanet";
27 XSetClassHint(display, window, &classHint);
28 }
29 diff --git a/src/libimage/ReadImage.cpp b/src/libimage/ReadImage.cpp
30 index 0d07575..8a47dd2 100644
31 --- a/src/libimage/ReadImage.cpp
32 +++ b/src/libimage/ReadImage.cpp
33 @@ -45,6 +45,7 @@ ReadImage(const char *filename, int &width, int &height,
34 {
35 char buf[4];
36 unsigned char *ubuf = (unsigned char *) buf;
37 + size_t ret = 0;
38 int success = 0;
40 FILE *file;
41 @@ -53,8 +54,10 @@ ReadImage(const char *filename, int &width, int &height,
43 /* see what kind of file we have */
45 - fread(buf, 1, 4, file);
46 + ret = fread(buf, 1, 4, file);
47 fclose(file);
48 + if (ret != 4)
49 + return 0;
51 if (!strncmp("BM", buf, 2))
52 {
53 diff --git a/src/libimage/png.c b/src/libimage/png.c
54 index 51bac8d..d5d6645 100644
55 --- a/src/libimage/png.c
56 +++ b/src/libimage/png.c
57 @@ -20,6 +20,7 @@
59 #include <stdio.h>
60 #include <stdlib.h>
61 +#include <string.h>
63 #include <png.h>
65 diff --git a/src/libmultiple/RayleighScattering.cpp b/src/libmultiple/RayleighScattering.cpp
66 index d885173..1b3f406 100644
67 --- a/src/libmultiple/RayleighScattering.cpp
68 +++ b/src/libmultiple/RayleighScattering.cpp
69 @@ -618,19 +618,28 @@ RayleighScattering::readBinaryTable(const char *filename)
71 if (inFile != NULL)
72 {
73 - size_t dim0, dim1, dim2;
74 - fread(&dim0, sizeof(size_t), 1, inFile);
75 - fread(&dim1, sizeof(size_t), 1, inFile);
76 - fread(&dim2, sizeof(size_t), 1, inFile);
77 -
78 - size_t size = dim0*dim1*dim2;
79 + size_t dim0, dim1, dim2, ret;
80 + ret = fread(&dim0, sizeof(size_t), 1, inFile);
81 + if (ret == sizeof(size_t))
82 + ret = fread(&dim1, sizeof(size_t), 1, inFile);
83 + if (ret == sizeof(size_t))
84 + ret = fread(&dim2, sizeof(size_t), 1, inFile);
85 +
86 + if (ret == sizeof(size_t))
87 + {
88 + size_t size = dim0*dim1*dim2;
90 - dblArray = new double[size];
91 - fread(dblArray, sizeof(double), size, inFile);
92 + dblArray = new double[size];
93 + ret = fread(dblArray, sizeof(double), size, inFile);
94 + if (ret != size)
95 + {
96 + delete dblArray;
97 + dblArray = NULL;
98 + }
99 + }
100 + fclose(inFile);
101 }
103 - fclose(inFile);
104 -
105 return dblArray;
106 }
108 diff --git a/src/readConfig.cpp b/src/readConfig.cpp
109 index cc1964f..3186534 100644
110 --- a/src/readConfig.cpp
111 +++ b/src/readConfig.cpp
112 @@ -49,7 +49,7 @@ readConfig(const char *line, PlanetProperties *planetProperties[])
113 int r, g, b;
114 if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
115 {
116 - unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
117 + unsigned char color[3] = { (unsigned char)(r & 0xff), (unsigned char)(g & 0xff), (unsigned char)(b & 0xff) };
118 currentProperties->ArcColor(color);
119 }
120 else
121 @@ -179,7 +179,7 @@ readConfig(const char *line, PlanetProperties *planetProperties[])
122 int r, g, b;
123 if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
124 {
125 - unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
126 + unsigned char color[3] = { (unsigned char)(r & 0xff), (unsigned char)(g & 0xff), (unsigned char)(b & 0xff) };
127 currentProperties->Color(color);
128 }
129 else
130 @@ -244,7 +244,7 @@ readConfig(const char *line, PlanetProperties *planetProperties[])
131 int r, g, b;
132 if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
133 {
134 - unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
135 + unsigned char color[3] = { (unsigned char)(r & 0xff), (unsigned char)(g & 0xff), (unsigned char)(b & 0xff) };
136 currentProperties->GridColor(color);
137 }
138 else
139 @@ -296,7 +296,7 @@ readConfig(const char *line, PlanetProperties *planetProperties[])
140 int r, g, b;
141 if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
142 {
143 - unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
144 + unsigned char color[3] = { (unsigned char)(r & 0xff), (unsigned char)(g & 0xff), (unsigned char)(b & 0xff) };
145 currentProperties->MarkerColor(color);
146 }
147 else
148 @@ -403,7 +403,7 @@ readConfig(const char *line, PlanetProperties *planetProperties[])
149 int r, g, b;
150 if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
151 {
152 - unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
153 + unsigned char color[3] = { (unsigned char)(r & 0xff), (unsigned char)(g & 0xff), (unsigned char)(b & 0xff) };
154 currentProperties->OrbitColor(color);
155 }
156 else
157 @@ -473,7 +473,7 @@ readConfig(const char *line, PlanetProperties *planetProperties[])
158 int r, g, b;
159 if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
160 {
161 - unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
162 + unsigned char color[3] = { (unsigned char)(r & 0xff), (unsigned char)(g & 0xff), (unsigned char)(b & 0xff) };
163 currentProperties->TextColor(color);
164 }
165 else