summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-07-23 18:42:39 +0200
committerMichel Dänzer <michel@daenzer.net>2018-07-23 18:44:32 +0200
commitf3b2ed37d683f8616a0a31ff63133ddb8fe1a4a3 (patch)
treeef1943d5faf13403f08acf2dca65afdf846300dc /src
parent5f06d6b8ba570b500956ad26fee711d5ac427818 (diff)
Use strcpy for RandR output property names
Instead of strncpy with the string length. Avoids new warnings with GCC 8: ../../src/drmmode_display.c: In function ‘drmmode_output_create_resources’: ../../src/drmmode_display.c:2240:2: warning: ‘strncpy’ output truncated before terminating nul copying 8 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->name, "TearFree", 8); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/drmmode_display.c:2244:2: warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->enums[0].name, "off", 3); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/drmmode_display.c:2245:2: warning: ‘strncpy’ output truncated before terminating nul copying 2 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->enums[1].name, "on", 2); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/drmmode_display.c:2247:2: warning: ‘strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->enums[2].name, "auto", 4); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reviewed-by: Slava Abramov <slava.abramov@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b3e7540..92f58c1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2211,14 +2211,14 @@ static void drmmode_output_create_resources(xf86OutputPtr output)
/* Userspace-only property for TearFree */
tearfree_prop = calloc(1, sizeof(*tearfree_prop));
tearfree_prop->flags = DRM_MODE_PROP_ENUM;
- strncpy(tearfree_prop->name, "TearFree", 8);
+ strcpy(tearfree_prop->name, "TearFree");
tearfree_prop->count_enums = 3;
tearfree_prop->enums = calloc(tearfree_prop->count_enums,
sizeof(*tearfree_prop->enums));
- strncpy(tearfree_prop->enums[0].name, "off", 3);
- strncpy(tearfree_prop->enums[1].name, "on", 2);
+ strcpy(tearfree_prop->enums[0].name, "off");
+ strcpy(tearfree_prop->enums[1].name, "on");
tearfree_prop->enums[1].value = 1;
- strncpy(tearfree_prop->enums[2].name, "auto", 4);
+ strcpy(tearfree_prop->enums[2].name, "auto");
tearfree_prop->enums[2].value = 2;
drmmode_output->props[j].mode_prop = tearfree_prop;
drmmode_output->props[j].value = info->tear_free;