[PATCH] kernel32: Make TERM_dbkey_init const.

Alex Henrie alexhenrie24 at gmail.com
Tue Oct 6 22:06:21 CDT 2015


Cc: Eric Pouech <eric.pouech at orange.fr>

This gives the compiler more freedom to optimize, and will hopefully
resolve Coverity #214998, which complains that the strings might have
been modified and their null terminators removed before they are copied.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/kernel32/term.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/term.c b/dlls/kernel32/term.c
index 814b937..171476a 100644
--- a/dlls/kernel32/term.c
+++ b/dlls/kernel32/term.c
@@ -227,7 +227,7 @@ struct dbkey_init
     struct dbkey_descr  descr;
 };
 
-static struct dbkey_init TERM_dbkey_init[] = {
+static const struct dbkey_init TERM_dbkey_init[] = {
     {"kcud1", "kDN",  {dbk_complex, 0x50, 0x28, 0}},
     {"kcuu1", "kUP",  {dbk_complex, 0x48, 0x26, 0}},
     {"kcub1", "kLFT", {dbk_complex, 0x4b, 0x25, 0}},
@@ -342,7 +342,7 @@ static int  TERM_dbkey_cmp(const void* p1, const void* p2)
     return strcmp(kp1->string, kp2->string);
 }
 
-static BOOL TERM_AddKeyDescr(const char* string, struct dbkey_descr* descr)
+static BOOL TERM_AddKeyDescr(const char* string, const struct dbkey_descr* descr)
 {
     if (!string || string == (const char*)-1) return TRUE;
     if (!TERM_dbkey)
-- 
2.6.1




More information about the wine-patches mailing list