diff --git a/src/gmio_core/internal/fast_atof.h b/src/gmio_core/internal/fast_atof.h index 1de35fb..ceeeac9 100644 --- a/src/gmio_core/internal/fast_atof.h +++ b/src/gmio_core/internal/fast_atof.h @@ -4,14 +4,20 @@ * and irrXML.h */ -/* Adapted to ISO-C90 */ +/* Adapted to ISO-C90. + * + * WARNING : + * this header has no multi-inclusion guard. It must be included only once + * in the translation unit of use. The reason is that all functions + * defined here are meant to be inlined for performance purpose + */ #include "../global.h" #include #include -GMIO_INLINE gmio_bool_t is_local_decimal_point(char in) +GMIO_INLINE static gmio_bool_t is_local_decimal_point(char in) { /*! Selection of characters which count as decimal point in fast_atof * TODO: This should probably also be used in irr::core::string, but @@ -54,7 +60,7 @@ const float fast_atof_table[17] = { * \return The unsigned integer value of the digits. If the string specifies * too many digits to encode in an uint32_t then INT_MAX will be returned. */ -GMIO_INLINE uint32_t strtoul10(const char* in, const char** out) +GMIO_INLINE static uint32_t strtoul10(const char* in, const char** out) { gmio_bool_t overflow=GMIO_FALSE; uint32_t unsignedValue = 0; @@ -93,7 +99,7 @@ GMIO_INLINE uint32_t strtoul10(const char* in, const char** out) * too many digits to encode in an int32_t then +INT_MAX or -INT_MAX will be * returned. */ -GMIO_INLINE int32_t strtol10(const char* in, const char** out) +GMIO_INLINE static int32_t strtol10(const char* in, const char** out) { const gmio_bool_t negative = ('-' == *in); uint32_t unsignedValue = 0; @@ -130,7 +136,7 @@ GMIO_INLINE int32_t strtol10(const char* in, const char** out) * \return The unsigned integer value of the digit. 0xffffffff if the input is * not hex */ -GMIO_INLINE uint32_t ctoul16(char in) +GMIO_INLINE static uint32_t ctoul16(char in) { if (in >= '0' && in <= '9') return in - '0'; @@ -152,7 +158,7 @@ GMIO_INLINE uint32_t ctoul16(char in) * \return The unsigned integer value of the digits. If the string specifies * too many digits to encode in an uint32_t then INT_MAX will be returned. */ -GMIO_INLINE uint32_t strtoul16(const char* in, const char** out) +GMIO_INLINE static uint32_t strtoul16(const char* in, const char** out) { gmio_bool_t overflow=GMIO_FALSE; uint32_t unsignedValue = 0; @@ -197,7 +203,7 @@ GMIO_INLINE uint32_t strtoul16(const char* in, const char** out) * \return The unsigned integer value of the digits. If the string specifies * too many digits to encode in an uint32_t then INT_MAX will be returned. */ -GMIO_INLINE uint32_t strtoul8(const char* in, const char** out) +GMIO_INLINE static uint32_t strtoul8(const char* in, const char** out) { gmio_bool_t overflow=GMIO_FALSE; uint32_t unsignedValue = 0; @@ -239,7 +245,7 @@ GMIO_INLINE uint32_t strtoul8(const char* in, const char** out) * \return The unsigned integer value of the digits. If the string specifies * too many digits to encode in an uint32_t then INT_MAX will be returned. */ -GMIO_INLINE uint32_t strtoul_prefix(const char* in, const char** out) +GMIO_INLINE static uint32_t strtoul_prefix(const char* in, const char** out) { if (!in) { @@ -262,7 +268,7 @@ GMIO_INLINE uint32_t strtoul_prefix(const char* in, const char** out) * \return The whole positive floating point representation of the digit * sequence. */ -GMIO_INLINE gmio_float32_t strtof10(const char* in, const char** out) +GMIO_INLINE static gmio_float32_t strtof10(const char* in, const char** out) { const uint32_t MAX_SAFE_U32_VALUE = UINT_MAX / 10 - 10; uint32_t intValue = 0; @@ -309,7 +315,8 @@ GMIO_INLINE gmio_float32_t strtof10(const char* in, const char** out) * \return Pointer to the first character in the string that wasn't used * to create the float value. */ -GMIO_INLINE const char* fast_atof_move(const char* in, gmio_float32_t* result) +GMIO_INLINE static const char* fast_atof_move( + const char* in, gmio_float32_t* result) { const gmio_bool_t negative = ('-' == *in); gmio_float32_t value = 0.f; @@ -353,7 +360,7 @@ GMIO_INLINE const char* fast_atof_move(const char* in, gmio_float32_t* result) * wasn't used to create the float value. * \result Float value parsed from the input string */ -GMIO_INLINE float fast_atof(const char* floatAsString, const char** out) +GMIO_INLINE static float fast_atof(const char* floatAsString, const char** out) { float ret; if (out) diff --git a/src/gmio_core/internal/helper_error.h b/src/gmio_core/internal/helper_error.h index ca16a2c..136c09f 100644 --- a/src/gmio_core/internal/helper_error.h +++ b/src/gmio_core/internal/helper_error.h @@ -22,13 +22,13 @@ #include "../error.h" /*! Returns true if code == GMIO_NO_ERROR */ -GMIO_INLINE gmio_bool_t gmio_no_error(int code) +GMIO_INLINE static gmio_bool_t gmio_no_error(int code) { return code == GMIO_NO_ERROR; } /*! Returns true if code != GMIO_NO_ERROR */ -GMIO_INLINE gmio_bool_t gmio_error(int code) +GMIO_INLINE static gmio_bool_t gmio_error(int code) { return code != GMIO_NO_ERROR; } diff --git a/src/gmio_core/internal/helper_stream.h b/src/gmio_core/internal/helper_stream.h index 17eeb76..797aa84 100644 --- a/src/gmio_core/internal/helper_stream.h +++ b/src/gmio_core/internal/helper_stream.h @@ -22,7 +22,7 @@ #include "../stream.h" /*! Safe and convenient function for gmio_stream::at_end_func() */ -GMIO_INLINE gmio_bool_t gmio_stream_at_end(gmio_stream_t* stream) +GMIO_INLINE static gmio_bool_t gmio_stream_at_end(gmio_stream_t* stream) { if (stream != NULL && stream->at_end_func != NULL) return stream->at_end_func(stream->cookie); @@ -30,7 +30,7 @@ GMIO_INLINE gmio_bool_t gmio_stream_at_end(gmio_stream_t* stream) } /*! Safe and convenient function for gmio_stream::error_func() */ -GMIO_INLINE int gmio_stream_error(gmio_stream_t* stream) +GMIO_INLINE static int gmio_stream_error(gmio_stream_t* stream) { if (stream != NULL && stream->error_func != NULL) return stream->error_func(stream->cookie); @@ -38,7 +38,7 @@ GMIO_INLINE int gmio_stream_error(gmio_stream_t* stream) } /*! Safe and convenient function for gmio_stream::read_func() */ -GMIO_INLINE size_t gmio_stream_read( +GMIO_INLINE static size_t gmio_stream_read( gmio_stream_t* stream, void *ptr, size_t size, size_t count) { if (stream != NULL && stream->read_func != NULL) @@ -47,7 +47,7 @@ GMIO_INLINE size_t gmio_stream_read( } /*! Safe and convenient function for gmio_stream::write_func() */ -GMIO_INLINE size_t gmio_stream_write( +GMIO_INLINE static size_t gmio_stream_write( gmio_stream_t* stream, const void *ptr, size_t size, size_t count) { if (stream != NULL && stream->write_func != NULL) @@ -56,7 +56,7 @@ GMIO_INLINE size_t gmio_stream_write( } /*! Safe and convenient function for gmio_stream::size_func() */ -GMIO_INLINE size_t gmio_stream_size(gmio_stream_t* stream) +GMIO_INLINE static size_t gmio_stream_size(gmio_stream_t* stream) { if (stream != NULL && stream->size_func != NULL) return stream->size_func(stream->cookie); @@ -64,7 +64,7 @@ GMIO_INLINE size_t gmio_stream_size(gmio_stream_t* stream) } /*! Safe and convenient function for gmio_stream::rewind_func() */ -GMIO_INLINE void gmio_stream_rewind(gmio_stream_t* stream) +GMIO_INLINE static void gmio_stream_rewind(gmio_stream_t* stream) { if (stream != NULL && stream->rewind_func != NULL) stream->rewind_func(stream->cookie); diff --git a/src/gmio_core/internal/helper_transfer.h b/src/gmio_core/internal/helper_transfer.h index eeaee5d..78e0fb3 100644 --- a/src/gmio_core/internal/helper_transfer.h +++ b/src/gmio_core/internal/helper_transfer.h @@ -24,7 +24,7 @@ #include /*! Safe and convenient function for gmio_transfer::is_stop_requested_func() */ -GMIO_INLINE gmio_bool_t gmio_transfer_is_stop_requested( +GMIO_INLINE static gmio_bool_t gmio_transfer_is_stop_requested( const gmio_transfer_t* trsf) { if (trsf != NULL && trsf->is_stop_requested_func != NULL) @@ -33,7 +33,7 @@ GMIO_INLINE gmio_bool_t gmio_transfer_is_stop_requested( } /*! Safe and convenient function for gmio_transfer::handle_progress_func() */ -GMIO_INLINE void gmio_transfer_handle_progress( +GMIO_INLINE static void gmio_transfer_handle_progress( const gmio_transfer_t* trsf, size_t value, size_t max_value) { if (trsf != NULL && trsf->handle_progress_func != NULL) diff --git a/src/gmio_stl/internal/helper_stl_mesh_creator.h b/src/gmio_stl/internal/helper_stl_mesh_creator.h index 23e4e67..17f26de 100644 --- a/src/gmio_stl/internal/helper_stl_mesh_creator.h +++ b/src/gmio_stl/internal/helper_stl_mesh_creator.h @@ -23,7 +23,7 @@ /*! Safe and convenient function for * gmio_stl_mesh_creator::ascii_begin_solid_func() */ -GMIO_INLINE void gmio_stl_mesh_creator_ascii_begin_solid( +GMIO_INLINE static void gmio_stl_mesh_creator_ascii_begin_solid( gmio_stl_mesh_creator_t* creator, size_t stream_size, const char* solid_name) @@ -36,7 +36,7 @@ GMIO_INLINE void gmio_stl_mesh_creator_ascii_begin_solid( /*! Safe and convenient function for * gmio_stl_mesh_creator::binary_begin_solid_func() */ -GMIO_INLINE void gmio_stl_mesh_creator_binary_begin_solid( +GMIO_INLINE static void gmio_stl_mesh_creator_binary_begin_solid( gmio_stl_mesh_creator_t* creator, uint32_t tri_count, const uint8_t* header) @@ -47,7 +47,7 @@ GMIO_INLINE void gmio_stl_mesh_creator_binary_begin_solid( /*! Safe and convenient function for * gmio_stl_mesh_creator::add_triangle_func() */ -GMIO_INLINE void gmio_stl_mesh_creator_add_triangle( +GMIO_INLINE static void gmio_stl_mesh_creator_add_triangle( gmio_stl_mesh_creator_t* creator, uint32_t tri_id, const gmio_stl_triangle_t* triangle) @@ -58,7 +58,7 @@ GMIO_INLINE void gmio_stl_mesh_creator_add_triangle( /*! Safe and convenient function for * gmio_stl_mesh_creator::end_solid_func() */ -GMIO_INLINE void gmio_stl_mesh_creator_end_solid( +GMIO_INLINE static void gmio_stl_mesh_creator_end_solid( gmio_stl_mesh_creator_t* creator) { if (creator != NULL && creator->end_solid_func != NULL) diff --git a/src/gmio_stl/stla_read.c b/src/gmio_stl/stla_read.c index 44383d0..e070020 100644 --- a/src/gmio_stl/stla_read.c +++ b/src/gmio_stl/stla_read.c @@ -239,7 +239,7 @@ static gmio_stla_token_t parsing_find_token( return ID_token; } -static void parsing_advance(gmio_stla_parse_data_t* data) +GMIO_INLINE static void parsing_advance(gmio_stla_parse_data_t* data) { if (!parsing_can_continue(data)) return; @@ -253,7 +253,7 @@ static void parsing_advance(gmio_stla_parse_data_t* data) parsing_error(data); } -static void parsing_eat_token( +GMIO_INLINE static void parsing_eat_token( gmio_stla_token_t token, gmio_stla_parse_data_t* data) { if (!parsing_can_continue(data))