mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #22149 from seanm:sprintf
Replaced sprintf with safer snprintf * Straightforward replacement of sprintf with safer snprintf * Trickier replacement of sprintf with safer snprintf Some functions were changed to take another parameter: the size of the buffer, so that they can pass that size on to snprintf.
This commit is contained in:
@@ -258,22 +258,22 @@ public:
|
||||
int y = 0;
|
||||
|
||||
buf[0] = 0;
|
||||
sprintf(buf, "mode: %s", m_modeStr[mode].c_str());
|
||||
snprintf(buf, sizeof(buf), "mode: %s", m_modeStr[mode].c_str());
|
||||
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
|
||||
|
||||
y += tm.tmHeight;
|
||||
buf[0] = 0;
|
||||
sprintf(buf, m_demo_processing ? "blur frame" : "copy frame");
|
||||
snprintf(buf, sizeof(buf), m_demo_processing ? "blur frame" : "copy frame");
|
||||
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
|
||||
|
||||
y += tm.tmHeight;
|
||||
buf[0] = 0;
|
||||
sprintf(buf, "time: %4.1f msec", time);
|
||||
snprintf(buf, sizeof(buf), "time: %4.1f msec", time);
|
||||
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
|
||||
|
||||
y += tm.tmHeight;
|
||||
buf[0] = 0;
|
||||
sprintf(buf, "OpenCL device: %s", oclDevName.c_str());
|
||||
snprintf(buf, sizeof(buf), "OpenCL device: %s", oclDevName.c_str());
|
||||
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
|
||||
|
||||
::SelectObject(hDC, hOldFont);
|
||||
|
||||
Reference in New Issue
Block a user