[trunk] Revert r2453 since it breaks conformance test ETS-C1P1-p1_06.j2k-decode
[openjpeg.git] / src / lib / openjp2 / cio.h
index 08063d1dc5335361ab1fb7c3f7c3ed42b94a366f..8e162a16ff3a0b51ff01039470698699a4ec9a11 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (c) 2002-2003, Yannick Verschueren
  * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
  * Copyright (c) 2005, Herve Drolon, FreeImage Team
+ * Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France 
+ * Copyright (c) 2012, CS Systemes d'Information, France
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,55 +45,6 @@ The functions in CIO.C have for goal to realize a byte input / output process.
 
 #include "opj_config.h"
 
-/** @name Exported functions (see also openjpeg.h) */
-/*@{*/
-/* ----------------------------------------------------------------------- */
-/**
-Number of bytes left before the end of the stream
-@param cio CIO handle
-@return Returns the number of bytes before the end of the stream
-*/
-OPJ_SIZE_T cio_numbytesleft(opj_cio_t *cio);
-/**
-Get pointer to the current position in the stream
-@param cio CIO handle
-@return Returns a pointer to the current position
-*/
-unsigned char *cio_getbp(opj_cio_t *cio);
-/**
-*/
-opj_bool cio_byteout(opj_cio_t *cio, unsigned char v);
-/**
-*/
-unsigned char cio_bytein(opj_cio_t *cio);
-/**
-Write some bytes
-@param cio CIO handle
-@param v Value to write
-@param n Number of bytes to write
-@return Returns the number of bytes written or 0 if an error occured
-*/
-OPJ_API unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned long long int v, int n);
-/**
-Read some bytes
-@param cio CIO handle
-@param n Number of bytes to read
-@return Returns the value of the n bytes read
-*/
-OPJ_API unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n);
-/**
-Skip some bytes
-@param cio CIO handle
-@param n Number of bytes to skip
-*/
-OPJ_API void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n);
-/* ----------------------------------------------------------------------- */
-/*@}*/
-
-/*@}*/
-
-
-
 /* ----------------------------------------------------------------------- */
 
 #if defined(OPJ_BIG_ENDIAN)
@@ -158,9 +111,6 @@ typedef struct opj_stream_private
         */
        opj_stream_seek_fn              m_seek_fn;
 
-
-
-
        /**
         * Actual data stored into the stream if readed from. Data is read by chunk of fixed size.
         * you should never access this data directly.
@@ -172,9 +122,15 @@ typedef struct opj_stream_private
         */
        OPJ_BYTE *                                      m_current_data;
 
+    /**
+    * FIXME DOC.
+    */
        OPJ_OFF_T (* m_opj_skip)(struct opj_stream_private * ,OPJ_OFF_T , struct opj_event_mgr *);
 
-       opj_bool (* m_opj_seek) (struct opj_stream_private * , OPJ_OFF_T , struct opj_event_mgr *);
+    /**
+    * FIXME DOC.
+    */
+       OPJ_BOOL (* m_opj_seek) (struct opj_stream_private * , OPJ_OFF_T , struct opj_event_mgr *);
 
        /**
         * number of bytes containing in the buffer.
@@ -199,14 +155,16 @@ typedef struct opj_stream_private
 }
 opj_stream_private_t;
 
-
+/** @name Exported functions (see also openjpeg.h) */
+/*@{*/
+/* ----------------------------------------------------------------------- */
 /**
  * Write some bytes to the given data buffer, this function is used in Big Endian cpus.
  * @param p_buffer             pointer the data buffer to write data to.
  * @param p_value              the value to write
  * @param p_nb_bytes   the number of bytes to write
 */
-OPJ_API void OPJ_CALLCONV opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
+void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
 
 /**
  * Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
@@ -215,7 +173,7 @@ OPJ_API void OPJ_CALLCONV opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_
  * @param p_nb_bytes   the nb bytes to read.
  * @return                             the number of bytes read or -1 if an error occured.
  */
