summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-11-17 10:46:03 +0100
committerSuren A. Chilingaryan <csa@suren.me>2019-11-17 10:46:03 +0100
commit23f22348c5281fff685c1fa89255e7e1e76266a4 (patch)
treefb05ad7fb39357ff8785068b3a1512101d685f41 /src
parent3d93df54d024f49895db6277e873dccd10b5baec (diff)
downloadufo-roof-temp-23f22348c5281fff685c1fa89255e7e1e76266a4.tar.gz
ufo-roof-temp-23f22348c5281fff685c1fa89255e7e1e76266a4.tar.bz2
ufo-roof-temp-23f22348c5281fff685c1fa89255e7e1e76266a4.tar.xz
ufo-roof-temp-23f22348c5281fff685c1fa89255e7e1e76266a4.zip
cmake build and gcc warnings
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/ufo-roof-buffer.c8
-rw-r--r--src/ufo-roof-buffer.h4
-rw-r--r--src/ufo-roof-build-task.c6
-rw-r--r--src/ufo-roof-error.h44
-rw-r--r--src/ufo-roof-read-file.c4
-rw-r--r--src/ufo-roof-read-socket.c4
-rw-r--r--src/ufo-roof-read.h2
-rw-r--r--src/ufo-roof.h2
9 files changed, 41 insertions, 41 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0913528..95f7160 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,7 +28,7 @@ set(ufofilter_LIBS
${UFO_LIBRARIES}
${OpenCL_LIBRARIES})
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -Wall -Wextra -fPIC -Wno-unused-parameter -Wno-deprecated-declarations")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu18 -pedantic -Wall -Wextra -fPIC -Wno-unused-parameter -Wno-deprecated-declarations")
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES)
#}}}
@@ -42,8 +42,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
${OpenCL_INCLUDE_DIRS}
${UFO_INCLUDE_DIRS})
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+# ${CMAKE_CURRENT_BINARY_DIR}/config.h)
foreach(_src ${ufofilter_SRCS})
@@ -68,7 +68,7 @@ foreach(_src ${ufofilter_SRCS})
add_library(${target} SHARED ${_src} ${common_SRCS} ${${_aux_src}})
endif()
- target_link_libraries(${target} ${ufofilter_LIBS} ${${_aux_libs}} ufoaux)
+ target_link_libraries(${target} ${ufofilter_LIBS} ${${_aux_libs}})
list(APPEND all_targets ${target})
diff --git a/src/ufo-roof-buffer.c b/src/ufo-roof-buffer.c
index f071481..eaf9b35 100644
--- a/src/ufo-roof-buffer.c
+++ b/src/ufo-roof-buffer.c
@@ -20,7 +20,7 @@ UfoRoofBuffer *ufo_roof_buffer_new(UfoRoofConfig *cfg, GError **error) {
// printf("Configuration: dataset: %u - %u fragments (%u streams x %u) x %u bytes\n", buffer->dataset_size, buffer->fragments_per_dataset, cfg->n_streams, buffer->fragments_per_stream, buffer->fragment_size);
buffer->ring_buffer = malloc(buffer->ring_size * buffer->dataset_size);
- buffer->n_fragments = (_Atomic int*)calloc(buffer->ring_size, sizeof(_Atomic int));
+ buffer->n_fragments = (_Atomic guint*)calloc(buffer->ring_size, sizeof(_Atomic int));
buffer->stream_fragment = (guint*)calloc(cfg->n_streams, sizeof(guint));
if ((!buffer->ring_buffer)||(!buffer->n_fragments)||(!buffer->stream_fragment)) {
@@ -73,7 +73,7 @@ gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, gu
// FIXME: Send semi-complete buffers further?
// FIXME: Or shall we drop more if larger buffers are allocated?
- for (int i = buffer->current_id; i <= (dataset_id - buffer->ring_size); i++)
+ for (guint i = buffer->current_id; i <= (dataset_id - buffer->ring_size); i++)
buffer->n_fragments[i%buffer->ring_size] = 0;
buffer->current_id = dataset_id - buffer->ring_size + 1;
@@ -83,8 +83,8 @@ gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, gu
}
// FIXME: This is builds events as it read from file in roof v.1 code. We can assemble fan projections directly here.
- void *dataset_buffer = buffer->ring_buffer + buffer_id * buffer->dataset_size;
- void *fragment_buffer = dataset_buffer + (stream_id * buffer->fragments_per_stream + fragment_id) * buffer->fragment_size;
+ uint8_t *dataset_buffer = buffer->ring_buffer + buffer_id * buffer->dataset_size;
+ uint8_t *fragment_buffer = dataset_buffer + (stream_id * buffer->fragments_per_stream + fragment_id) * buffer->fragment_size;
/* printf("buffer: %u (%u), packet: %u (%ux%u %u), packet_size: %u [%x]\n",
buffer_id, dataset_id, stream_id * buffer->fragments_per_stream + fragment_id, stream_id, buffer->fragments_per_stream, fragment_id, buffer->fragment_size,
diff --git a/src/ufo-roof-buffer.h b/src/ufo-roof-buffer.h
index bb71791..367f2d5 100644
--- a/src/ufo-roof-buffer.h
+++ b/src/ufo-roof-buffer.h
@@ -7,8 +7,8 @@ struct _UfoRoofBuffer {
guint current_id; // The ID of the first (active) dataset in the buffer
guint ring_size; // Number of datasets to buffer
- void *ring_buffer; // The ring buffer
- _Atomic int *n_fragments; // Number of completed fragments in each buffer
+ uint8_t *ring_buffer; // The ring buffer
+ _Atomic guint *n_fragments; // Number of completed fragments in each buffer
guint *stream_fragment; // Currently processed fragment in the stream (for ordered streams)
// int *fragments; // Mark individual completed fragments (if we care for partial data)
diff --git a/src/ufo-roof-build-task.c b/src/ufo-roof-build-task.c
index 81c84ce..fa2fdcd 100644
--- a/src/ufo-roof-build-task.c
+++ b/src/ufo-roof-build-task.c
@@ -162,14 +162,14 @@ ufo_roof_build_task_process (UfoTask *task,
// UfoRequisition in_req;
// ufo_buffer_get_requisition (inputs[0], &in_req);
- void *data = ufo_buffer_get_host_array(inputs[0], NULL);
+ uint8_t *data = (uint8_t*)ufo_buffer_get_host_array(inputs[0], NULL);
UfoRoofPacketBlockHeader *header = UFO_ROOF_PACKET_BLOCK_HEADER(data, cfg);
if (priv->stop)
return FALSE;
- for (int i = 0; i < header->n_packets; i++) {
- int packet_id = 0;
+ for (guint i = 0; i < header->n_packets; i++) {
+ guint packet_id = 0;
// Otherwise considered consecutive and handled by the buffer
if (cfg->header_size >= sizeof(UfoRoofPacketHeader)) {
diff --git a/src/ufo-roof-error.h b/src/ufo-roof-error.h
index ed0ae2b..5491f31 100644
--- a/src/ufo-roof-error.h
+++ b/src/ufo-roof-error.h
@@ -10,49 +10,49 @@
error = NULL; \
} while (0)
-#define roof_set_error(error, type, msg...) do { \
- if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \
+#define roof_set_error(error, type, ...) do { \
+ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \
} while (0)
-#define roof_error(error, type, msg...) do { \
- if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \
+#define roof_error(error, type, ...) do { \
+ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \
return; \
} while (0)
-#define roof_propagate_error(error, err, msg...) do { \
- g_propagate_prefixed_error(error, err, msg); \
+#define roof_propagate_error(error, err, ...) do { \
+ g_propagate_prefixed_error(error, err, __VA_ARGS__); \
return; \
} while (0)
-#define roof_error_with_retval(error, retval, type, msg...) do { \
- if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \
+#define roof_error_with_retval(error, retval, type, ...) do { \
+ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \
return retval; \
} while (0)
-#define roof_propagate_error_with_retval(error, retval, err, msg...) do { \
- g_propagate_prefixed_error(error, err, msg); \
+#define roof_propagate_error_with_retval(error, retval, err, ...) do { \
+ g_propagate_prefixed_error(error, err, __VA_ARGS__); \
return retval; \
} while (0)
-#define roof_setup_error(error, msg...) \
- roof_error(error, SETUP, msg)
+#define roof_setup_error(error, ...) \
+ roof_error(error, SETUP, __VA_ARGS__)
-#define roof_new_error(error, msg...) \
- roof_error_with_retval(error, NULL, SETUP, msg)
+#define roof_new_error(error, ...) \
+ roof_error_with_retval(error, NULL, SETUP, __VA_ARGS__)
-#define roof_network_error(error, msg...) \
- roof_error(error, SETUP, msg)
+#define roof_network_error(error, ...) \
+ roof_error(error, SETUP, __VA_ARGS__)
-#define root_set_network_error(error, msg...) \
- roof_set_error(error, SETUP, msg)
+#define root_set_network_error(error, ...) \
+ roof_set_error(error, SETUP, __VA_ARGS__)
-#define roof_network_error_with_retval(error, retval, msg...) \
- roof_error_with_retval(error, retval, SETUP, msg)
+#define roof_network_error_with_retval(error, retval, ...) \
+ roof_error_with_retval(error, retval, SETUP, __VA_ARGS__)
-#define roof_memory_error(error, msg...) \
- roof_error(error, SETUP, msg)
+#define roof_memory_error(error, ...) \
+ roof_error(error, SETUP, __VA_ARGS__)
#endif /* __UFO_ROOF_ERROR_H */
diff --git a/src/ufo-roof-read-file.c b/src/ufo-roof-read-file.c
index de8391e..a5eb69b 100644
--- a/src/ufo-roof-read-file.c
+++ b/src/ufo-roof-read-file.c
@@ -23,14 +23,14 @@ static void ufo_roof_read_file_free(UfoRoofReadInterface *iface) {
if (reader->fname)
g_free(reader->fname);
- if (reader->fd >= 0)
+ if (reader->fd)
fclose(reader->fd);
free(reader);
}
}
-static guint ufo_roof_read_file(UfoRoofReadInterface *iface, void *buffers, GError **error) {
+static guint ufo_roof_read_file(UfoRoofReadInterface *iface, uint8_t *buffers, GError **error) {
UfoRoofReadFile *reader = (UfoRoofReadFile*)iface;
UfoRoofConfig *cfg = reader->cfg;
diff --git a/src/ufo-roof-read-socket.c b/src/ufo-roof-read-socket.c
index b72e9d0..f213d99 100644
--- a/src/ufo-roof-read-socket.c
+++ b/src/ufo-roof-read-socket.c
@@ -29,7 +29,7 @@ static void ufo_roof_read_socket_free(UfoRoofReadInterface *iface) {
}
}
-static guint ufo_roof_read_socket(UfoRoofReadInterface *iface, void *buf, GError **error) {
+static guint ufo_roof_read_socket(UfoRoofReadInterface *iface, uint8_t *buf, GError **error) {
struct timespec timeout_ts;
UfoRoofReadSocket *reader = (UfoRoofReadSocket*)iface;
@@ -44,7 +44,7 @@ static guint ufo_roof_read_socket(UfoRoofReadInterface *iface, void *buf, GError
// FIXME: Is it optimal? Auto-tune max_packets? Combine read & build?
memset(msg, 0, sizeof(msg));
memset(msgvec, 0, sizeof(msgvec));
- for (int i = 0; i < cfg->max_packets; i++) {
+ for (guint i = 0; i < cfg->max_packets; i++) {
msgvec[i].iov_base = buf + i * cfg->max_packet_size;
msgvec[i].iov_len = cfg->max_packet_size;
msg[i].msg_hdr.msg_iov = &msgvec[i];
diff --git a/src/ufo-roof-read.h b/src/ufo-roof-read.h
index 50dbdf3..5f0853c 100644
--- a/src/ufo-roof-read.h
+++ b/src/ufo-roof-read.h
@@ -5,7 +5,7 @@
typedef struct _UfoRoofReadInterface UfoRoofReadInterface;
-typedef guint (*UfoRoofReaderRead)(UfoRoofReadInterface *reader, void *buf, GError **error);
+typedef guint (*UfoRoofReaderRead)(UfoRoofReadInterface *reader, uint8_t *buf, GError **error);
typedef void (*UfoRoofReaderClose)(UfoRoofReadInterface *reader);
struct _UfoRoofReadInterface {
diff --git a/src/ufo-roof.h b/src/ufo-roof.h
index c3edda2..d9d3a57 100644
--- a/src/ufo-roof.h
+++ b/src/ufo-roof.h
@@ -5,7 +5,7 @@
#include "ufo-roof-error.h"
#define UFO_ROOF_PACKET_HEADER(buf) ((UfoRoofPacketHeader*)(buf))
-#define UFO_ROOF_PACKET_BLOCK_HEADER(buf, cfg) ((UfoRoofPacketBlockHeader*)(((void*)buf) + cfg->max_packets * cfg->max_packet_size))
+#define UFO_ROOF_PACKET_BLOCK_HEADER(buf, cfg) ((UfoRoofPacketBlockHeader*)(((uint8_t*)buf) + cfg->max_packets * cfg->max_packet_size))
typedef struct {
uint32_t packet_id; // Sequential Packet ID (numbered from 0)