Module: wine Branch: master Commit: 4c7f394b74f07aebb4793b88e79dd979e7e61ebb URL: http://source.winehq.org/git/wine.git/?a=commit;h=4c7f394b74f07aebb4793b88e7...
Author: Andrew Talbot andrew.talbot@talbotville.com Date: Mon Sep 12 23:18:01 2011 +0100
winspool.drv: Const-correctness fix.
---
dlls/winspool.drv/info.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index cb74482..abc8478 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -516,6 +516,8 @@ static BOOL CUPS_LoadPrinters(void) static BOOL PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) { PRINTER_INFO_2A pinfo2a; + const char *r; + size_t name_len; char *e,*s,*name,*prettyname,*devname; BOOL ret = FALSE, set_default = FALSE; char *port = NULL, *env_default; @@ -523,14 +525,17 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) { WCHAR devnameW[MAX_PATH];
while (isspace(*pent)) pent++; - s = strchr(pent,':'); - if(s) *s='\0'; - name = HeapAlloc(GetProcessHeap(), 0, strlen(pent) + 1); - strcpy(name,pent); - if(s) { - *s=':'; - pent = s; - } else + r = strchr(pent,':'); + if (r) + name_len = r - pent; + else + name_len = strlen(pent); + name = HeapAlloc(GetProcessHeap(), 0, name_len + 1); + memcpy(name, pent, name_len); + name[name_len] = '\0'; + if (r) + pent = r; + else pent = "";
TRACE("name=%s entry=%s\n",name, pent);