/* This file is part of the Zebra server.
- Copyright (C) 1994-2011 Index Data
+ Copyright (C) Index Data
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
*/
/*
- * This module converts data1 tree to Z39.50 Explain records
+ * This module converts data1 tree to Z39.50 Explain records
*/
#if HAVE_CONFIG_H
c = c->child;
if (!is_data_tag (eh, c) || c->u.data.len > 63)
return 0;
- yaz_snprintf(oidstr, sizeof(oidstr)-1,
+ yaz_snprintf(oidstr, sizeof(oidstr)-1,
"%.*s", c->u.data.len, c->u.data.data);
return yaz_string_to_oid_odr(yaz_oid_std(),
res[i++] = f_oid (eh, c, oclass);
return res;
}
-
+
char **f_string_seq (ExpHandle *eh, data1_node *n, int *num)
{
char **res;
*wp = Z_DatabaseInfo_approxNumber;
else
return 0;
- if (!c->child || c->child->which != DATA1N_data ||
+ if (!c->child || c->child->which != DATA1N_data ||
c->child->u.data.len >= sizeof(intbuf))
return 0;
sprintf(intbuf, "%.*s", c->child->u.data.len, c->child->u.data.data);
Z_ContactInfo *res = (Z_ContactInfo *)
odr_malloc (eh->o, sizeof(*res));
data1_node *c;
-
+
res->name = 0;
res->description = 0;
res->address = 0;
res->email = 0;
res->phone = 0;
-
+
for (c = n->child; c; c = c->next)
{
switch (is_numeric_tag (eh, c))
data1_node *c;
Z_DatabaseList *res;
int i = 0;
-
+
for (c = n->child; c; c = c->next)
{
- if (!is_numeric_tag (eh, c) != 102)
+ if (!is_numeric_tag (eh, c) != 102)
continue;
++i;
}
return NULL;
res = (Z_DatabaseList *)odr_malloc (eh->o, sizeof(*res));
-
+
res->num_databases = i;
res->databases = (char **)odr_malloc (eh->o, sizeof(*res->databases) * i);
i = 0;
Z_NetworkAddressIA *res = (Z_NetworkAddressIA *)
odr_malloc (eh->o, sizeof(*res));
data1_node *c;
-
+
res->hostAddress = 0;
res->port = 0;
return res;
}
-static Z_NetworkAddress **f_networkAddresses(ExpHandle *eh, data1_node *n,
+static Z_NetworkAddress **f_networkAddresses(ExpHandle *eh, data1_node *n,
int *num)
{
Z_NetworkAddress **res = NULL;
data1_node *c;
int i = 0;
-
+
*num = 0;
for (c = n->child; c; c = c->next)
{
if (*num)
res = (Z_NetworkAddress **) odr_malloc (eh->o, sizeof(*res) * (*num));
-
+
for (c = n->child; c; c = c->next)
{
switch (is_numeric_tag (eh, c))
}
if (res->num_categories)
res->categories =
- (Z_CategoryInfo **)odr_malloc (eh->o, res->num_categories
+ (Z_CategoryInfo **)odr_malloc (eh->o, res->num_categories
* sizeof(*res->categories));
for (n = c->child; n; n = n->next)
{
res->num_languages = 0;
res->languages = NULL;
res->commonAccessInfo = 0;
-
+
for (c = n->child; c; c = c->next)
{
int i = 0;
case 111: res->welcomeMessage = f_humstring(eh, c); break;
case 112: res->contactInfo = f_contactInfo(eh, c); break;
case 113: res->description = f_humstring(eh, c); break;
- case 114:
+ case 114:
res->num_nicknames = 0;
for (n = c->child; n; n = n->next)
{
}
if (res->num_nicknames)
res->nicknames =
- (char **)odr_malloc (eh->o, res->num_nicknames
+ (char **)odr_malloc (eh->o, res->num_nicknames
* sizeof(*res->nicknames));
for (n = c->child; n; n = n->next)
{
res->dbCombinations[i++] = f_databaseList (eh, n);
}
break;
- case 119:
+ case 119:
res->addresses =
f_networkAddresses (eh, c, &res->num_addresses);
break;
res->supplierContactInfo = 0;
res->submissionContactInfo = 0;
res->accessInfo = 0;
-
+
for (c = n->child; c; c = c->next)
{
int i = 0;
}
if (res->num_nicknames)
res->nicknames =
- (char **)odr_malloc (eh->o, res->num_nicknames
+ (char **)odr_malloc (eh->o, res->num_nicknames
* sizeof(*res->nicknames));
for (n = c->child; n; n = n->next)
{
}
if (res->num_keywords)
res->keywords =
- (Z_HumanString **)odr_malloc (eh->o, res->num_keywords
+ (Z_HumanString **)odr_malloc (eh->o, res->num_keywords
* sizeof(*res->keywords));
for (n = c->child; n; n = n->next)
{
odr_malloc(eh->o, sizeof(*res));
data1_node *c;
int i = 0;
-
+
res->name = 0;
res->description = 0;
res->attributeValue = 0;
Z_AttributeSetDetails *res = (Z_AttributeSetDetails *)
odr_malloc(eh->o, sizeof(*res));
data1_node *c;
-
+
res->attributeSet = 0;
res->num_attributesByType = 0;
res->attributesByType = 0;
res->which = Z_Explain_categoryList;
if (!(res->u.categoryList = f_categoryList(&eh, n)))
return 0;
- return res;
+ return res;
case 2:
res->which = Z_Explain_targetInfo;
if (!(res->u.targetInfo = f_targetInfo(&eh, n)))
res->which = Z_Explain_attributeSetInfo;
if (!(res->u.attributeSetInfo = f_attributeSetInfo(&eh, n)))
return 0;
- return res;
+ return res;
case 10:
res->which = Z_Explain_attributeDetails;
if (!(res->u.attributeDetails = f_attributeDetails(&eh, n)))