mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Fix a couple of Windows 2Gig file size issues.
Patch submitted by Janne Hyvärinen <cse@sci.fi>.
This commit is contained in:
@@ -57,7 +57,7 @@ static const char * const LayerString[] = {
|
||||
static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_;
|
||||
static ::FLAC__StreamMetadata *expected_metadata_sequence_[9];
|
||||
static unsigned num_expected_;
|
||||
static off_t flacfilesize_;
|
||||
static FLAC__off_t flacfilesize_;
|
||||
|
||||
static const char *flacfilename(bool is_ogg)
|
||||
{
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
if(error_occurred_)
|
||||
return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
|
||||
if(fseeko(file_, (off_t)absolute_byte_offset, SEEK_SET) < 0) {
|
||||
if(fseeko(file_, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) {
|
||||
error_occurred_ = true;
|
||||
return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
if(error_occurred_)
|
||||
return ::FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
|
||||
|
||||
off_t offset = ftello(file_);
|
||||
FLAC__off_t offset = ftello(file_);
|
||||
*absolute_byte_offset = (FLAC__uint64)offset;
|
||||
|
||||
if(offset < 0) {
|
||||
|
||||
@@ -28,6 +28,7 @@ extern "C" {
|
||||
#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 */
|
||||
@@ -131,7 +132,7 @@ public:
|
||||
{
|
||||
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;
|
||||
@@ -139,10 +140,10 @@ public:
|
||||
|
||||
::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;
|
||||
@@ -478,11 +479,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg)
|
||||
|
||||
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");
|
||||
|
||||
@@ -295,7 +295,7 @@ static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, ::FLAC
|
||||
|
||||
static int chain_seek_cb_(::FLAC__IOHandle handle, FLAC__int64 offset, int whence)
|
||||
{
|
||||
off_t o = (off_t)offset;
|
||||
FLAC__off_t o = (FLAC__off_t)offset;
|
||||
FLAC__ASSERT(offset == o);
|
||||
return fseeko((FILE*)handle, o, whence);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user