diff options
| author | Julien Malik <julien.malik@paraiso.me> | 2011-11-30 16:55:25 +0000 |
|---|---|---|
| committer | Julien Malik <julien.malik@paraiso.me> | 2011-11-30 16:55:25 +0000 |
| commit | 455f675806670fb095b824a2cdb99350a63eeefc (patch) | |
| tree | 7cc2be12d30484662248e7968ec36515f47e0f92 /libopenjpeg/openjpeg.c | |
| parent | 3932e860ca8012bc3ce954bff0f576a0fc76835b (diff) | |
[trunk] implement Large File support in the library
Diffstat (limited to 'libopenjpeg/openjpeg.c')
| -rw-r--r-- | libopenjpeg/openjpeg.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c index 73b136d6..4470887d 100644 --- a/libopenjpeg/openjpeg.c +++ b/libopenjpeg/openjpeg.c @@ -132,40 +132,40 @@ opj_codec_private_t; /* ---------------------------------------------------------------------- */ -OPJ_UINT32 opj_read_from_file (void * p_buffer, OPJ_UINT32 p_nb_bytes, FILE * p_file) +OPJ_SIZE_T opj_read_from_file (void * p_buffer, OPJ_SIZE_T p_nb_bytes, FILE * p_file) { - OPJ_UINT32 l_nb_read = fread(p_buffer,1,p_nb_bytes,p_file); + OPJ_SIZE_T l_nb_read = fread(p_buffer,1,p_nb_bytes,p_file); return l_nb_read ? l_nb_read : -1; } -OPJ_UINT32 opj_get_data_length_from_file (FILE * p_file) +OPJ_UINT64 opj_get_data_length_from_file (FILE * p_file) { - OPJ_UINT32 file_length = 0; + OPJ_OFF_T file_length = 0; - fseek(p_file, 0, SEEK_END); - file_length = ftell(p_file); - fseek(p_file, 0, SEEK_SET); + OPJ_FSEEK(p_file, 0, SEEK_END); + file_length = (OPJ_UINT64)OPJ_FTELL(p_file); + OPJ_FSEEK(p_file, 0, SEEK_SET); return file_length; } -OPJ_UINT32 opj_write_from_file (void * p_buffer, OPJ_UINT32 p_nb_bytes, FILE * p_file) +OPJ_SIZE_T opj_write_from_file (void * p_buffer, OPJ_SIZE_T p_nb_bytes, FILE * p_file) { return fwrite(p_buffer,1,p_nb_bytes,p_file); } -OPJ_SIZE_T opj_skip_from_file (OPJ_SIZE_T p_nb_bytes, FILE * p_user_data) +OPJ_OFF_T opj_skip_from_file (OPJ_OFF_T p_nb_bytes, FILE * p_user_data) { - if (fseek(p_user_data,p_nb_bytes,SEEK_CUR)) { + if (OPJ_FSEEK(p_user_data,p_nb_bytes,SEEK_CUR)) { return -1; } return p_nb_bytes; } -opj_bool opj_seek_from_file (OPJ_SIZE_T p_nb_bytes, FILE * p_user_data) +opj_bool opj_seek_from_file (OPJ_OFF_T p_nb_bytes, FILE * p_user_data) { - if (fseek(p_user_data,p_nb_bytes,SEEK_SET)) { + if (OPJ_FSEEK(p_user_data,p_nb_bytes,SEEK_SET)) { return EXIT_FAILURE; } @@ -617,7 +617,7 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (FILE * p_file, return opj_stream_create_file_stream(p_file,J2K_STREAM_CHUNK_SIZE,p_is_read_stream); } -opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (FILE * p_file, OPJ_UINT32 p_size, opj_bool p_is_read_stream) +opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (FILE * p_file, OPJ_SIZE_T p_size, opj_bool p_is_read_stream) { opj_stream_t* l_stream = 00; |
