Lines Matching refs:file

71 static void		check_comment (SNDFILE * file, int format, int lineno) ;
75 static int check_opus_version (SNDFILE *file) ;
95 "to screw up the encoders and decoders if the file container format does "
98 "the end of the file." ;
108 printf (" wav_ima - test IMA ADPCM WAV file functions\n") ;
109 printf (" wav_msadpcm - test MS ADPCM WAV file functions\n") ;
110 printf (" wav_gsm610 - test GSM 6.10 WAV file functions\n") ;
111 printf (" wav_ulaw - test u-law WAV file functions\n") ;
112 printf (" wav_alaw - test A-law WAV file functions\n") ;
113 printf (" wve - test Psion WVE file functions\n") ;
135 /* For all the rest, if the file format supports more than 1 channel, use stereo. */
650 { SNDFILE *file ;
673 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
674 test_writef_short_or_die (file, 0, orig, datalen, __LINE__) ;
675 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
676 sf_close (file) ;
683 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
691 { printf ("Too few frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
696 { printf ("Too many frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
701 { printf ("Incorrect number of channels in file.\n") ;
705 check_log_buffer_or_die (file, __LINE__) ;
707 check_comment (file, filetype, __LINE__) ;
709 test_readf_short_or_die (file, 0, data, datalen, __LINE__) ;
726 if ((k = (int) sf_readf_short (file, data, datalen)) != sfinfo.frames - datalen)
733 ** to the end of a file so as to fill out a block.
742 { sf_close (file) ;
750 if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
751 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
756 { test_readf_short_or_die (file, m, data, 11, __LINE__) ;
770 /* Check seek from start of file. */
771 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
772 { printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
776 test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
783 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
788 seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
789 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
790 test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
797 seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
799 k = (int) sf_seek (file, -20, SEEK_CUR) ;
800 test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
806 /* Check that read past end of file returns number of items. */
807 sf_seek (file, sfinfo.frames, SEEK_SET) ;
809 if ((k = (int) sf_readf_short (file, data, datalen)) != 0)
810 { printf ("\n\nLine %d: Return value from sf_readf_short past end of file incorrect (%d).\n", __LINE__, k) ;
815 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
820 test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
826 sf_close (file) ;
837 { SNDFILE *file ;
871 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
872 test_writef_int_or_die (file, 0, orig, datalen, __LINE__) ;
873 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
874 sf_close (file) ;
881 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
889 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
894 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
899 { printf ("Incorrect number of channels in file.\n") ;
903 check_log_buffer_or_die (file, __LINE__) ;
905 check_comment (file, filetype, __LINE__) ;
907 test_readf_int_or_die (file, 0, data, datalen, __LINE__) ;
924 if ((k = (int) sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
931 ** to the end of a file so as to fill out a block.
941 { sf_close (file) ;
949 if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
950 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
955 { test_readf_int_or_die (file, m, data, 11, __LINE__) ;
969 /* Check seek from start of file. */
970 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
971 { printf ("Seek to start of file + %" PRId64 " failed (%d).\n", seekpos, k) ;
975 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
982 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
987 seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
988 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
989 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
995 seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
997 k = (int) sf_seek (file, -20, SEEK_CUR) ;
998 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
1004 /* Check that read past end of file returns number of items. */
1005 sf_seek (file, sfinfo.frames, SEEK_SET) ;
1007 if ((k = (int) sf_readf_int (file, data, datalen)) != 0)
1008 { printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
1013 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
1018 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
1024 sf_close (file) ;
1035 { SNDFILE *file ;
1059 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
1060 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
1061 test_writef_float_or_die (file, 0, orig, datalen, __LINE__) ;
1062 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
1063 sf_close (file) ;
1070 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
1078 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
1083 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
1088 { printf ("Incorrect number of channels in file.\n") ;
1092 check_comment (file, filetype, __LINE__) ;
1094 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
1096 check_log_buffer_or_die (file, __LINE__) ;
1098 check_comment (file, filetype, __LINE__) ;
1100 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
1102 test_readf_float_or_die (file, 0, data, datalen, __LINE__) ;
1119 if ((k = (int) sf_readf_float (file, data, datalen)) != sfinfo.frames - datalen)
1126 ** to the end of a file so as to fill out a block.
1136 { sf_close (file) ;
1144 if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
1145 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
1150 { test_readf_float_or_die (file, 0, data, 11, __LINE__) ;
1164 /* Check seek from start of file. */
1165 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
1166 { printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
1170 test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
1177 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
1182 seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
1183 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
1184 test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
1190 seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
1192 k = (int) sf_seek (file, -20, SEEK_CUR) ;
1193 test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
1199 /* Check that read past end of file returns number of items. */
1200 sf_seek (file, sfinfo.frames, SEEK_SET) ;
1202 if ((k = (int) sf_readf_float (file, data, datalen)) != 0)
1203 { printf ("\n\nLine %d: Return value from sf_readf_float past end of file incorrect (%d).\n", __LINE__, k) ;
1208 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
1213 test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
1219 sf_close (file) ;
1230 { SNDFILE *file ;
1254 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
1255 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
1256 test_writef_double_or_die (file, 0, orig, datalen, __LINE__) ;
1257 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
1258 sf_close (file) ;
1265 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
1273 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
1278 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
1283 { printf ("Incorrect number of channels in file.\n") ;
1287 check_comment (file, filetype, __LINE__) ;
1289 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
1291 check_log_buffer_or_die (file, __LINE__) ;
1293 check_comment (file, filetype, __LINE__) ;
1295 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
1297 test_readf_double_or_die (file, 0, data, datalen, __LINE__) ;
1314 if ((k = (int) sf_readf_double (file, data, datalen)) != sfinfo.frames - datalen)
1321 ** to the end of a file so as to fill out a block.
1331 { sf_close (file) ;
1339 if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
1340 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
1345 { test_readf_double_or_die (file, m, data, 11, __LINE__) ;
1359 /* Check seek from start of file. */
1360 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
1361 { printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
1365 test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
1372 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
1377 seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
1378 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
1379 test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
1385 seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
1387 k = (int) sf_seek (file, -20, SEEK_CUR) ;
1388 test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
1394 /* Check that read past end of file returns number of items. */
1395 sf_seek (file, sfinfo.frames, SEEK_SET) ;
1397 if ((k = (int) sf_readf_double (file, data, datalen)) != 0)
1398 { printf ("\n\nLine %d: Return value from sf_readf_double past end of file incorrect (%d).\n", __LINE__, k) ;
1403 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
1408 test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
1414 sf_close (file) ;
1426 { SNDFILE *file ;
1458 if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
1476 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1479 if ((filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_OPUS && !check_opus_version (file))
1480 { sf_close (file) ;
1485 test_write_short_or_die (file, 0, orig, datalen, __LINE__) ;
1486 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
1487 sf_close (file) ;
1494 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
1502 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
1507 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
1512 { printf ("Incorrect number of channels in file.\n") ;
1516 check_comment (file, filetype, __LINE__) ;
1518 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
1520 check_log_buffer_or_die (file, __LINE__) ;
1522 test_readf_short_or_die (file, 0, data, datalen, __LINE__) ;
1543 if ((k = (int) sf_read_short (file, data, datalen)) != sfinfo.frames - datalen)
1558 { if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
1559 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
1564 { test_readf_short_or_die (file, m, data, datalen / 7, __LINE__) ;
1582 /* Check seek from start of file. */
1583 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
1584 { printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
1587 test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
1594 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
1599 seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
1600 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
1601 test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
1607 seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
1609 k = (int) sf_seek (file, -20, SEEK_CUR) ;
1610 test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
1616 /* Check that read past end of file returns number of items. */
1617 sf_seek (file, sfinfo.frames, SEEK_SET) ;
1619 if ((k = (int) sf_read_short (file, data, datalen)) != 0)
1620 { printf ("\n\nLine %d: Return value from sf_read_short past end of file incorrect (%d).\n", __LINE__, k) ;
1626 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
1631 test_read_short_or_die (file, 0, data, channels, __LINE__) ;
1638 sf_close (file) ;
1646 { SNDFILE *file ;
1680 if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
1698 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1701 if ((filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_OPUS && !check_opus_version (file))
1702 { sf_close (file) ;
1707 test_writef_int_or_die (file, 0, orig, datalen, __LINE__) ;
1708 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
1709 sf_close (file) ;
1716 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
1724 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
1729 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
1734 { printf ("Incorrect number of channels in file.\n") ;
1738 check_log_buffer_or_die (file, __LINE__) ;
1740 test_readf_int_or_die (file, 0, data, datalen, __LINE__) ;
1761 if ((k = (int) sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
1782 { if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
1783 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
1788 { test_readf_int_or_die (file, m, data, datalen / 7, __LINE__) ;
1806 /* Check seek from start of file. */
1807 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
1808 { printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
1811 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
1818 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
1823 seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
1824 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
1825 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
1831 seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
1833 k = (int) sf_seek (file, -20, SEEK_CUR) ;
1834 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
1840 /* Check that read past end of file returns number of items. */
1841 sf_seek (file, sfinfo.frames, SEEK_SET) ;
1843 if ((k = (int) sf_readf_int (file, data, datalen)) != 0)
1844 { printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
1850 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
1855 test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
1862 sf_close (file) ;
1870 { SNDFILE *file ;
1927 if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
1945 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1948 if ((filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_OPUS && !check_opus_version (file))
1949 { sf_close (file) ;
1954 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
1955 test_write_float_or_die (file, 0, orig, datalen, __LINE__) ;
1956 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
1957 sf_close (file) ;
1964 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
1972 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
1977 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
1982 { printf ("Incorrect number of channels in file.\n") ;
1986 check_comment (file, filetype, __LINE__) ;
1988 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
1990 check_log_buffer_or_die (file, __LINE__) ;
1992 test_read_float_or_die (file, 0, data, datalen, __LINE__) ;
2014 if ((k = (int) sf_read_float (file, data, datalen)) != sfinfo.frames - datalen)
2029 { if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
2030 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
2035 { test_read_float_or_die (file, 0, data, datalen / 7, __LINE__) ;
2053 /* Check seek from start of file. */
2054 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
2055 { printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
2058 test_read_float_or_die (file, 0, data, channels, __LINE__) ;
2065 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
2070 seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
2071 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
2072 test_read_float_or_die (file, 0, data, channels, __LINE__) ;
2078 seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
2080 k = (int) sf_seek (file, -20, SEEK_CUR) ;
2081 test_read_float_or_die (file, 0, data, channels, __LINE__) ;
2087 /* Check that read past end of file returns number of items. */
2088 sf_seek (file, sfinfo.frames, SEEK_SET) ;
2090 if ((k = (int) sf_read_float (file, data, datalen)) != 0)
2091 { printf ("\n\nLine %d: Return value from sf_read_float past end of file incorrect (%d).\n", __LINE__, k) ;
2097 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
2102 test_read_float_or_die (file, 0, data, channels, __LINE__) ;
2109 sf_close (file) ;
2117 { SNDFILE *file ;
2170 if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
2188 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
2191 if ((filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_OPUS && !check_opus_version (file))
2192 { sf_close (file) ;
2197 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
2198 test_write_double_or_die (file, 0, orig, datalen, __LINE__) ;
2199 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
2200 sf_close (file) ;
2207 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
2215 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
2220 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
2225 { printf ("Incorrect number of channels in file.\n") ;
2229 check_comment (file, filetype, __LINE__) ;
2231 check_comment (file, filetype, __LINE__) ;
2233 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
2235 check_log_buffer_or_die (file, __LINE__) ;
2237 test_read_double_or_die (file, 0, data, datalen, __LINE__) ;
2258 if ((k = (int) sf_read_double (file, data, datalen)) != sfinfo.frames - datalen)
2273 { if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
2274 { printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
2279 { test_read_double_or_die (file, m, data, datalen / 7, __LINE__) ;
2297 /* Check seek from start of file. */
2298 if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
2299 { printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
2302 test_read_double_or_die (file, 0, data, channels, __LINE__) ;
2309 if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
2314 seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
2315 k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
2316 test_read_double_or_die (file, 0, data, channels, __LINE__) ;
2322 seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
2324 k = (int) sf_seek (file, -20, SEEK_CUR) ;
2325 test_read_double_or_die (file, 0, data, channels, __LINE__) ;
2331 /* Check that read past end of file returns number of items. */
2332 sf_seek (file, sfinfo.frames, SEEK_SET) ;
2334 if ((k = (int) sf_read_double (file, data, datalen)) != 0)
2335 { printf ("\n\nLine %d: Return value from sf_read_double past end of file incorrect (%d).\n", __LINE__, k) ;
2341 if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
2346 test_read_double_or_die (file, 0, data, channels, __LINE__) ;
2353 sf_close (file) ;
2361 { SNDFILE *file ;
2384 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
2385 test_write_short_or_die (file, 0, orig, datalen, __LINE__) ;
2386 sf_set_string (file, SF_STR_COMMENT, long_comment) ;
2387 sf_close (file) ;
2394 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
2402 { printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
2407 { printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
2412 { printf ("Incorrect number of channels in file.\n") ;
2416 check_comment (file, filetype, __LINE__) ;
2418 count = sf_read_raw (file, orig_buffer.c, datalen + 5 * channels) ;
2424 sf_close (file) ;
2558 check_comment (SNDFILE * file, int format, int lineno)
2570 comment = sf_get_string (file, SF_STR_COMMENT) ;
2606 check_opus_version (SNDFILE *file)
2612 sf_command (file, SFC_GET_LOG_INFO, log_buf, sizeof (log_buf)) ;