comparison l2norm.cpp @ 410:d7e590d58c85 api-inversion

Pavlovian response to compiler warnings... ... attempt to squash them. For now we can get most of the way by writing a simple write_or_goto_error() macro for write(), and the equivalent for read(). One of the warnings, for the return value of chdir(), is silly, because we're already in an error case, and we really can't do anything sensible if the chdir fails. Try to deal with it anyway.
author mas01cr
date Thu, 11 Dec 2008 08:54:01 +0000
parents 7038f31124d1
children 4a22a0bdf9a9
comparison
equal deleted inserted replaced
409:99e6cbad7f76 410:d7e590d58c85
32 } 32 }
33 33
34 if(lseek(adb->fd, adb->header->l2normTableOffset, SEEK_SET) == (off_t) -1) { 34 if(lseek(adb->fd, adb->header->l2normTableOffset, SEEK_SET) == (off_t) -1) {
35 goto error; 35 goto error;
36 } 36 }
37 if(write(adb->fd, l2norm_buffer, nvectors * sizeof(double)) != (ssize_t) (nvectors * sizeof(double))) { 37 write_or_goto_error(adb->fd, l2norm_buffer, nvectors * sizeof(double));
38 goto error;
39 }
40 38
41 munmap(data_buffer, data_buffer_size); 39 munmap(data_buffer, data_buffer_size);
42 free(l2norm_buffer); 40 free(l2norm_buffer);
43 41
44 return 0; 42 return 0;