mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
fix sprintf overflow warning from clang on macOS
This commit is contained in:
parent
f3d099f83f
commit
db30a7d040
1 changed files with 4 additions and 4 deletions
|
|
@ -1401,18 +1401,18 @@ SoundFileBrowser::handle_freesound_results(std::string theString) {
|
||||||
|
|
||||||
double duration_seconds = atof (duration);
|
double duration_seconds = atof (duration);
|
||||||
double h, m, s;
|
double h, m, s;
|
||||||
char duration_hhmmss[16];
|
char duration_hhmmss[32];
|
||||||
if (duration_seconds > 99 * 60 * 60) {
|
if (duration_seconds > 99 * 60 * 60) {
|
||||||
strcpy(duration_hhmmss, ">99h");
|
strcpy(duration_hhmmss, ">99h");
|
||||||
} else {
|
} else {
|
||||||
s = modf(duration_seconds/60, &m) * 60;
|
s = modf(duration_seconds/60, &m) * 60;
|
||||||
m = modf(m/60, &h) * 60;
|
m = modf(m/60, &h) * 60;
|
||||||
if (h > 0) {
|
if (h > 0) {
|
||||||
sprintf(duration_hhmmss, "%2.fh:%02.fm:%04.1fs", h, m, s);
|
snprintf(duration_hhmmss, sizeof (duration), "%2.fh:%02.fm:%04.1fs", h, m, s);
|
||||||
} else if (m > 0) {
|
} else if (m > 0) {
|
||||||
sprintf(duration_hhmmss, "%2.fm:%04.1fs", m, s);
|
snprintf(duration_hhmmss, sizeof (duration), "%2.fm:%04.1fs", m, s);
|
||||||
} else {
|
} else {
|
||||||
sprintf(duration_hhmmss, "%4.1fs", s);
|
snprintf(duration_hhmmss, sizeof (duration), "%4.1fs", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue