mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-01 07:25:47 +03:00
fixed type conversions (thanks to Philippe Valembois for pointing this out)
This commit is contained in:
1 parent
e91ed05d74
commit
76271e1cbf
6 files changed
+13
-9
No files matched your search
+1
-1
@@ -24,7 +24,7 @@ SOURCES:= pdu.c net.c debug.c encode.c uri.c list.c resource.c hashkey.c \
|
||||
OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
|
||||
HEADERS:=coap.h config.h debug.h pdu.h net.h encode.h uri.h list.h mem.h \
|
||||
str.h option.h bits.h uthash.h utlist.h resource.h hashkey.h async.h
|
||||
CFLAGS:=-Wall -std=c99 -pedantic @CFLAGS@
|
||||
CFLAGS:=-Wall -Wextra -std=c99 -pedantic @CFLAGS@
|
||||
CPPFLAGS:=@CPPFLAGS@
|
||||
DISTDIR=$(top_builddir)/$(package)
|
||||
SUBDIRS:=examples doc
|
||||
|
||||
@@ -33,7 +33,7 @@ bits_setb(uint8_t *vec, size_t size, uint8_t bit) {
|
||||
if (size <= (bit >> 3))
|
||||
return -1;
|
||||
|
||||
*(vec + (bit >> 3)) |= 1 << (bit & 0x07);
|
||||
*(vec + (bit >> 3)) |= (uint8_t)(1 << (bit & 0x07));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ bits_clrb(uint8_t *vec, size_t size, uint8_t bit) {
|
||||
if (size <= (bit >> 3))
|
||||
return -1;
|
||||
|
||||
*(vec + (bit >> 3)) &= ~(1 << (bit & 0x07));
|
||||
*(vec + (bit >> 3)) &= (uint8_t)(~(1 << (bit & 0x07)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ coap_show_pdu(const coap_pdu_t *pdu) {
|
||||
#endif /* NDEBUG */
|
||||
|
||||
void
|
||||
coap_log_impl(coap_log_t level, char *format, ...) {
|
||||
coap_log_impl(coap_log_t level, const char *format, ...) {
|
||||
char timebuf[32];
|
||||
coap_tick_t now;
|
||||
va_list ap;
|
||||
@@ -220,5 +220,5 @@ coap_log_impl(coap_log_t level, char *format, ...) {
|
||||
va_start(ap, format);
|
||||
vfprintf(log_fd, format, ap);
|
||||
va_end(ap);
|
||||
fflush(stdout);
|
||||
fflush(log_fd);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ void coap_set_log_level(coap_log_t level);
|
||||
* text is output only when @p level is below or equal to the log
|
||||
* level that set by coap_set_log_level().
|
||||
*/
|
||||
void coap_log_impl(coap_log_t level, char *format, ...);
|
||||
void coap_log_impl(coap_log_t level, const char *format, ...);
|
||||
|
||||
#ifndef coap_log
|
||||
#define coap_log(...) coap_log_impl(__VA_ARGS__)
|
||||
|
||||
@@ -424,7 +424,7 @@ coap_read( coap_context_t *ctx ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( bytes_read < sizeof(coap_hdr_t) ) {
|
||||
if ( (size_t)bytes_read < sizeof(coap_hdr_t) ) {
|
||||
debug("coap_read: discarded invalid frame\n" );
|
||||
return -1;
|
||||
}
|
||||
@@ -757,9 +757,13 @@ handle_response(coap_context_t *context,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
#ifdef __GNUC__
|
||||
handle_locally(coap_context_t *context __attribute__ ((unused)),
|
||||
coap_queue_t *node __attribute__ ((unused))) {
|
||||
#else /* not a GCC */
|
||||
handle_locally(coap_context_t *context, coap_queue_t *node) {
|
||||
#endif /* GCC */
|
||||
/* this function can be used to check if node->pdu is really for us */
|
||||
return 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ static inline void
|
||||
coap_register_handler(coap_resource_t *resource,
|
||||
unsigned char method, coap_method_handler_t handler) {
|
||||
assert(resource);
|
||||
assert(method-1 < sizeof(coap_method_handler_t));
|
||||
assert(method > 0 && (size_t)(method-1) < sizeof(resource->handler)/sizeof(coap_method_handler_t));
|
||||
resource->handler[method-1] = handler;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user