aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-10 22:15:24 +0200
committerMattias Andrée <maandree@kth.se>2016-07-10 22:15:24 +0200
commita7f0392ccb88f7faa7ca3f15d4ccfcf637896d1d (patch)
tree000db8e2281e951d432b5da7ae212dfc65c6ceb6 /src
parentAdd makefile (diff)
downloadcoopgammad-a7f0392ccb88f7faa7ca3f15d4ccfcf637896d1d.tar.gz
coopgammad-a7f0392ccb88f7faa7ca3f15d4ccfcf637896d1d.tar.bz2
coopgammad-a7f0392ccb88f7faa7ca3f15d4ccfcf637896d1d.tar.xz
Fix warnings (and two errors)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src')
-rw-r--r--src/filter.c8
-rw-r--r--src/gammad.c2
-rw-r--r--src/output.c14
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)
{