Transport Masters dialog: don't use an uninitialized char array.
This commit is contained in:
parent
26dbd30ae6
commit
20c09ccfc3
|
@ -601,7 +601,7 @@ TransportMastersWidget::Row::update (Session* s, samplepos_t now)
|
||||||
string last_str(" --:--:--:--");
|
string last_str(" --:--:--:--");
|
||||||
string current_str(" --:--:--:--");
|
string current_str(" --:--:--:--");
|
||||||
string delta_str("\u0394 0");
|
string delta_str("\u0394 0");
|
||||||
char gap[32];
|
string gap_str;
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
|
|
||||||
|
@ -623,6 +623,7 @@ TransportMastersWidget::Row::update (Session* s, samplepos_t now)
|
||||||
|
|
||||||
delta_str = tm->delta_string ();
|
delta_str = tm->delta_string ();
|
||||||
|
|
||||||
|
char gap[32];
|
||||||
float seconds = (when - now) / (float) AudioEngine::instance()->sample_rate();
|
float seconds = (when - now) / (float) AudioEngine::instance()->sample_rate();
|
||||||
if (seconds < 0.) {
|
if (seconds < 0.) {
|
||||||
seconds = 0.;
|
seconds = 0.;
|
||||||
|
@ -637,11 +638,13 @@ TransportMastersWidget::Row::update (Session* s, samplepos_t now)
|
||||||
snprintf (gap, sizeof (gap), "%-3dh", (int) floor (seconds/60/60));
|
snprintf (gap, sizeof (gap), "%-3dh", (int) floor (seconds/60/60));
|
||||||
}
|
}
|
||||||
save_when = when;
|
save_when = when;
|
||||||
|
gap_str = gap;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (save_when) {
|
if (save_when) {
|
||||||
|
|
||||||
|
char gap[32];
|
||||||
const float seconds = (when - now) / (float) AudioEngine::instance()->sample_rate();
|
const float seconds = (when - now) / (float) AudioEngine::instance()->sample_rate();
|
||||||
if (abs (seconds) < 1.0) {
|
if (abs (seconds) < 1.0) {
|
||||||
snprintf (gap, sizeof (gap), "%-.03fs", seconds);
|
snprintf (gap, sizeof (gap), "%-.03fs", seconds);
|
||||||
|
@ -653,11 +656,11 @@ TransportMastersWidget::Row::update (Session* s, samplepos_t now)
|
||||||
snprintf (gap, sizeof (gap), "%-3dh", (int) floor (seconds/60/60));
|
snprintf (gap, sizeof (gap), "%-3dh", (int) floor (seconds/60/60));
|
||||||
}
|
}
|
||||||
save_when = when;
|
save_when = when;
|
||||||
|
gap_str = gap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//pad the gap to 9 chars
|
//pad the gap to 9 chars
|
||||||
string gap_str(gap);
|
|
||||||
int len = gap_str.length();
|
int len = gap_str.length();
|
||||||
for (int i = len; i<9; i++)
|
for (int i = len; i<9; i++)
|
||||||
gap_str = " " + gap_str;
|
gap_str = " " + gap_str;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user