File: patch-sunos5_cpumeter_cc

package info (click to toggle)
xosview 1.8.3%2Bdebian-9
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,788 kB
  • ctags: 1,428
  • sloc: cpp: 9,506; sh: 4,257; ansic: 368; makefile: 89; awk: 20
file content (35 lines) | stat: -rw-r--r-- 832 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
$NetBSD$

--- sunos5/cpumeter.cc.orig	1999-01-31 21:26:38.000000000 +0100
+++ sunos5/cpumeter.cc	2005-02-22 14:44:47.640675500 +0100
@@ -8,7 +8,10 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <string.h>
-#include <strstream.h>
+#include <sstream>
+
+#define ostrstream std::ostringstream
+using std::ends;
 
 CPUMeter::CPUMeter(XOSView *parent, kstat_ctl_t *_kc, int cpuid)
 	: FieldMeterGraph(parent, CPU_STATES, toUpper(cpuStr(cpuid)),
@@ -91,15 +94,15 @@ const char *CPUMeter::toUpper(const char
 
 const char *CPUMeter::cpuStr(int num)
 {
-	static char buffer[32];
-	ostrstream str(buffer, 32);
+	static std::string buffer;
+	std::ostringstream str(buffer);
 
 	str << "cpu";
 	if (num != 0)
 		str << (num - 1);
 	str << ends;
 
-	return buffer;
+	return buffer.c_str();
 }
 
 int CPUMeter::countCPUs(kstat_ctl_t *kc)