fix gcc 4.3.2 rpm build
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@651 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
456386aac0
commit
a1f6e0ddfa
|
@ -8,9 +8,13 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map
|
||||||
{
|
{
|
||||||
struct ttmp *tmp = ts->user_data;
|
struct ttmp *tmp = ts->user_data;
|
||||||
int wrote;
|
int wrote;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
wrote = teletone_mux_tones(ts, map);
|
wrote = teletone_mux_tones(ts, map);
|
||||||
write(tmp->fd, ts->buffer, wrote * 2);
|
len = write(tmp->fd, ts->buffer, wrote * 2);
|
||||||
|
|
||||||
|
if (!len) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +53,7 @@ int32_t main(int argc, char *argv[])
|
||||||
int32_t durations[] = {274, 274, 380, 0};
|
int32_t durations[] = {274, 274, 380, 0};
|
||||||
teletone_dds_state_t dds = {0};
|
teletone_dds_state_t dds = {0};
|
||||||
int16_t sample;
|
int16_t sample;
|
||||||
|
size_t len = 1;
|
||||||
|
|
||||||
if (argc < 2 || (fd = open(argv[1], O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR)) < 0) {
|
if (argc < 2 || (fd = open(argv[1], O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR)) < 0) {
|
||||||
fprintf(stderr, "File Error!\n", strerror(errno));
|
fprintf(stderr, "File Error!\n", strerror(errno));
|
||||||
|
@ -59,9 +64,9 @@ int32_t main(int argc, char *argv[])
|
||||||
|
|
||||||
teletone_dds_state_set_tone(&dds, tones[j], rate, -50);
|
teletone_dds_state_set_tone(&dds, tones[j], rate, -50);
|
||||||
|
|
||||||
for(i = 0; i < durations[j] * rate / 1000; i++) {
|
for(i = 0; (i < durations[j] * rate / 1000) && len != 0; i++) {
|
||||||
sample = teletone_dds_modulate_sample(&dds) * 20;
|
sample = teletone_dds_modulate_sample(&dds) * 20;
|
||||||
write(fd, &sample, sizeof(sample));
|
len = write(fd, &sample, sizeof(sample));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue