Fix 'invalid conversion from const char* to char*' in CORD_batched_chr_proc
authorJay Krell <jaykrell@microsoft.com>
Mon, 19 Feb 2018 11:43:37 +0000 (03:43 -0800)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 20 Feb 2018 20:23:07 +0000 (23:23 +0300)
Issue #206 (bdwgc).

Add const to the variable receiving strchr() result for C++ compatibility.

* cord/cordxtra.c (CORD_batched_chr_proc): Change type of occ local
variable from char* to const char*; remove register keyword for occ.

cord/cordxtra.c

index 827b5db..97060a8 100644 (file)
@@ -332,9 +332,9 @@ int CORD_rchr_proc(char c, void * client_data)
 int CORD_batched_chr_proc(const char *s, void * client_data)
 {
     register chr_data * d = (chr_data *)client_data;
-    register char * occ = strchr(s, d -> target);
+    const char * occ = strchr(s, d -> target);
 
-    if (occ == 0) {
+    if (NULL == occ) {
         d -> pos += strlen(s);
         return(0);
     } else {