From a7f0392ccb88f7faa7ca3f15d4ccfcf637896d1d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 10 Jul 2016 22:15:24 +0200 Subject: Fix warnings (and two errors) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/filter.c | 8 ++++---- src/gammad.c | 2 +- src/output.c | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/filter.c b/src/filter.c index 80e3ed1..508fd5f 100644 --- a/src/filter.c +++ b/src/filter.c @@ -89,7 +89,7 @@ size_t filter_marshal(const struct filter* this, char* buf, size_t ramps_size) { if (buf != NULL) memcpy(buf + off, this->ramps, ramps_size); - off += n; + off += ramps_size; } return off; @@ -116,10 +116,10 @@ size_t filter_unmarshal(struct filter* this, const char* buf, size_t ramps_size) this->class = NULL; this->ramps = NULL; - this->priority = *(int64_t*)(buf + off); + this->priority = *(const int64_t*)(buf + off); off += sizeof(int64_t); - this->lifespan = *(enum lifespan*)(buf + off); + this->lifespan = *(const enum lifespan*)(buf + off); off += sizeof(enum lifespan); if (nonnulls & 1) @@ -142,7 +142,7 @@ size_t filter_unmarshal(struct filter* this, const char* buf, size_t ramps_size) { if (!(this->ramps = memdup(buf + off, ramps_size))) goto fail; - off += n; + off += ramps_size; } return off; diff --git a/src/gammad.c b/src/gammad.c index 54d2109..78318f6 100644 --- a/src/gammad.c +++ b/src/gammad.c @@ -70,7 +70,7 @@ int main(int argc, char** argv) struct output* outputs = NULL; size_t i, j, n, n0, crtcs_n = 0; - argv0 = argv[0]; + argv0 = argc ? argv[0] : "gammad"; memset(&site, 0, sizeof(site)); diff --git a/src/output.c b/src/output.c index 48a51a8..2e399bf 100644 --- a/src/output.c +++ b/src/output.c @@ -151,22 +151,22 @@ size_t output_unmarshal(struct output* this, const char* buf) this->crtc = NULL; this->name = NULL; - this->depth = *(signed*)(buf + off); + this->depth = *(const signed*)(buf + off); off += sizeof(signed); - this->red_size = *(size_t*)(buf + off); + this->red_size = *(const size_t*)(buf + off); off += sizeof(size_t); - this->green_size = *(size_t*)(buf + off); + this->green_size = *(const size_t*)(buf + off); off += sizeof(size_t); - this->blue_size = *(size_t*)(buf + off); + this->blue_size = *(const size_t*)(buf + off); off += sizeof(size_t); - this->ramps_size = *(size_t*)(buf + off); + this->ramps_size = *(const size_t*)(buf + off); off += sizeof(size_t); - this->supported = *(enum libgamma_decision*)(buf + off); + this->supported = *(const enum libgamma_decision*)(buf + off); off += sizeof(enum libgamma_decision); n = strlen(buf + off) + 1; @@ -179,7 +179,7 @@ size_t output_unmarshal(struct output* this, const char* buf) if (n == 0) return 0; - this->table_size = this->table_alloc = *(size_t*)(buf + off); + this->table_size = this->table_alloc = *(const size_t*)(buf + off); off += sizeof(size_t); if (this->table_size > 0) { -- cgit v1.2.3-70-g09d2