Fix multiplication result may overflow 'int' before it is converted to 'size_t'. (#911)

This commit is contained in:
Tom M 2021-06-12 09:59:30 +02:00 committed by GitHub
parent d709339ab5
commit f81caf37f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -39,7 +39,7 @@
* only be one producer thread and one consumer thread.
*/
fluid_ringbuffer_t *
new_fluid_ringbuffer(int count, int elementsize)
new_fluid_ringbuffer(int count, size_t elementsize)
{
fluid_ringbuffer_t *queue;

View file

@ -33,14 +33,14 @@ struct _fluid_ringbuffer_t
fluid_atomic_int_t count; /**< Current count of elements */
int in; /**< Index in queue to store next pushed element */
int out; /**< Index in queue of next popped element */
int elementsize; /**< Size of each element */
size_t elementsize; /**< Size of each element */
void *userdata;
};
typedef struct _fluid_ringbuffer_t fluid_ringbuffer_t;
fluid_ringbuffer_t *new_fluid_ringbuffer(int count, int elementsize);
fluid_ringbuffer_t *new_fluid_ringbuffer(int count, size_t elementsize);
void delete_fluid_ringbuffer(fluid_ringbuffer_t *queue);
/**