From d70c75914aed2499d95eba9ba8cb0f7f0a09d4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Date: Sat, 28 May 2016 22:47:58 +0200 Subject: [PATCH] cfs-coffee: Fix build warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix this build warning, which is generated if micro logs are enabled: In file included from ../../core/cfs/cfs-coffee.c:59:0: ../../core/cfs/cfs-coffee.c: In function 'read_log_page': ../../cpu/cc2538/./cfs-coffee-arch.h:145:24: warning: passing argument 1 of 'cfs_coffee_arch_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] cfs_coffee_arch_read((buf), (size), (offset)) ^ ../../core/cfs/cfs-coffee.c:757:3: note: in expansion of macro 'COFFEE_READ' COFFEE_READ(lp->buf, lp->size, base); ^ ../../cpu/cc2538/./cfs-coffee-arch.h:176:6: note: expected 'void *' but argument is of type 'const char *' void cfs_coffee_arch_read(void *buf, unsigned int size, cfs_offset_t offset); ^ COFFEE_READ() needs to write to lp->buf, so the target type of this pointer cannot be qualified as "const". Signed-off-by: Benoît Thébaudeau --- core/cfs/cfs-coffee.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/cfs/cfs-coffee.c b/core/cfs/cfs-coffee.c index 37b1a707e..374b3419f 100644 --- a/core/cfs/cfs-coffee.c +++ b/core/cfs/cfs-coffee.c @@ -196,7 +196,7 @@ struct file_header { /* This is needed because of a buggy compiler. */ struct log_param { cfs_offset_t offset; - const char *buf; + char *buf; uint16_t size; }; @@ -1198,7 +1198,7 @@ cfs_write(int fd, const void *buf, unsigned size) need_dummy_write = 0; for(bytes_left = size; bytes_left > 0;) { lp.offset = fdp->offset; - lp.buf = buf; + lp.buf = (void *)buf; lp.size = bytes_left; i = write_log_page(file, &lp); if(i < 0) {