Replace all assert(false) and assert(0) with abort()
[babeltrace.git] / include / babeltrace / ctf-writer / serialize-internal.h
index 6095ae646da6d54df0fc393f89b83c2b86ebb10c..5cf8c5bd660a787a54d7f61df37df993dff5371b 100644 (file)
@@ -26,6 +26,7 @@
  * http://www.efficios.com/ctf
  */
 
+#include <stdlib.h>
 #include <stdint.h>
 #include <limits.h>
 #include <sys/mman.h>
@@ -37,6 +38,7 @@
 #include <babeltrace/ctf-ir/fields-internal.h>
 #include <babeltrace/align-internal.h>
 #include <babeltrace/mmap-align-internal.h>
+#include <babeltrace/types.h>
 
 struct bt_ctf_stream_pos {
        int fd;
@@ -47,7 +49,6 @@ struct bt_ctf_stream_pos {
        off_t mmap_offset;      /* mmap offset in the file, in bytes */
        off_t mmap_base_offset; /* offset of start of packet in mmap, in bytes */
        uint64_t packet_size;   /* current packet size, in bits */
-       uint64_t content_size;  /* current content size, in bits */
        int64_t offset;         /* offset from base, in bits. EOF for end of file. */
        struct mmap_align *base_mma;/* mmap base address */
 };
@@ -69,12 +70,13 @@ int bt_ctf_stream_pos_access_ok(struct bt_ctf_stream_pos *pos, uint64_t bit_len)
 
        if (unlikely(pos->offset == EOF))
                return 0;
+
        if (pos->prot == PROT_READ) {
                /*
                 * Reads may only reach up to the "content_size",
                 * regardless of the packet_size.
                 */
-               max_len = pos->content_size;
+               max_len = pos->offset;
        } else {
                /* Writes may take place up to the end of the packet. */
                max_len = pos->packet_size;
@@ -130,7 +132,7 @@ int bt_ctf_stream_pos_init(struct bt_ctf_stream_pos *pos,
                pos->flags = MAP_SHARED;
                break;
        default:
-               assert(false);
+               abort();
        }
 
        return 0;
This page took 0.023562 seconds and 4 git commands to generate.