Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-power/acpitool/files: acpitool-0.4.7-gcc43.patch
Date: Sun, 20 Apr 2008 08:46:27
Message-Id: E1JnVBn-0001gF-UU@stork.gentoo.org
1 vapier 08/04/20 08:46:23
2
3 Added: acpitool-0.4.7-gcc43.patch
4 Log:
5 Fix from Fedora for building with gcc-4.3 #214171 by Peter Alfredsen.
6 (Portage version: 2.2_pre5)
7
8 Revision Changes Path
9 1.1 sys-power/acpitool/files/acpitool-0.4.7-gcc43.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-power/acpitool/files/acpitool-0.4.7-gcc43.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-power/acpitool/files/acpitool-0.4.7-gcc43.patch?rev=1.1&content-type=text/plain
13
14 Index: acpitool-0.4.7-gcc43.patch
15 ===================================================================
16 sniped from Fedora
17
18 http://bugs.gentoo.org/214171
19
20 --- acpitool-0.4.7/src/cpu.cpp.gcc43
21 +++ acpitool-0.4.7/src/cpu.cpp
22 @@ -27,6 +27,8 @@
23 #include <config.h>
24 #endif
25
26 +#include <cstdlib>
27 +#include <cstring>
28 #include <iostream>
29 #include <iomanip>
30 #include <fstream>
31 @@ -57,7 +59,7 @@ int Show_CPU_Info()
32 {
33 for(int t=0; t<4; t++) fgets(str, 299, cpuinfo_fp); // skip 4 lines //
34 fgets(str, 299, cpuinfo_fp);
35 - bzero(temp, 130); // use sscanf to extract what we need : //
36 + memset(temp, '\0', 130); // use sscanf to extract what we need : //
37 sscanf(str, "%*[^:] %*s %[^\n]",temp); // ignore all up till :, then ignore the :, then use what's left //
38 printf(" CPU type : %s \n", temp); // till the newline char //
39 fgets(str, 299, cpuinfo_fp);
40 @@ -67,13 +69,13 @@ int Show_CPU_Info()
41 Show_Freq_Info(); // show freq scaling info if we have it //
42 else
43 {
44 - bzero(temp, 130);
45 + memset(temp, '\0', 130);
46 sscanf(str, "%*[^:] %*s %s",temp); // ignore all up till :, then ignore the :, then use what's left //
47 printf(" CPU speed : %s MHz \n", temp);
48 }
49
50 fgets(str, 299, cpuinfo_fp);
51 - bzero(temp, 130);
52 + memset(temp, '\0', 130);
53 sscanf(str, "%*[^:] %*s %s",temp);
54 printf(" Cache size : %s KB\n", temp);
55
56 @@ -82,7 +84,7 @@ int Show_CPU_Info()
57 while(!feof(cpuinfo_fp)) // Run loop until Bogomips line is found //
58 { // Need this generic aproach: the bogomips location is //
59 fgets(str, 299, cpuinfo_fp); // different for Amd64, Opteron, Core Duo, P4 with Ht, ... //
60 - bzero(temp, 130);
61 + memset(temp, '\0', 130);
62 if(strncmp(str,"bogo",4)==0)
63 {
64 sscanf(str, "%*[^:] %*s %s",temp);
65 @@ -153,23 +155,23 @@ int Show_CPU_Info()
66 if(file_in)
67 {
68 file_in.getline(str, 90); // processor id
69 - bzero(temp, 130);
70 + memset(temp, '\0', 130);
71 strncpy(temp, str+25, 5);
72 cout<<" Processor ID : "<<temp<<endl;
73
74 file_in.getline(str, 100); // acpi id
75 file_in.getline(str, 100); // bus mastering control
76 - bzero(temp, 130);
77 + memset(temp, '\0', 130);
78 strncpy(temp, str+25, 5);
79 cout<<" Bus mastering control : "<<temp<<endl;
80
81 file_in.getline(str, 100); // power management
82 - bzero(temp, 130);
83 + memset(temp, '\0', 130);
84 strncpy(temp, str+25, 5);
85 cout<<" Power management : "<<temp<<endl;
86
87 file_in.getline(str, 100); // throttling control
88 - bzero(temp, 130);
89 + memset(temp, '\0', 130);
90 strncpy(temp, str+25, 5);
91 cout<<" Throttling control : "<<temp<<endl;
92 if(strncmp(temp,"yes",3)==0)
93 @@ -177,7 +179,7 @@ int Show_CPU_Info()
94
95 file_in.getline(str, 100); // limit interface (beware: on linux2.4
96 // this line yields "perf mgmt")
97 - bzero(temp, 130);
98 + memset(temp, '\0', 130);
99 strncpy(temp, str+25, 5);
100 cout<<" Limit interface : "<<temp<<endl;
101
102 @@ -196,7 +198,7 @@ int Show_CPU_Info()
103 if(power_fp)
104 {
105 fgets(str, 100, power_fp); // active state
106 - bzero(temp, 80);
107 + memset(temp, '\0', 80);
108 strncpy(temp, str+25, 5);
109 cout<<" Active C-state : "<<temp;
110
111 @@ -268,11 +270,11 @@ int Show_CPU_Info()
112 if(throt_fp)
113 {
114 fgets(str, 100, throt_fp); // active state
115 - bzero(temp, 80);
116 + memset(temp, '\0', 80);
117 strncpy(temp, str+25, 5);
118 cout<<" T-state count : "<<temp; // number of throttling states //
119 fgets(str, 100, throt_fp);
120 - bzero(temp, 80);
121 + memset(temp, '\0', 80);
122 strncpy(temp, str+25, 5);
123 cout<<" Active T-state : "<<temp<<endl;
124 fclose(throt_fp);
125 --- acpitool-0.4.7/src/main.cpp.gcc43
126 +++ acpitool-0.4.7/src/main.cpp
127 @@ -27,6 +27,7 @@
128 #include <config.h>
129 #endif
130
131 +#include <cstdlib>
132 #include <iostream>
133 #include <iomanip>
134 #include <fstream>
135 --- acpitool-0.4.7/src/toshiba.cpp.gcc43
136 +++ acpitool-0.4.7/src/toshiba.cpp
137 @@ -28,6 +28,7 @@
138 #include <config.h>
139 #endif
140
141 +#include <cstring>
142 #include <iostream>
143 #include <iomanip>
144 #include <fstream>
145 --- acpitool-0.4.7/src/battery.cpp.gcc43
146 +++ acpitool-0.4.7/src/battery.cpp
147 @@ -27,6 +27,8 @@
148 #include <config.h>
149 #endif
150
151 +#include <cstdlib>
152 +#include <cstring>
153 #include <iostream>
154 #include <iomanip>
155 #include <fstream>
156 @@ -69,15 +71,15 @@ int Do_Battery_Stuff(int show_empty, int
157 Batt_Info[i] = new Battery_Info;
158
159 Batt_Info[i]->Battery_Present = 0;
160 - bzero(Batt_Info[i]->Remaining_Cap, 10);
161 - bzero(Batt_Info[i]->Design_Cap, 10);
162 - bzero(Batt_Info[i]->LastFull_Cap, 10);
163 - bzero(Batt_Info[i]->Present_Rate, 10);
164 - bzero(Batt_Info[i]->Charging_State, 12);
165 - bzero(Batt_Info[i]->Technology, 13);
166 - bzero(Batt_Info[i]->Model, 13);
167 - bzero(Batt_Info[i]->Serial, 13);
168 - bzero(Batt_Info[i]->Bat_Type, 13);
169 + memset(Batt_Info[i]->Remaining_Cap, '\0', 10);
170 + memset(Batt_Info[i]->Design_Cap, '\0', 10);
171 + memset(Batt_Info[i]->LastFull_Cap, '\0', 10);
172 + memset(Batt_Info[i]->Present_Rate, '\0', 10);
173 + memset(Batt_Info[i]->Charging_State, '\0', 12);
174 + memset(Batt_Info[i]->Technology, '\0', 13);
175 + memset(Batt_Info[i]->Model, '\0', 13);
176 + memset(Batt_Info[i]->Serial, '\0', 13);
177 + memset(Batt_Info[i]->Bat_Type, '\0', 13);
178 // initialize all struct members to blanks --> avoid rubbish in output //
179
180 Get_Battery_Info(Bat_Nr, Batt_Info[i], verbose);
181 --- acpitool-0.4.7/src/thinkpad.cpp.gcc43
182 +++ acpitool-0.4.7/src/thinkpad.cpp
183 @@ -1,5 +1,7 @@
184 /* support for IBM Thinkpad acpi driver */
185
186 +#include <cstdlib>
187 +#include <cstring>
188 #include <iomanip>
189 #include <iostream>
190 #include <fstream>
191 --- acpitool-0.4.7/src/freq.cpp.gcc43
192 +++ acpitool-0.4.7/src/freq.cpp
193 @@ -27,6 +27,8 @@
194 #include <config.h>
195 #endif
196
197 +#include <cstdlib>
198 +#include <cstring>
199 #include <iostream>
200 #include <iomanip>
201 #include <fstream>
202 @@ -86,7 +88,7 @@ int Get_Min_Freq()
203
204 if(freqinfo_fp)
205 {
206 - bzero(str, 300);
207 + memset(str, '\0', 300);
208 fscanf(freqinfo_fp, "%s", str);
209 min_freq = atoi(str);
210 fclose(freqinfo_fp);
211 @@ -110,7 +112,7 @@ int Get_Max_Freq()
212
213 if(freqinfo_fp)
214 {
215 - bzero(str, 300);
216 + memset(str, '\0', 300);
217 fscanf(freqinfo_fp, "%s", str);
218 max_freq = atoi(str);
219 fclose(freqinfo_fp);
220 @@ -133,7 +135,7 @@ int Get_Current_Freq()
221
222 if(freqinfo_fp)
223 {
224 - bzero(str, 300);
225 + memset(str, '\0', 300);
226 fscanf(freqinfo_fp, "%s", str);
227 cur_freq = atoi(str);
228 fclose(freqinfo_fp);
229 @@ -155,7 +157,7 @@ int Get_Governor(char *c)
230
231 if(freqinfo_fp)
232 {
233 - bzero(str, 300);
234 + memset(str, '\0', 300);
235 fscanf(freqinfo_fp, "%s", str);
236 if (strlen(str)>0)
237 strcpy(c, str);
238 @@ -178,7 +180,7 @@ int Get_Driver(char *c)
239
240 if(freqinfo_fp)
241 {
242 - bzero(str, 300);
243 + memset(str, '\0', 300);
244 fscanf(freqinfo_fp, "%s", str);
245 if (strlen(str)>0)
246 strcpy(c, str);
247 --- acpitool-0.4.7/src/acpitool.cpp.gcc43
248 +++ acpitool-0.4.7/src/acpitool.cpp
249 @@ -28,6 +28,8 @@
250 #include <config.h>
251 #endif
252
253 +#include <cstring>
254 +#include <cstdlib>
255 #include <iostream>
256 #include <iomanip>
257 #include <fstream>
258 @@ -158,8 +160,8 @@ int Do_SysVersion_Info(int verbose)
259 {
260 char Acpi_Version[10], Kernel_Version[15];
261
262 - bzero(Acpi_Version, 10);
263 - bzero(Kernel_Version, 15);
264 + memset(Acpi_Version, '\0', 10);
265 + memset(Kernel_Version, '\0', 15);
266
267 Get_Kernel_Version(Kernel_Version, verbose);
268 Get_ACPI_Version(Acpi_Version, verbose);
269 @@ -214,8 +216,8 @@ int Do_Thermal_Info(const int show_trip,
270 char *name;
271 char Temperature[5], State[5];
272
273 - bzero(Temperature, 5);
274 - bzero(State, 5);
275 + memset(Temperature, '\0', 5);
276 + memset(State, '\0', 5);
277
278 dirname = "/proc/acpi/thermal_zone/";
279 thermal_dir = opendir(dirname);
280 @@ -299,7 +301,7 @@ int Do_Thermal_Info(const int show_trip,
281 while(!feof(fp))
282 {
283 /* fscanf(fp, "%s", str); */
284 - bzero(str, 120);
285 + memset(str, '\0', 120);
286 fgets(str, 120, fp);
287 if (strlen(str)!=0)
288 cout<<" "<<str; /* avoid printing empty line */
289 @@ -328,7 +330,7 @@ int Do_AC_Info(int verbose)
290 char *name;
291 char AC_Status[9];
292
293 - bzero(AC_Status, 9); // avoid rubbish in output //
294 + memset(AC_Status, '\0', 9); // avoid rubbish in output //
295
296 dirname = "/proc/acpi/ac_adapter/";
297 ac_dir = opendir(dirname);
298 @@ -402,7 +404,7 @@ int Do_Fan_Info(int verbose)
299 return 0;
300 }
301
302 - bzero(FAN_Status, 9); // avoid rubbish in output //
303 + memset(FAN_Status, '\0', 9); // avoid rubbish in output //
304
305 dirname = "/proc/acpi/fan/";
306 fan_dir = opendir(dirname);
307 @@ -531,7 +533,7 @@ int Toggle_WakeUp_Device(const int Devic
308 file_in.getline(str, 50);
309 if(strlen(str)!=0) // avoid empty last line //
310 {
311 - bzero(Name[index], 5);
312 + memset(Name[index], '\0', 5);
313 strncpy(Name[index], str, 4);
314 index++;
315 }
316
317
318
319 --
320 gentoo-commits@l.g.o mailing list