cfs-coffee: Fix build warning

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 <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
Benoît Thébaudeau 2016-05-28 22:47:58 +02:00
parent 2ad6d18c9d
commit d70c75914a

View file

@ -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) {