Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Compilation warning with DEBUG_REFCOUNT #36

Open
drizt opened this issue Sep 30, 2016 · 1 comment
Open

Compilation warning with DEBUG_REFCOUNT #36

drizt opened this issue Sep 30, 2016 · 1 comment

Comments

@drizt
Copy link
Contributor

drizt commented Sep 30, 2016

[ 48%] Building C object libsignal-protocol-c/src/CMakeFiles/signal-protocol-c.dir/signal_protocol.c.o
/home/taurus/develop/libsignal-protocol-qt/libsignal-protocol-c/src/signal_protocol.c: In function 'signal_type_ref_count':
/home/taurus/develop/libsignal-protocol-qt/libsignal-protocol-c/src/signal_protocol.c:75:12: warning: conversion to 'int' from 'unsigned int' may change the sign of the result [-Wsign-conversion]
     return instance->ref_count;
            ^

signal_type_ref_count returns int here but signal_type_base::ref_count is unsigned int here.

@freeboson
Copy link

Seems like ref_count should be defined as an int not an unsigned int in struct signal_type_base as we actually do assert(instance->ref_count > 0);. That's a better way to ensure that ref_count is positive definite.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants