summaryrefslogtreecommitdiff
path: root/Build/source/utils/t1utils/TLpatches/patch-03-warnings
blob: da2e03e98d68c8e141e3a8f1d70f9bd3ac72c3c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	Avoid compiler warnings (gcc's -Wcast-qual).

diff -ur t1utils-1.41.orig/clp.c t1utils-1.41/clp.c
--- t1utils-1.41.orig/clp.c	Thu Aug 17 00:20:27 2017
+++ t1utils-1.41/clp.c	Mon Aug 28 15:43:58 2017
@@ -1095,22 +1095,28 @@
 parse_int(Clp_Parser* clp, const char* arg, int complain, void* user_data)
 {
     const char *val;
+    char *temp;
     uintptr_t type = (uintptr_t) user_data;
     if (*arg == 0 || isspace((unsigned char) *arg)
 	|| ((type & 1) && *arg == '-'))
 	val = arg;
     else if (type & 1) { /* unsigned */
 #if HAVE_STRTOUL
-	clp->val.ul = strtoul(arg, (char **) &val, 0);
+	clp->val.ul = strtoul(arg, &temp, 0);
+	val = temp;
 #else
 	/* don't bother really trying to do it right */
 	if (arg[0] == '-')
 	    val = arg;
-	else
-	    clp->val.l = strtol(arg, (char **) &val, 0);
+	else {
+	    clp->val.l = strtol(arg, &temp, 0);
+	    val = temp;
+	}
 #endif
-    } else
-	clp->val.l = strtol(arg, (char **) &val, 0);
+    } else {
+	clp->val.l = strtol(arg, &temp, 0);
+	val = temp;
+    }
     if (type <= 1)
         clp->val.u = (unsigned) clp->val.ul;
     if (*arg != 0 && *val == 0)
@@ -1130,11 +1136,14 @@
 parse_double(Clp_Parser *clp, const char *arg, int complain, void *user_data)
 {
     const char *val;
+    char *temp;
     (void)user_data;
     if (*arg == 0 || isspace((unsigned char) *arg))
 	val = arg;
-    else
-	clp->val.d = strtod(arg, (char **) &val);
+    else {
+	clp->val.d = strtod(arg, &temp);
+	val = temp;
+    }
     if (*arg != 0 && *val == 0)
 	return 1;
     else {