From 0d42bb835c37442eeffa77f24ad2fdf876f8f4da Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 16 Jun 2009 10:59:41 +0200 Subject: [PATCH] Add type casts to make YAZ C++ compile --- client/client.c | 12 +++++++----- src/xmalloc.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/client/client.c b/client/client.c index f528d96..a58a7b3 100644 --- a/client/client.c +++ b/client/client.c @@ -760,7 +760,7 @@ int cmd_authentication(const char *arg) } else if (r == 1) { - auth = nmem_malloc(nmem_auth, sizeof(*auth)); + auth = (Z_IdAuthentication *) nmem_malloc(nmem_auth, sizeof(*auth)); if (!strcmp(args[0], "-")) { auth->which = Z_IdAuthentication_anonymous; @@ -776,9 +776,10 @@ int cmd_authentication(const char *arg) } else if (r == 2) { - auth = nmem_malloc(nmem_auth, sizeof(*auth)); + auth = (Z_IdAuthentication *) nmem_malloc(nmem_auth, sizeof(*auth)); auth->which = Z_IdAuthentication_idPass; - auth->u.idPass = nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); + auth->u.idPass = (Z_IdPass *) + nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); auth->u.idPass->groupId = NULL; auth->u.idPass->userId = !strcmp(args[0], "-") ? 0 : args[0]; auth->u.idPass->password = !strcmp(args[1], "-") ? 0 : args[1]; @@ -787,9 +788,10 @@ int cmd_authentication(const char *arg) } else if (r == 3) { - auth = nmem_malloc(nmem_auth, sizeof(*auth)); + auth = (Z_IdAuthentication*) nmem_malloc(nmem_auth, sizeof(*auth)); auth->which = Z_IdAuthentication_idPass; - auth->u.idPass = nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); + auth->u.idPass = (Z_IdPass *) + nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); auth->u.idPass->groupId = args[1]; auth->u.idPass->userId = args[0]; auth->u.idPass->password = args[2]; diff --git a/src/xmalloc.c b/src/xmalloc.c index 7042079..d4e2300 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -348,7 +348,7 @@ char *xstrndup_f(const char *s, size_t n, const char *file, int line) if (l < n) return xstrdup_f(s, file, line); { - char *a = xmalloc_f(n+1, file, line); + char *a = (char*) xmalloc_f(n+1, file, line); memcpy(a, s, n); a[n] = '\0'; return a; -- 1.7.10.4