iolog: fix error when compiled as c++
authorCasey Bodley <cbodley@redhat.com>
Wed, 4 Nov 2015 16:03:11 +0000 (11:03 -0500)
committerCasey Bodley <cbodley@redhat.com>
Mon, 16 Nov 2015 14:36:32 +0000 (09:36 -0500)
commit6f9bbb55450dcc76f4a0b016545316d372d80dbd
treee1462360ef60511f81bc82d8b5ccd08b20ae6ef9
parent236d24dff4826a469d2e980c2b71c2adba3b907e
iolog: fix error when compiled as c++

Given the main.cc source file:
  #include <fio.h>
  int main() { return 0; }

And the gcc command line:
  gcc main.cc -Ifio

In file included from fio/stat.h:4:0,
                 from fio/thread_options.h:7,
                 from fio/fio.h:18,
                 from main.cc:1:
fio/iolog.h: In function 'io_sample* __get_sample(void*, int,
uint64_t)':
fio/iolog.h:125:53: warning: pointer of type 'void *' used in arithmetic
[-Wpointer-arith]
  return samples + sample * __log_entry_sz(log_offset);
                                                     ^
fio/iolog.h:125:17: error: invalid conversion from 'void*' to
'io_sample*' [-fpermissive]
  return samples + sample * __log_entry_sz(log_offset);

Signed-off-by: Casey Bodley <cbodley@redhat.com>
iolog.h