From a2c071369b91a973097ce83795f6c32098a42c13 Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Thu, 3 Dec 2015 18:03:46 +0100 Subject: [PATCH] gmio_core: rename gmio_stream_pos -> gmio_streampos --- benchmarks/benchmark_gmio/main.c | 2 +- src/gmio_core/internal/helper_stream.h | 4 ++-- src/gmio_core/stream.c | 4 ++-- src/gmio_core/stream.h | 6 +++--- src/gmio_core/{stream_pos.c => streampos.c} | 6 +++--- src/gmio_core/{stream_pos.h => streampos.h} | 24 ++++++++++----------- src/gmio_stl/stl_format.c | 2 +- src/gmio_support/stream_cpp.h | 12 +++++------ src/gmio_support/stream_qt.cpp | 4 ++-- tests/stream_buffer.c | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) rename src/gmio_core/{stream_pos.c => streampos.c} (87%) rename src/gmio_core/{stream_pos.h => streampos.h} (67%) diff --git a/benchmarks/benchmark_gmio/main.c b/benchmarks/benchmark_gmio/main.c index c87317b..cdb2718 100644 --- a/benchmarks/benchmark_gmio/main.c +++ b/benchmarks/benchmark_gmio/main.c @@ -74,7 +74,7 @@ enum { STL_TRIANGLE_ARRAY_SIZE = 512 }; struct stl_readwrite_conv { struct gmio_rwargs rwargs; - struct gmio_stream_pos out_stream_pos_begin; + struct gmio_streampos out_stream_pos_begin; enum gmio_stl_format in_format; enum gmio_stl_format out_format; struct gmio_stl_triangle triangle_array[STL_TRIANGLE_ARRAY_SIZE]; diff --git a/src/gmio_core/internal/helper_stream.h b/src/gmio_core/internal/helper_stream.h index fa772d5..4b1c429 100644 --- a/src/gmio_core/internal/helper_stream.h +++ b/src/gmio_core/internal/helper_stream.h @@ -62,7 +62,7 @@ GMIO_INLINE gmio_streamsize_t gmio_stream_size(struct gmio_stream* stream) /*! Safe and convenient function for gmio_stream::func_get_pos() */ GMIO_INLINE int gmio_stream_get_pos( - struct gmio_stream* stream, struct gmio_stream_pos* pos) + struct gmio_stream* stream, struct gmio_streampos* pos) { if (stream != NULL && stream->func_get_pos != NULL) return stream->func_get_pos(stream->cookie, pos); @@ -71,7 +71,7 @@ GMIO_INLINE int gmio_stream_get_pos( /*! Safe and convenient function for gmio_stream::func_set_pos() */ GMIO_INLINE int gmio_stream_set_pos( - struct gmio_stream* stream, const struct gmio_stream_pos* pos) + struct gmio_stream* stream, const struct gmio_streampos* pos) { if (stream != NULL && stream->func_set_pos != NULL) return stream->func_set_pos(stream->cookie, pos); diff --git a/src/gmio_core/stream.c b/src/gmio_core/stream.c index 4a0f395..1f39a11 100644 --- a/src/gmio_core/stream.c +++ b/src/gmio_core/stream.c @@ -129,7 +129,7 @@ static gmio_streamsize_t gmio_stream_stdio_size(void* cookie) #endif } -static int gmio_stream_stdio_get_pos(void* cookie, struct gmio_stream_pos* pos) +static int gmio_stream_stdio_get_pos(void* cookie, struct gmio_streampos* pos) { fpos_t fpos; int res = fgetpos((FILE*)cookie, &fpos); @@ -137,7 +137,7 @@ static int gmio_stream_stdio_get_pos(void* cookie, struct gmio_stream_pos* pos) return res; } -static int gmio_stream_stdio_set_pos(void* cookie, const struct gmio_stream_pos* pos) +static int gmio_stream_stdio_set_pos(void* cookie, const struct gmio_streampos* pos) { fpos_t fpos; memcpy(&fpos, &pos->cookie[0], sizeof(fpos_t)); diff --git a/src/gmio_core/stream.h b/src/gmio_core/stream.h index fb40ee1..55cb355 100644 --- a/src/gmio_core/stream.h +++ b/src/gmio_core/stream.h @@ -24,7 +24,7 @@ #define GMIO_STREAM_H #include "global.h" -#include "stream_pos.h" +#include "streampos.h" #include #ifdef GMIO_HAVE_INT64_TYPE @@ -108,7 +108,7 @@ struct gmio_stream * \retval 0 on success * \retval !=0 on error */ - int (*func_get_pos)(void* cookie, struct gmio_stream_pos* pos); + int (*func_get_pos)(void* cookie, struct gmio_streampos* pos); /*! Pointer on a function that restores the current position in the stream * to \p pos @@ -116,7 +116,7 @@ struct gmio_stream * \retval 0 on success * \retval !=0 on error */ - int (*func_set_pos)(void* cookie, const struct gmio_stream_pos* pos); + int (*func_set_pos)(void* cookie, const struct gmio_streampos* pos); }; diff --git a/src/gmio_core/stream_pos.c b/src/gmio_core/streampos.c similarity index 87% rename from src/gmio_core/stream_pos.c rename to src/gmio_core/streampos.c index 1b1bdbd..c4e1eb6 100644 --- a/src/gmio_core/stream_pos.c +++ b/src/gmio_core/streampos.c @@ -13,13 +13,13 @@ ** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html". ****************************************************************************/ -#include "stream_pos.h" +#include "streampos.h" #include #include -struct gmio_stream_pos gmio_stream_pos_null() +struct gmio_streampos gmio_streampos_null() { - struct gmio_stream_pos pos = {0}; + struct gmio_streampos pos = {0}; return pos; } diff --git a/src/gmio_core/stream_pos.h b/src/gmio_core/streampos.h similarity index 67% rename from src/gmio_core/stream_pos.h rename to src/gmio_core/streampos.h index cecc435..076869a 100644 --- a/src/gmio_core/stream_pos.h +++ b/src/gmio_core/streampos.h @@ -13,42 +13,42 @@ ** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html". ****************************************************************************/ -/*! \file stream_pos.h - * Declaration of gmio_stream_pos and utility functions +/*! \file streampos.h + * Declaration of gmio_streampos and utility functions * * \addtogroup gmio_core * @{ */ -#ifndef GMIO_STREAM_POS_H -#define GMIO_STREAM_POS_H +#ifndef GMIO_STREAMPOS_H +#define GMIO_STREAMPOS_H #include "global.h" -/*! Size of the byte array gmio_stream_pos::cookie */ -enum { GMIO_STREAM_POS_COOKIE_SIZE = 32 /* bytes */ }; +/*! Size of the byte array gmio_streampos::cookie */ +enum { GMIO_STREAMPOS_COOKIE_SIZE = 32 /* bytes */ }; /*! Specifies a position within a stream * - * The information in gmio_stream_pos objects is usually filled by a call to + * The information in gmio_streampos objects is usually filled by a call to * gmio_stream::func_get_pos(), which takes a pointer to an object of this type * as argument. * - * The content of a gmio_stream_pos object is not meant to be read directly, + * The content of a gmio_streampos object is not meant to be read directly, * but only to be used as an argument in a call to gmio_stream::func_set_pos() */ -struct gmio_stream_pos +struct gmio_streampos { /*! Stores the actual(concrete) stream position object */ - uint8_t cookie[GMIO_STREAM_POS_COOKIE_SIZE]; + uint8_t cookie[GMIO_STREAMPOS_COOKIE_SIZE]; }; GMIO_C_LINKAGE_BEGIN /*! Returns a null stream position */ -GMIO_LIB_EXPORT struct gmio_stream_pos gmio_stream_pos_null(); +GMIO_LIB_EXPORT struct gmio_streampos gmio_streampos_null(); GMIO_C_LINKAGE_END -#endif /* GMIO_STREAM_POS_H */ +#endif /* GMIO_STREAMPOS_H */ /*! @} */ diff --git a/src/gmio_stl/stl_format.c b/src/gmio_stl/stl_format.c index c76790a..5995154 100644 --- a/src/gmio_stl/stl_format.c +++ b/src/gmio_stl/stl_format.c @@ -38,7 +38,7 @@ enum gmio_stl_format gmio_stl_get_format(struct gmio_stream *stream) { char fixed_buffer[GMIO_FIXED_BUFFER_SIZE] = {0}; size_t read_size = 0; - struct gmio_stream_pos stream_start_pos = gmio_stream_pos_null(); + struct gmio_streampos stream_start_pos = gmio_streampos_null(); if (stream == NULL) return GMIO_STL_FORMAT_UNKNOWN; diff --git a/src/gmio_support/stream_cpp.h b/src/gmio_support/stream_cpp.h index bbb0d65..1eb6af3 100644 --- a/src/gmio_support/stream_cpp.h +++ b/src/gmio_support/stream_cpp.h @@ -111,12 +111,12 @@ gmio_streamsize_t ostream_cpp_size(void* cookie) return end_pos - begin_pos; } -GMIO_INLINE void copy_cpp_streampos(gmio_stream_pos* pos, std::streampos spos) +GMIO_INLINE void copy_cpp_streampos(gmio_streampos* pos, std::streampos spos) { std::memcpy(&pos->cookie[0], &spos, sizeof(std::streampos)); } -GMIO_INLINE std::streampos to_cpp_streampos(const gmio_stream_pos* pos) +GMIO_INLINE std::streampos to_cpp_streampos(const gmio_streampos* pos) { std::streampos spos; std::memcpy(&spos, &pos->cookie[0], sizeof(std::streampos)); @@ -124,28 +124,28 @@ GMIO_INLINE std::streampos to_cpp_streampos(const gmio_stream_pos* pos) } template -int istream_cpp_get_pos(void* cookie, gmio_stream_pos* pos) +int istream_cpp_get_pos(void* cookie, gmio_streampos* pos) { copy_cpp_streampos(pos, static_cast(cookie)->tellg()); return 0; } template -int istream_cpp_set_pos(void* cookie, const gmio_stream_pos* pos) +int istream_cpp_set_pos(void* cookie, const gmio_streampos* pos) { static_cast(cookie)->seekg(to_cpp_streampos(pos)); return 0; // TODO: return error code } template -int ostream_cpp_get_pos(void* cookie, gmio_stream_pos* pos) +int ostream_cpp_get_pos(void* cookie, gmio_streampos* pos) { copy_cpp_streampos(pos, static_cast(cookie)->tellp()); return 0; } template -static int ostream_cpp_set_pos(void* cookie, const gmio_stream_pos* pos) +static int ostream_cpp_set_pos(void* cookie, const gmio_streampos* pos) { static_cast(cookie)->seekp(to_cpp_streampos(pos)); return 0; // TODO: return error code diff --git a/src/gmio_support/stream_qt.cpp b/src/gmio_support/stream_qt.cpp index 52dd3f2..dfa94a8 100644 --- a/src/gmio_support/stream_qt.cpp +++ b/src/gmio_support/stream_qt.cpp @@ -64,7 +64,7 @@ static gmio_streamsize_t gmio_stream_qiodevice_size(void* cookie) return device->size(); } -static int gmio_stream_qiodevice_get_pos(void* cookie, struct gmio_stream_pos* pos) +static int gmio_stream_qiodevice_get_pos(void* cookie, struct gmio_streampos* pos) { QIODevice* device = static_cast(cookie); qint64 qpos = device->pos(); @@ -73,7 +73,7 @@ static int gmio_stream_qiodevice_get_pos(void* cookie, struct gmio_stream_pos* p } static int gmio_stream_qiodevice_set_pos( - void* cookie, const struct gmio_stream_pos* pos) + void* cookie, const struct gmio_streampos* pos) { QIODevice* device = static_cast(cookie); qint64 qpos; diff --git a/tests/stream_buffer.c b/tests/stream_buffer.c index b2d40aa..3f5e723 100644 --- a/tests/stream_buffer.c +++ b/tests/stream_buffer.c @@ -84,14 +84,14 @@ static gmio_streamsize_t gmio_stream_buffer_size(void* cookie) return buff->len; } -static int gmio_stream_buffer_get_pos(void* cookie, struct gmio_stream_pos* pos) +static int gmio_stream_buffer_get_pos(void* cookie, struct gmio_streampos* pos) { gmio_ro_buffer_t* buff = (gmio_ro_buffer_t*)cookie; memcpy(&pos->cookie[0], &buff->pos, sizeof(size_t)); return 0; } -static int gmio_stream_buffer_set_pos(void* cookie, const struct gmio_stream_pos* pos) +static int gmio_stream_buffer_set_pos(void* cookie, const struct gmio_streampos* pos) { gmio_ro_buffer_t* buff = (gmio_ro_buffer_t*)cookie; memcpy(&buff->pos, &pos->cookie[0], sizeof(size_t));