LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File xosview-1.9.2-longint.patch of Package xosview (Project X11:Utilities)

--- linux/intmeter.cc
+++ linux/intmeter.cc	2012-02-08 10:38:29.000000000 +0100
@@ -17,11 +17,11 @@
 static const char *INTFILE     = "/proc/interrupts";
 static const char *VERSIONFILE = "/proc/version";
 
-std::map<int,int> realintnum;
+std::map<const int,int> realintnum;
 
 IntMeter::IntMeter( XOSView *parent, int cpu)
   : BitMeter( parent, "INTS", "", 1,
-              0, 0 ), _cpu(cpu), _old(true) {
+              0, 0 ), _cpu(cpu), _old(true), max(1024) {
  if (getLinuxVersion() <= 2.0)
  	_old = true;
  else
@@ -91,10 +91,12 @@ void IntMeter::getirqs( void ){
   }
 
   if (!_old)
-      intfile.ignore(1024, '\n');
+      intfile.ignore(max, '\n');
 
   while ( !intfile.eof() ){
     intfile >> idx;
+    if (idx >= max)
+	break;
     intno = realintnum[idx];
     if(intno>=numBits())
     	updateirqcount(intno,false);
@@ -103,7 +105,7 @@ void IntMeter::getirqs( void ){
     if ( !intfile.eof() ){
       for (int i = 0 ; i <= _cpu ; i++)
           intfile >>count;
-      intfile.ignore(1024, '\n');
+      intfile.ignore(max, '\n');
 
       irqs_[intno] = count;
     }
@@ -170,7 +172,7 @@ void IntMeter::initirqcount( void ){
   if (!_old) {
     for (i=0; i<16; i++)
       realintnum[i] = i;
-    intfile.ignore(1024, '\n');
+    intfile.ignore(max, '\n');
   }
 
   /* just looking for the highest number interrupt that
@@ -187,7 +189,7 @@ void IntMeter::initirqcount( void ){
 	intno = idx;
 	realintnum[i] = idx++;
     }
-    intfile.ignore(1024, '\n');
+    intfile.ignore(max, '\n');
   }
   updateirqcount(intno, true);
 }
--- linux/intmeter.h
+++ linux/intmeter.h	2012-02-08 09:37:34.843758155 +0000
@@ -26,6 +26,7 @@ protected:
 
   int _cpu;
   bool _old;
+  const int max;
 
   void getirqs( void );
   void updateirqcount( int n, bool init );