* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "encoders.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "share/compat.h"
typedef enum {
LAYER_STREAM = 0, /* FLAC__stream_encoder_init_stream() without seeking */
{
if(layer_==LAYER_STREAM)
return ::FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
- else if(fseek(file_, (long)absolute_byte_offset, SEEK_SET) < 0)
+ else if(fseeko(file_, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0)
return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
else
return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
::FLAC__StreamEncoderTellStatus StreamEncoder::tell_callback(FLAC__uint64 *absolute_byte_offset)
{
- long pos;
+ FLAC__off_t pos;
if(layer_==LAYER_STREAM)
return ::FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
- else if((pos = ftell(file_)) < 0)
+ else if((pos = ftello(file_)) < 0)
return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
else {
*absolute_byte_offset = (FLAC__uint64)pos;
printf("testing get_total_samples_estimate()... ");
if(encoder->get_total_samples_estimate() != streaminfo_.data.stream_info.total_samples) {
-#ifdef _MSC_VER
- printf("FAILED, expected %I64u, got %I64u\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate());
-#else
- printf("FAILED, expected %llu, got %llu\n", (unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long long)encoder->get_total_samples_estimate());
-#endif
+ printf("FAILED, expected %" PRIu64 ", got %" PRIu64 "\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate());
return false;
}
printf("OK\n");
printf("testing finish()... ");
if(!encoder->finish()) {
- FLAC::Encoder::Stream::State state = encoder->get_state();
+ state = encoder->get_state();
printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state), state.as_cstring());
return false;
}