X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tools%2FDisplay%2Fdisplayprojection.cpp;h=599ab6e285cd394c0b13bcd8cb3fc0bfceea5fcc;hb=655b8062715746e7734a01c5a58d7d01e93caf94;hp=c4773939193d537cb14c6988174b6acb91e87653;hpb=14d94bcf06d0e21bc36fbf9b6678f4d0ca19330f;p=snark14.git diff --git a/tools/Display/displayprojection.cpp b/tools/Display/displayprojection.cpp index c477393..599ab6e 100644 --- a/tools/Display/displayprojection.cpp +++ b/tools/Display/displayprojection.cpp @@ -162,7 +162,7 @@ displayprojection::displayprojection(QWidget* parent, const char* name, bool mod lowthresh = new QLineEdit(this, "lowthresh"); lowthresh->setGeometry(QRect(5, 260, 80, 30)); - char s[16]; + char s[12]; snprintf(s,sizeof(s)-1,"%7.4f", minval); lowthresh->setText(s); @@ -184,7 +184,7 @@ displayprojection::displayprojection(QWidget* parent, const char* name, bool mod highthresh = new QLineEdit(this, "highthresh"); highthresh->setGeometry(QRect(5, 355, 80, 30)); - sprintf(s, "%7.4f", maxval); + snprintf(s, sizeof(s)-1, "%7.4f", maxval); highthresh->setText(s); sethighthreshbutton = new QPushButton(this, "sethighthreshbutton"); @@ -248,16 +248,16 @@ void displayprojection::updateClickedPixel(int cx, int cy) { ix = cx / zoomval; iy = cy / zoomval; - sprintf(s, "(%d,%d)", ix, iy); + snprintf(s, sizeof(s)-1, "(%d,%d)", ix, iy); pixelpos->setText(s); - sprintf(s, "%7.4f", proj[ix][iy]); + snprintf(s, sizeof(s)-1, "%7.4f", proj[ix][iy]); pixelvalue->setText(s); } void displayprojection::updateZoom() { - char s[4]; + char s[7]; int v = zoomslider->value(); - sprintf(s, "%d", v); + snprintf(s, sizeof(s)-1, "%d", v); zoom->setText(s); zoomval = v; displaywidget->resize(prjnum*zoomval, usrays * zoomval); @@ -307,7 +307,7 @@ void displayprojection::updateLowthresh() { } double fv = ((double) v) / 1000; lowthreshold = fv; - sprintf(s, "%7.4f", fv); + snprintf(s, sizeof(s)-1, "%7.4f", fv); lowthresh->setText(s); resetImage(); } @@ -349,7 +349,7 @@ void displayprojection::updateHighthresh() { } double fv = ((double) v) / 1000; highthreshold = fv; - sprintf(s, "%7.4f", fv); + snprintf(s, sizeof(s)-1, "%7.4f", fv); highthresh->setText(s); resetImage(); }