From b067fd8539eb2348bf9f3928ff62006fb6021d7c Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 6 Apr 2004 17:47:24 +0000 Subject: [PATCH] Fixed charset spec parsing for ZOOM_record_get --- src/zoom-c.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/zoom-c.c b/src/zoom-c.c index 0c6f48e..b5241f3 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.25 2004-02-23 09:26:11 adam Exp $ + * $Id: zoom-c.c,v 1.26 2004-04-06 17:47:24 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -987,7 +987,7 @@ static zoom_ret ZOOM_connection_send_init (ZOOM_connection c) ZOOM_options_get(c->options, "implementationName"), odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.25 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.26 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = odr_prepend(c->odr_out, @@ -1589,21 +1589,23 @@ ZOOM_record_get (ZOOM_record rec, const char *type_spec, int *len) i++; if (!strncmp(type_spec+i, "charset=", 8)) { - cp = type_spec+i+8; - for (i = 0; cp[i] && i < sizeof(charset)-1; i++) + int j = 0; + i = i + 8; /* skip charset= */ + for (j = 0; type_spec[i] && j < sizeof(charset)-1; i++, j++) { - if (cp[i] == ';' || cp[i] == ' ') + if (type_spec[i] == ';' || type_spec[i] == ' ') break; - charset[i] = cp[i]; + charset[j] = cp[i]; } - charset[i] = '\0'; + charset[j] = '\0'; } else if (!strncmp(type_spec+i, "xpath=", 6)) { - cp = type_spec+i+6; - for (i = 0; cp[i] && i < sizeof(xpath)-1; i++) - xpath[i] = cp[i]; - xpath[i] = '\0'; + int j = 0; + i = i + 6; + for (j = 0; type_spec[i] && j < sizeof(xpath)-1; i++, j++) + xpath[j] = cp[i]; + xpath[j] = '\0'; } while (type_spec[i] == ' ') i++; -- 1.7.10.4