[xiph-commits] r18425 - trunk/spectrum

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Jun 24 23:33:02 PDT 2012


Author: xiphmont
Date: 2012-06-24 23:33:02 -0700 (Sun, 24 Jun 2012)
New Revision: 18425

Modified:
   trunk/spectrum/version.h
   trunk/spectrum/wave_plot.c
Log:
Guard overflowing X protocol coordinate shorts when drawing overrange
signals in waveform; GDK does not guard this.



Modified: trunk/spectrum/version.h
===================================================================
--- trunk/spectrum/version.h	2012-06-25 06:20:46 UTC (rev 18424)
+++ trunk/spectrum/version.h	2012-06-25 06:33:02 UTC (rev 18425)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Mon Jun 25 02:18:07 EDT 2012] */
+/* DO NOT EDIT: Automated versioning hack [Mon Jun 25 02:30:07 EDT 2012] */

Modified: trunk/spectrum/wave_plot.c
===================================================================
--- trunk/spectrum/wave_plot.c	2012-06-25 06:20:46 UTC (rev 18424)
+++ trunk/spectrum/wave_plot.c	2012-06-25 06:33:02 UTC (rev 18425)
@@ -258,6 +258,10 @@
                 int x1 = rintf(k*spani);
                 float y1 = data[k]*ym;
 
+                /* clamp for shorts in the X protocol; gdk does not guard */
+                if(y1>20000.f)y1=20000.f;
+                if(y1<-20000.f)y1=-20000.f;
+
                 if(x1>x0){
                   if(acc>1){
                     if(!isnan(yL)&&!isnan(yH))
@@ -306,6 +310,10 @@
                 int x1 = rintf(k*spani);
                 float y1 = data[k]*ym;
 
+                /* clamp for shorts in the X protocol; gdk does not guard */
+                if(y1>20000.f)y1=20000.f;
+                if(y1<-20000.f)y1=-20000.f;
+
                 if(x1>x0){
                   if(acc>1){
                     if(!isnan(yL) && !isnan(yH))
@@ -355,6 +363,10 @@
                 int x1 = rintf(k*spani);
                 float y1 = data[k]*ym;
 
+                /* clamp for shorts in the X protocol; gdk does not guard */
+                if(y1>20000.f)y1=20000.f;
+                if(y1<-20000.f)y1=-20000.f;
+
                 if(x1>x0){
                   if(!isnan(yL) || !isnan(yH)){
                     if(isnan(yL) || yL>0)yL=pp->bold;
@@ -388,6 +400,11 @@
               for(k=0;k<spann;k++){
                 int x = rintf(k*spani);
                 float y = data[k]*ym;
+
+                /* clamp for shorts in the X protocol; gdk does not guard */
+                if(y>20000.f)y=20000.f;
+                if(y<-20000.f)y=-20000.f;
+
                 if(!isnan(y)){
                   gdk_draw_arc(p->backing,p->twogc,
                                0,x+padx-5,rintf(y+cp-5),



More information about the commits mailing list