[trunk] Fix a potential issue with truncation of pointers diff

This commit is contained in:
Mathieu Malaterre 2012-03-26 08:51:12 +00:00
parent 34df9f3dbf
commit 1e3bc7c069
2 changed files with 5 additions and 2 deletions

View File

@ -125,7 +125,7 @@ void bio_destroy(opj_bio_t *bio) {
} }
} }
int bio_numbytes(opj_bio_t *bio) { ptrdiff_t bio_numbytes(opj_bio_t *bio) {
return (bio->bp - bio->start); return (bio->bp - bio->start);
} }

View File

@ -31,6 +31,9 @@
#ifndef __BIO_H #ifndef __BIO_H
#define __BIO_H #define __BIO_H
#include <stddef.h> /* ptrdiff_t */
/** /**
@file bio.h @file bio.h
@brief Implementation of an individual bit input-output (BIO) @brief Implementation of an individual bit input-output (BIO)
@ -75,7 +78,7 @@ Number of bytes written.
@param bio BIO handle @param bio BIO handle
@return Returns the number of bytes written @return Returns the number of bytes written
*/ */
int bio_numbytes(opj_bio_t *bio); ptrdiff_t bio_numbytes(opj_bio_t *bio);
/** /**
Init encoder Init encoder
@param bio BIO handle @param bio BIO handle