aboutsummaryrefslogtreecommitdiffstats
path: root/src/servers
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-04 20:51:28 +0200
committerMattias Andrée <maandree@kth.se>2016-08-04 20:51:28 +0200
commitd1cb6353e53ccd29f8fa7f677d1468803e0d0379 (patch)
treec8e6e5f2572b2341c1205ecd3dba062a6a40f877 /src/servers
parentUpdate get-gamma-info protocol: gamut information (diff)
downloadcoopgammad-d1cb6353e53ccd29f8fa7f677d1468803e0d0379.tar.gz
coopgammad-d1cb6353e53ccd29f8fa7f677d1468803e0d0379.tar.bz2
coopgammad-d1cb6353e53ccd29f8fa7f677d1468803e0d0379.tar.xz
Fix bugs
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/servers')
-rw-r--r--src/servers/gamma.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/servers/gamma.c b/src/servers/gamma.c
index 3eec7ec..ff0fc8e 100644
--- a/src/servers/gamma.c
+++ b/src/servers/gamma.c
@@ -48,7 +48,7 @@ int handle_get_gamma_info(size_t conn, const char* restrict message_id, const ch
char depth[3];
const char* supported;
const char* colourspace;
- char* gamut[8 * sizeof("White x: 1023")];
+ char gamut[8 * sizeof("White x: 1023")];
size_t n;
if (crtc == NULL) return send_error("protocol error: 'CRTC' header omitted");
@@ -160,8 +160,7 @@ static void parse_edid(struct output* restrict output)
{
const unsigned char* restrict edid = (const unsigned char*)(output->name);
size_t i;
- unsigned char sum;
- int analogue;
+ int sum, analogue;
output->red_x = output->green_x = output->blue_x = output->white_x = 0;
output->red_y = output->green_y = output->blue_y = output->white_y = 0;
@@ -172,11 +171,11 @@ static void parse_edid(struct output* restrict output)
return;
}
- if (strlen(edid) < 128)
+ if (strlen((const char*)edid) < 128)
return;
for (i = 0, sum = 0; i < 128; i++)
- sum += edid[i];
- if (sum != 0)
+ sum += (int)edid[i];
+ if ((sum & 0xFF) != 0)
return;
if ((edid[0] != 0) || (edid[7] != 0))
return;