Use snprintf() instead of sprintf() (#5907)
This commit is contained in:
@@ -390,7 +390,7 @@ Glib::ustring BatchQueue::getTempFilenameForParams( const Glib::ustring &filenam
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
char mseconds[11];
|
||||
sprintf(mseconds, "%d", (int)(tv.tv_usec / 1000));
|
||||
snprintf(mseconds, sizeof(mseconds), "%d", (int)(tv.tv_usec / 1000));
|
||||
time_t rawtime;
|
||||
struct tm *timeinfo;
|
||||
char stringTimestamp [80];
|
||||
|
||||
@@ -125,13 +125,13 @@ void CropWindow::initZoomSteps()
|
||||
char lbl[64];
|
||||
for (int s = 100; s >= 11; --s) {
|
||||
float z = 10.f / s;
|
||||
sprintf(lbl, "% 2d%%", int(z * 100));
|
||||
snprintf(lbl, sizeof(lbl), "% 2d%%", int(z * 100));
|
||||
bool is_major = (s == s/10 * 10);
|
||||
zoomSteps.push_back(ZoomStep(lbl, z, s, is_major));
|
||||
}
|
||||
zoom11index = zoomSteps.size();
|
||||
for (int s = 1; s <= 8; ++s) {
|
||||
sprintf(lbl, "%d00%%", s);
|
||||
snprintf(lbl, sizeof(lbl), "%d00%%", s);
|
||||
zoomSteps.push_back(ZoomStep(lbl, s, s * 1000, true));
|
||||
}
|
||||
zoomSteps.push_back(ZoomStep("1600%", 16, 16000, true));
|
||||
|
||||
@@ -424,8 +424,8 @@ void ICMPanel::updateDCP(int dcpIlluminant, Glib::ustring dcp_name)
|
||||
if (illuminants.will_interpolate) {
|
||||
if (dcpTemperatures[0] != illuminants.temperature_1 || dcpTemperatures[1] != illuminants.temperature_2) {
|
||||
char tempstr1[64], tempstr2[64];
|
||||
sprintf(tempstr1, "%.0fK", illuminants.temperature_1);
|
||||
sprintf(tempstr2, "%.0fK", illuminants.temperature_2);
|
||||
snprintf(tempstr1, sizeof(tempstr1), "%.0fK", illuminants.temperature_1);
|
||||
snprintf(tempstr2, sizeof(tempstr2), "%.0fK", illuminants.temperature_2);
|
||||
int curr_active = dcpIll->get_active_row_number();
|
||||
dcpIll->remove_all();
|
||||
dcpIll->append(M("TP_ICM_DCPILLUMINANT_INTERPOLATED"));
|
||||
|
||||
@@ -460,7 +460,7 @@ int main (int argc, char **argv)
|
||||
SetConsoleCtrlHandler ( NULL, true );
|
||||
// Set title of console
|
||||
char consoletitle[128];
|
||||
sprintf (consoletitle, "RawTherapee %s Console", RTVERSION);
|
||||
snprintf(consoletitle, sizeof(consoletitle), "RawTherapee %s Console", RTVERSION);
|
||||
SetConsoleTitle (consoletitle);
|
||||
// increase size of screen buffer
|
||||
COORD c;
|
||||
|
||||
Reference in New Issue
Block a user