Avoid pointer arithmetic with (void *) pointers.
[openjpeg.git] / src / lib / openjp2 / cio.h
index 729d073ac26656d50fec029824834a241db8b9cf..4ea03ff342a70f054c4733d1ed686aeaecfa8d9a 100644 (file)
@@ -49,7 +49,7 @@ The functions in CIO.C have for goal to realize a byte input / output process.
 /** @defgroup CIO CIO - byte input-output stream */
 /*@{*/
 
-#include "opj_config.h"
+#include "opj_config_private.h"
 
 /* ----------------------------------------------------------------------- */
 
@@ -70,16 +70,10 @@ The functions in CIO.C have for goal to realize a byte input / output process.
 #endif
 
 
-
-typedef enum
-{
-       opj_signed_sentinel             = -1, /* do not use in code */
-       opj_stream_e_output             = 0x1,
-       opj_stream_e_input              = 0x2,
-       opj_stream_e_end                = 0x4,
-       opj_stream_e_error              = 0x8
-}
-opj_stream_flag ;
+#define OPJ_STREAM_STATUS_OUTPUT  0x1U
+#define OPJ_STREAM_STATUS_INPUT   0x2U
+#define OPJ_STREAM_STATUS_END     0x4U
+#define OPJ_STREAM_STATUS_ERROR   0x8U
 
 /**
 Byte input-output stream.
@@ -162,8 +156,9 @@ typedef struct opj_stream_private
 
        /**
         * Flags to tell the status of the stream.
+        * Used with OPJ_STREAM_STATUS_* defines.
         */
-       opj_stream_flag m_status;
+       OPJ_UINT32 m_status;
 
 }
 opj_stream_private_t;
@@ -184,7 +179,7 @@ void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
  * @param p_buffer             pointer the data buffer to read data from.
  * @param p_value              pointer to the value that will store the data.
  * @param p_nb_bytes   the nb bytes to read.
- * @return                             the number of bytes read or -1 if an error occured.
+ * @return                             the number of bytes read or -1 if an error occurred.
  */
 void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
 
@@ -193,7 +188,7 @@ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT
  * @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
- * @return                             the number of bytes written or -1 if an error occured
+ * @return                             the number of bytes written or -1 if an error occurred
 */
 void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
 
@@ -202,7 +197,7 @@ void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
  * @param p_buffer             pointer the data buffer to read data from.
  * @param p_value              pointer to the value that will store the data.
  * @param p_nb_bytes   the nb bytes to read.
- * @return                             the number of bytes read or -1 if an error occured.
+ * @return                             the number of bytes read or -1 if an error occurred.
  */
 void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
 
@@ -269,7 +264,7 @@ void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
  * @param              p_buffer        pointer to the data buffer that will receive the data.
  * @param              p_size          number of bytes to read.
  * @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.
+ * @return             the number of bytes read, or -1 if an error occurred or if the stream is at the end.
  */
 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);
 
@@ -279,7 +274,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
  * @param              p_buffer        pointer to the data buffer holds the data to be writtent.
  * @param              p_size          number of bytes to write.
  * @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.
+ * @return             the number of bytes writtent, or -1 if an error occurred.
  */
 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);
 
@@ -296,7 +291,7 @@ OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr
  * @param              p_stream        the stream to skip data from.
  * @param              p_size          the number of bytes to skip.
  * @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.
+ * @return             the number of bytes skipped, or -1 if an error occurred.
  */
 OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
@@ -324,7 +319,7 @@ OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream
  * @param              p_stream        the stream to skip data from.
  * @param              p_size          the number of bytes to skip.
  * @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.
+ * @return             the number of bytes skipped, or -1 if an error occurred.
  */
 OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
@@ -333,7 +328,7 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
  * @param              p_stream        the stream to skip data from.
  * @param              p_size          the number of bytes to skip.
  * @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.
+ * @return             the number of bytes skipped, or -1 if an error occurred.
  */
 OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
@@ -342,7 +337,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
  * @param              p_stream        the stream to skip data from.
  * @param              p_size          the number of bytes to skip.
  * @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.
+ * @return             OPJ_TRUE if success, or OPJ_FALSE if an error occurred.
  */
 OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
@@ -351,7 +346,7 @@ OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size
  * @param              p_stream        the stream to skip data from.
  * @param              p_size          the number of bytes to skip.
  * @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.
+ * @return             the number of bytes skipped, or -1 if an error occurred.
  */
 OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);