Removing warnings with unsafe sprintf().

preferencesAboutTextFull
Aleksei Kanash 13 years ago
parent a5bdc4f58a
commit 4be7a79c56
  1. 15
      src/adaptors/UBSvgSubsetAdaptor.h

@ -171,20 +171,15 @@ class UBSvgSubsetAdaptor
int pointsCount = crashedPoints.size(); int pointsCount = crashedPoints.size();
QString svgPoints; QString svgPoints;
static const int maxBufferLengthPerPoint = 30;
int maxBufferLength = maxBufferLengthPerPoint * pointsCount;
char *buffer = new char[maxBufferLength];
int length = 0; int length = 0;
QString sBuf;
for(int j = 0; j < pointsCount; j++) for(int j = 0; j < pointsCount; j++)
{ {
const QPointF & point = crashedPoints.at(j); const QPointF & point = crashedPoints.at(j);
int n = sprintf(buffer + length, "%.2f,%.2f ", point.x(), point.y()); sBuf.sprintf("%.2f,%.2f ", point.x(), point.y());
length += n; svgPoints.insert(length, sBuf);
length += sBuf.length();
} }
svgPoints = QString::fromAscii(buffer, length);
delete buffer;
return svgPoints; return svgPoints;
} }

Loading…
Cancel
Save