utils.(tpl|def) : Make the test_write_*_or_die() functions const safe.

This commit is contained in:
Erik de Castro Lopo 2005-09-22 10:52:36 +00:00
parent 82e03ebe7f
commit 73cd4f04b4
3 changed files with 45 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2005-09-22 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* tests/util.(tpl|def)
Make the test_write_*_or_die() functions const safe.
2005-09-21 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/nist.c

View File

@ -10,48 +10,48 @@ float_type = {
/*----------------------------------*/
io_type = {
io_type = {
io_element = short ;
format_str = "\"% d\\n\"" ;
};
io_type = {
io_type = {
io_element = int ;
format_str = "\"% d\\n\"" ;
};
io_type = {
io_type = {
io_element = float ;
format_str = "\"% g\\n\"" ;
};
io_type = {
io_type = {
io_element = double ;
format_str = "\"% g\\n\"" ;
};
io_operation = {
read_op = {
op_element = read ;
count_name = items ;
};
io_operation = {
read_op = {
op_element = readf ;
count_name = frames ;
};
io_operation = {
write_op = {
op_element = write ;
count_name = items ;
};
io_operation = {
write_op = {
op_element = writef ;
count_name = frames ;
};
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 735898a2-711e-42c2-aaf1-354b20c07ac7

View File

@ -78,11 +78,17 @@ void test_read_write_position_or_die
void test_seek_or_die
(SNDFILE *file, sf_count_t offset, int whence, sf_count_t new_pos, int channels, int line_num) ;
[+ FOR io_operation +]
[+ FOR read_op +]
[+ FOR io_type
+]void test_[+ (get "op_element") +]_[+ (get "io_element") +]_or_die
(SNDFILE *file, int pass, [+ (get "io_element") +] *test, sf_count_t [+ (get "count_name") +], int line_num) ;
[+ ENDFOR io_type +][+ ENDFOR io_operation +]
[+ ENDFOR io_type +][+ ENDFOR read_op +]
[+ FOR write_op +]
[+ FOR io_type
+]void test_[+ (get "op_element") +]_[+ (get "io_element") +]_or_die
(SNDFILE *file, int pass, const [+ (get "io_element") +] *test, sf_count_t [+ (get "count_name") +], int line_num) ;
[+ ENDFOR io_type +][+ ENDFOR write_op +]
#endif
@ -514,7 +520,7 @@ test_seek_or_die (SNDFILE *file, sf_count_t offset, int whence, sf_count_t new_p
} /* test_seek_or_die */
[+ FOR io_operation +]
[+ FOR read_op +]
[+ FOR io_type +]
void
test_[+ (get "op_element") +]_[+ (get "io_element") +]_or_die (SNDFILE *file, int pass, [+ (get "io_element") +] *test, sf_count_t [+ (get "count_name") +], int line_num)
@ -533,7 +539,28 @@ test_[+ (get "op_element") +]_[+ (get "io_element") +]_or_die (SNDFILE *file, in
return ;
} /* test_[+ (get "op_element") +]_[+ (get "io_element") +] */
[+ ENDFOR io_type +][+ ENDFOR io_operation +]
[+ ENDFOR io_type +][+ ENDFOR read_op +]
[+ FOR write_op +]
[+ FOR io_type +]
void
test_[+ (get "op_element") +]_[+ (get "io_element") +]_or_die (SNDFILE *file, int pass, const [+ (get "io_element") +] *test, sf_count_t [+ (get "count_name") +], int line_num)
{ sf_count_t count ;
if ((count = sf_[+ (get "op_element") +]_[+ (get "io_element") +] (file, test, [+ (get "count_name") +])) != [+ (get "count_name") +])
{ printf ("\n\nLine %d", line_num) ;
if (pass > 0)
printf (" (pass %d)", pass) ;
printf (" : sf_[+ (get "op_element") +]_[+ (get "io_element") +] failed with short [+ (get "op_element") +] (%ld => %ld).\n",
SF_COUNT_TO_LONG ([+ (get "count_name") +]), SF_COUNT_TO_LONG (count)) ;
fflush (stdout) ;
puts (sf_strerror (file)) ;
exit (1) ;
} ;
return ;
} /* test_[+ (get "op_element") +]_[+ (get "io_element") +] */
[+ ENDFOR io_type +][+ ENDFOR write_op +]
void
delete_file (int format, const char *filename)