gmio_core: use new integer type intmax_t instead for gmio_task_iface::func_handle_progress()

This commit is contained in:
Hugues Delorme 2016-04-07 10:13:32 +02:00
parent 911825e1c3
commit e97c880343
3 changed files with 22 additions and 14 deletions

View File

@ -76,6 +76,13 @@
# define GMIO_API
#endif
/* GMIO_HAVE_INT64_TYPE */
#if defined(GMIO_HAVE_INT64_T) \
|| defined(GMIO_HAVE_MSVC_INT64) \
|| defined(GMIO_HAVE_LONG_LONG)
# define GMIO_HAVE_INT64_TYPE
#endif
/* Typedefs for specific width integers */
#ifdef GMIO_HAVE_STDINT_H
# include <stdint.h>
@ -100,24 +107,24 @@ typedef unsigned long uint32_t;
# error Failed to find a 32bit integer type with 'int' and 'long'
# endif
#endif
/* (u)int64_t */
#ifndef GMIO_HAVE_INT64_T
# if defined(GMIO_HAVE_MSVC_INT64)
# ifndef GMIO_HAVE_INT64_T
# if defined(GMIO_HAVE_MSVC_INT64)
typedef __int64_t int64_t;
typedef unsigned __int64_t uint64_t;
# elif defined(GMIO_HAVE_LONG_LONG)
# elif defined(GMIO_HAVE_LONG_LONG)
typedef long long int64_t;
typedef unsigned long long uint64_t;
# endif
# endif
#endif
/* GMIO_HAVE_INT64_TYPE */
#if defined(GMIO_HAVE_INT64_T) \
|| defined(GMIO_HAVE_MSVC_INT64) \
|| defined(GMIO_HAVE_LONG_LONG)
# define GMIO_HAVE_INT64_TYPE
# ifdef GMIO_HAVE_INT64_TYPE
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# else
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
# endif
#endif
/* GMIO_HAVE_STDBOOL_H */

View File

@ -31,7 +31,7 @@ GMIO_INLINE bool gmio_task_iface_is_stop_requested(
/*! Safe and convenient function for gmio_task_iface::func_handle_progress() */
GMIO_INLINE void gmio_task_iface_handle_progress(
const struct gmio_task_iface* itask, size_t value, size_t max_value)
const struct gmio_task_iface* itask, intmax_t value, intmax_t max_value)
{
if (itask != NULL && itask->func_handle_progress != NULL)
itask->func_handle_progress(itask->cookie, value, max_value);

View File

@ -47,7 +47,8 @@ struct gmio_task_iface
* \param value Current value of the task progress (<= \p max_value )
* \param max_value Maximum value of the task progress
*/
void (*func_handle_progress)(void* cookie, size_t value, size_t max_value);
void (*func_handle_progress)(
void* cookie, intmax_t value, intmax_t max_value);
};
#endif /* GMIO_TASK_IFACE_H */