-OPJ_API void OPJ_CALLCONV opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
+void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
 
 /**
  * Write some bytes to the given data buffer, this function is used in Little Endian cpus.
@@ -224,7 +182,7 @@ OPJ_API void OPJ_CALLCONV opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT3
  * @param p_nb_bytes   the number of bytes to write
  * @return                             the number of bytes written or -1 if an error occured
 */
-OPJ_API void OPJ_CALLCONV opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
+void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
 
 /**
  * Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
@@ -233,7 +191,7 @@ OPJ_API void OPJ_CALLCONV opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_
  * @param p_nb_bytes   the nb bytes to read.
  * @return                             the number of bytes read or -1 if an error occured.
  */
-OPJ_API void OPJ_CALLCONV opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
+void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
 
 
 /**
@@ -241,7 +199,7 @@ OPJ_API void OPJ_CALLCONV opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT3
  * @param p_buffer             pointer the data buffer to write data to.
  * @param p_value              the value to write
  */
-OPJ_API void OPJ_CALLCONV opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
+void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
 
 /***
  * Write some bytes to the given data buffer, this function is used in Big Endian cpus.
@@ -300,7 +258,7 @@ void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             the number of bytes read, or -1 if an error occured or if the stream is at the end.
  */
-OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Writes some bytes to the stream.
@@ -310,7 +268,7 @@ OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_read_data (opj_stream_private_t * p_s
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             the number of bytes writtent, or -1 if an error occured.
  */
-OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Writes the content of the stream buffer to the stream.
@@ -318,7 +276,7 @@ OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_write_data (opj_stream_private_t * p_
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             true if the data could be flushed, false else.
  */
-opj_bool opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr * p_event_mgr);
+OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Skips a number of bytes from the stream.
@@ -327,7 +285,7 @@ opj_bool opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             the number of bytes skipped, or -1 if an error occured.
  */
-OPJ_API OPJ_OFF_T OPJ_CALLCONV opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Tells the byte offset on the stream (similar to ftell).
@@ -336,7 +294,7 @@ OPJ_API OPJ_OFF_T OPJ_CALLCONV opj_stream_skip (opj_stream_private_t * p_stream,
  *
  * @return             the current position o fthe stream.
  */
-OPJ_API OPJ_OFF_T OPJ_CALLCONV opj_stream_tell (const opj_stream_private_t * p_stream);
+OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream);
 
 
 /**
@@ -373,7 +331,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             OPJ_TRUE if success, or OPJ_FALSE if an error occured.
  */
-opj_bool opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Skips a number of bytes from the stream.
@@ -382,7 +340,7 @@ opj_bool opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             the number of bytes skipped, or -1 if an error occured.
  */
-opj_bool opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Seeks a number of bytes from the stream.
@@ -391,18 +349,37 @@ opj_bool opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             true if the stream is seekable.
  */
-OPJ_API opj_bool OPJ_CALLCONV opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_BOOL opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Tells if the given stream is seekable.
  */
-OPJ_API opj_bool OPJ_CALLCONV opj_stream_has_seek (const opj_stream_private_t * p_stream);
+OPJ_BOOL opj_stream_has_seek (const opj_stream_private_t * p_stream);
 
+/**
+ * FIXME DOC.
+ */
 OPJ_SIZE_T opj_stream_default_read (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
+
+/**
+ * FIXME DOC.
+ */
 OPJ_SIZE_T opj_stream_default_write (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
+
+/**
+ * FIXME DOC.
+ */
 OPJ_OFF_T opj_stream_default_skip (OPJ_OFF_T p_nb_bytes, void * p_user_data);
-opj_bool opj_stream_default_seek (OPJ_OFF_T p_nb_bytes, void * p_user_data);
 
+/**
+ * FIXME DOC.
+ */
+OPJ_BOOL opj_stream_default_seek (OPJ_OFF_T p_nb_bytes, void * p_user_data);
+
+/* ----------------------------------------------------------------------- */
+/*@}*/
+
+/*@}*/
 
 
 #endif /* __CIO_H */