From 2715f6522ca62ab5dbc886c21ed18945743216f0 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 28 Sep 2011 11:26:40 +0200 Subject: [PATCH] Reformat --- src/cclerrms.c | 7 +- src/charneg.c | 97 +++++++-------- src/cql.y | 4 +- src/dirent.c | 18 +-- src/ill-get.c | 356 ++++++++++++++++++++++++++++---------------------------- src/nmemsdup.c | 14 +-- src/odr.c | 31 +++-- src/pquery.c | 2 +- src/prt-ext.c | 6 +- src/seshigh.c | 4 +- src/siconv.c | 2 +- src/sortspec.c | 6 +- src/srwutil.c | 6 +- src/tcpdchk.c | 4 +- src/xmalloc.c | 8 +- src/zget.c | 14 +-- 16 files changed, 283 insertions(+), 296 deletions(-) diff --git a/src/cclerrms.c b/src/cclerrms.c index 30a6969..61e63a0 100644 --- a/src/cclerrms.c +++ b/src/cclerrms.c @@ -31,12 +31,7 @@ static char *err_msg_array[] = { "Right truncation not supported" }; -/* - * ccl_err_msg: return name of CCL error - * ccl_errno: Error no. - * return: Name of error. - */ -const char *ccl_err_msg (int ccl_errno) +const char *ccl_err_msg(int ccl_errno) { return err_msg_array[ccl_errno]; } diff --git a/src/charneg.c b/src/charneg.c index 9701cda..caff4af 100644 --- a/src/charneg.c +++ b/src/charneg.c @@ -24,20 +24,18 @@ static Z_External* z_ext_record2(ODR o, const char *buf) Z_External *p; int len = strlen(buf); - if (!(p = (Z_External *)odr_malloc(o, sizeof(*p)))) return 0; - + if (!(p = (Z_External *)odr_malloc(o, sizeof(*p)))) + return 0; p->descriptor = 0; p->indirect_reference = 0; p->direct_reference = odr_oiddup(o, yaz_oid_negot_charset_id); p->which = Z_External_octet; - if (!(p->u.octet_aligned = (Odr_oct *)odr_malloc(o, sizeof(Odr_oct)))) { + if (!(p->u.octet_aligned = (Odr_oct *)odr_malloc(o, sizeof(Odr_oct)))) return 0; - } - if (!(p->u.octet_aligned->buf = (unsigned char *)odr_malloc(o, len))) { + if (!(p->u.octet_aligned->buf = (unsigned char *)odr_malloc(o, len))) return 0; - } p->u.octet_aligned->len = p->u.octet_aligned->size = len; memcpy(p->u.octet_aligned->buf, buf, len); @@ -48,7 +46,6 @@ static int get_form(const char *charset) { int form = -1; - if (!yaz_matchstr(charset, "UCS-2")) form = 2; if (!yaz_matchstr(charset, "UCS-4")) @@ -61,7 +58,7 @@ static int get_form(const char *charset) return form; } -static char *set_form (Odr_oid *encoding) +static char *set_form(Odr_oid *encoding) { static char *charset = 0; if ( oid_oidlen(encoding) != 6) @@ -79,7 +76,7 @@ static char *set_form (Odr_oid *encoding) static Z_OriginProposal_0 *z_get_OriginProposal_0(ODR o, const char *charset) { - int form = get_form (charset); + int form = get_form(charset); Z_OriginProposal_0 *p0 = (Z_OriginProposal_0*)odr_malloc(o, sizeof(*p0)); @@ -89,12 +86,12 @@ static Z_OriginProposal_0 *z_get_OriginProposal_0(ODR o, const char *charset) { /* ISO 10646 (UNICODE) */ char oidname[20]; - Z_Iso10646 *is = (Z_Iso10646 *) odr_malloc (o, sizeof(*is)); + Z_Iso10646 *is = (Z_Iso10646 *) odr_malloc(o, sizeof(*is)); p0->which = Z_OriginProposal_0_iso10646; p0->u.iso10646 = is; is->collections = 0; - sprintf (oidname, "1.0.10646.1.0.%d", form); - is->encodingLevel = odr_getoidbystr (o, oidname); + sprintf(oidname, "1.0.10646.1.0.%d", form); + is->encodingLevel = odr_getoidbystr(o, oidname); } else { /* private ones */ @@ -122,31 +119,27 @@ static Z_OriginProposal *z_get_OriginProposal( memset(p, 0, sizeof(*p)); p->recordsInSelectedCharSets = (bool_t *)odr_malloc(o, sizeof(bool_t)); - *p->recordsInSelectedCharSets = (selected) ? 1:0; + *p->recordsInSelectedCharSets = (selected) ? 1 : 0; - if (charsets && num_charsets) { - + if (charsets && num_charsets) + { p->num_proposedCharSets = num_charsets; p->proposedCharSets = (Z_OriginProposal_0**) odr_malloc(o, num_charsets*sizeof(Z_OriginProposal_0*)); - for (i = 0; iproposedCharSets[i] = z_get_OriginProposal_0(o, charsets[i]); } - if (langs && num_langs) { - + if (langs && num_langs) + { p->num_proposedlanguages = num_langs; - p->proposedlanguages = (char **) odr_malloc(o, num_langs*sizeof(char *)); - for (i = 0; iproposedlanguages[i] = (char *)langs[i]; - - } } return p; } @@ -219,7 +212,6 @@ static Z_TargetResponse *z_get_TargetResponse(ODR o, const char *charset, int form = get_form(charset); memset(p, 0, sizeof(*p)); - if (form > 0) { char oidname[20]; @@ -228,7 +220,7 @@ static Z_TargetResponse *z_get_TargetResponse(ODR o, const char *charset, p->which = Z_TargetResponse_iso10646; p->u.iso10646 = is; is->collections = 0; - sprintf (oidname, "1.0.10646.1.0.%d", form); + sprintf(oidname, "1.0.10646.1.0.%d", form); is->encodingLevel = odr_getoidbystr (o, oidname); } else @@ -246,9 +238,9 @@ static Z_TargetResponse *z_get_TargetResponse(ODR o, const char *charset, z_ext_record2(o, charset); } p->recordsInSelectedCharSets = (bool_t *)odr_malloc(o, sizeof(bool_t)); - *p->recordsInSelectedCharSets = (selected) ? 1:0; + *p->recordsInSelectedCharSets = (selected) ? 1 : 0; - p->selectedLanguage = lang ? (char *)odr_strdup(o, lang) : 0; + p->selectedLanguage = lang ? (char *) odr_strdup(o, lang) : 0; return p; } @@ -279,11 +271,12 @@ Z_CharSetandLanguageNegotiation *yaz_get_charneg_record(Z_OtherInformation *p) if (!p) return 0; - for (i = 0; i < p->num_elements; i++) { + for (i = 0; i < p->num_elements; i++) + { Z_External *pext; if ((p->list[i]->which == Z_OtherInfo_externallyDefinedInfo) && - (pext = p->list[i]->information.externallyDefinedInfo)) { - + (pext = p->list[i]->information.externallyDefinedInfo)) + { if (!oid_oidcmp(pext->direct_reference, yaz_oid_negot_charset_3) && pext->which == Z_External_charSetandLanguageNegotiation) { @@ -302,7 +295,8 @@ int yaz_del_charneg_record(Z_OtherInformation **p) if (!*p) return 0; - for (i = 0; i < (*p)->num_elements; i++) { + for (i = 0; i < (*p)->num_elements; i++) + { Z_External *pext; if (((*p)->list[i]->which == Z_OtherInfo_externallyDefinedInfo) && (pext = (*p)->list[i]->information.externallyDefinedInfo)) @@ -315,7 +309,7 @@ int yaz_del_charneg_record(Z_OtherInformation **p) else { --((*p)->num_elements); - for(; i < (*p)->num_elements; i++) + for (; i < (*p)->num_elements; i++) (*p)->list[i] = (*p)->list[i+1]; } return 1; @@ -343,33 +337,32 @@ void yaz_get_proposal_charneg(NMEM mem, Z_CharSetandLanguageNegotiation *p, (*charsets) = (char **) nmem_malloc(mem, pro->num_proposedCharSets * sizeof(char *)); - for (i=0; inum_proposedCharSets; i++) + for (i = 0; i < pro->num_proposedCharSets; i++) { (*charsets)[i] = 0; if (pro->proposedCharSets[i]->which == Z_OriginProposal_0_private && pro->proposedCharSets[i]->u.zprivate->which == - Z_PrivateCharacterSet_externallySpecified) { - + Z_PrivateCharacterSet_externallySpecified) + { Z_External *pext = pro->proposedCharSets[i]->u.zprivate->u.externallySpecified; - if (pext->which == Z_External_octet) { - + if (pext->which == Z_External_octet) + { (*charsets)[i] = (char *) nmem_malloc(mem, (1+pext->u.octet_aligned->len) * sizeof(char)); - memcpy ((*charsets)[i], pext->u.octet_aligned->buf, - pext->u.octet_aligned->len); + memcpy((*charsets)[i], pext->u.octet_aligned->buf, + pext->u.octet_aligned->len); (*charsets)[i][pext->u.octet_aligned->len] = 0; - } } else if (pro->proposedCharSets[i]->which == Z_OriginProposal_0_iso10646) - (*charsets)[i] = set_form ( + (*charsets)[i] = set_form( pro->proposedCharSets[i]->u.iso10646->encodingLevel); } } @@ -386,14 +379,14 @@ void yaz_get_proposal_charneg(NMEM mem, Z_CharSetandLanguageNegotiation *p, (*langs) = (char **) nmem_malloc(mem, pro->num_proposedlanguages * sizeof(char *)); - for (i=0; inum_proposedlanguages; i++) + for (i = 0; i < pro->num_proposedlanguages; i++) (*langs)[i] = nmem_strdup(mem, pro->proposedlanguages[i]); } else *num_langs = 0; } - if(pro->recordsInSelectedCharSets && selected) + if (pro->recordsInSelectedCharSets && selected) *selected = *pro->recordsInSelectedCharSets; } @@ -404,25 +397,25 @@ void yaz_get_response_charneg(NMEM mem, Z_CharSetandLanguageNegotiation *p, Z_TargetResponse *res = p->u.response; if (charset && res->which == Z_TargetResponse_private && - res->u.zprivate->which == Z_PrivateCharacterSet_externallySpecified) { - + res->u.zprivate->which == Z_PrivateCharacterSet_externallySpecified) + { Z_External *pext = res->u.zprivate->u.externallySpecified; - if (pext->which == Z_External_octet) { - + if (pext->which == Z_External_octet) + { *charset = (char *) nmem_malloc(mem, (1+pext->u.octet_aligned->len)*sizeof(char)); - memcpy (*charset, pext->u.octet_aligned->buf, - pext->u.octet_aligned->len); + memcpy(*charset, pext->u.octet_aligned->buf, + pext->u.octet_aligned->len); (*charset)[pext->u.octet_aligned->len] = 0; } } if (charset && res->which == Z_TargetResponse_iso10646) - *charset = set_form (res->u.iso10646->encodingLevel); + *charset = set_form(res->u.iso10646->encodingLevel); if (lang && res->selectedLanguage) - *lang = nmem_strdup (mem, res->selectedLanguage); + *lang = nmem_strdup(mem, res->selectedLanguage); - if(selected && res->recordsInSelectedCharSets) + if (selected && res->recordsInSelectedCharSets) *selected = *res->recordsInSelectedCharSets; } /* diff --git a/src/cql.y b/src/cql.y index 5041a3d..128dc87 100644 --- a/src/cql.y +++ b/src/cql.y @@ -245,7 +245,7 @@ static void putb(YYSTYPE *lval, CQL_parser cp, int c) { char *nb = (char *) nmem_malloc(cp->nmem, (lval->size = lval->len * 2 + 20)); - memcpy (nb, lval->buf, lval->len); + memcpy(nb, lval->buf, lval->len); lval->buf = nb; } if (c) @@ -415,7 +415,7 @@ int cql_parser_stream(CQL_parser cp, CQL_parser cql_parser_create(void) { - CQL_parser cp = (CQL_parser) xmalloc (sizeof(*cp)); + CQL_parser cp = (CQL_parser) xmalloc(sizeof(*cp)); cp->top = 0; cp->getbyte = 0; diff --git a/src/dirent.c b/src/dirent.c index 3cf8ef9..ee83a8c 100644 --- a/src/dirent.c +++ b/src/dirent.c @@ -28,27 +28,27 @@ struct DIR { struct dirent entry; }; -DIR *opendir (const char *name) +DIR *opendir(const char *name) { char fullName[MAX_PATH+1]; - DIR *dd = malloc (sizeof(*dd)); + DIR *dd = malloc(sizeof(*dd)); if (!dd) return NULL; - strcpy (fullName, name); - strcat (fullName, "\\*.*"); + strcpy(fullName, name); + strcat(fullName, "\\*.*"); dd->handle = FindFirstFile(fullName, &dd->find_data); return dd; } -struct dirent *readdir (DIR *dd) +struct dirent *readdir(DIR *dd) { if (dd->handle == INVALID_HANDLE_VALUE) return NULL; - strcpy (dd->entry.d_name, dd->find_data.cFileName); + strcpy(dd->entry.d_name, dd->find_data.cFileName); if (!FindNextFile(dd->handle, &dd->find_data)) { - FindClose (dd->handle); + FindClose(dd->handle); dd->handle = INVALID_HANDLE_VALUE; } return &dd->entry; @@ -57,9 +57,9 @@ struct dirent *readdir (DIR *dd) void closedir(DIR *dd) { if (dd->handle != INVALID_HANDLE_VALUE) - FindClose (dd->handle); + FindClose(dd->handle); if (dd) - free (dd); + free(dd); } #endif diff --git a/src/ill-get.c b/src/ill-get.c index d9ec51d..78c9a60 100644 --- a/src/ill-get.c +++ b/src/ill-get.c @@ -13,19 +13,19 @@ #include #include -bool_t *ill_get_bool (struct ill_get_ctl *gc, const char *name, - const char *sub, int val) +bool_t *ill_get_bool(struct ill_get_ctl *gc, const char *name, + const char *sub, int val) { ODR o = gc->odr; char element[128]; const char *v; - bool_t *r = (bool_t *) odr_malloc (o, sizeof(*r)); + bool_t *r = (bool_t *) odr_malloc(o, sizeof(*r)); strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } v = (gc->f)(gc->clientData, element); @@ -38,7 +38,7 @@ bool_t *ill_get_bool (struct ill_get_ctl *gc, const char *name, } Odr_int *ill_get_int(struct ill_get_ctl *gc, const char *name, - const char *sub, Odr_int val) + const char *sub, Odr_int val) { ODR o = gc->odr; char element[128]; @@ -47,8 +47,8 @@ Odr_int *ill_get_int(struct ill_get_ctl *gc, const char *name, strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } v = (gc->f)(gc->clientData, element); if (v) @@ -56,24 +56,24 @@ Odr_int *ill_get_int(struct ill_get_ctl *gc, const char *name, return odr_intdup(o, val); } -Odr_int *ill_get_enumerated (struct ill_get_ctl *gc, const char *name, - const char *sub, Odr_int val) +Odr_int *ill_get_enumerated(struct ill_get_ctl *gc, const char *name, + const char *sub, Odr_int val) { return ill_get_int(gc, name, sub, val); } -ILL_String *ill_get_ILL_String_x (struct ill_get_ctl *gc, const char *name, - const char *sub, const char *vdefault) +ILL_String *ill_get_ILL_String_x(struct ill_get_ctl *gc, const char *name, + const char *sub, const char *vdefault) { - ILL_String *r = (ILL_String *) odr_malloc (gc->odr, sizeof(*r)); + ILL_String *r = (ILL_String *) odr_malloc(gc->odr, sizeof(*r)); char element[128]; const char *v; strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } v = (gc->f)(gc->clientData, element); if (!v) @@ -81,18 +81,18 @@ ILL_String *ill_get_ILL_String_x (struct ill_get_ctl *gc, const char *name, if (!v) return 0; r->which = ILL_String_GeneralString; - r->u.GeneralString = odr_strdup (gc->odr, v); + r->u.GeneralString = odr_strdup(gc->odr, v); return r; } ILL_String *ill_get_ILL_String(struct ill_get_ctl *gc, const char *name, const char *sub) { - return ill_get_ILL_String_x (gc, name, sub, 0); + return ill_get_ILL_String_x(gc, name, sub, 0); } -ILL_ISO_Date *ill_get_ILL_ISO_Date (struct ill_get_ctl *gc, const char *name, - const char *sub, const char *val) +ILL_ISO_Date *ill_get_ILL_ISO_Date(struct ill_get_ctl *gc, const char *name, + const char *sub, const char *val) { char element[128]; const char *v; @@ -100,19 +100,19 @@ ILL_ISO_Date *ill_get_ILL_ISO_Date (struct ill_get_ctl *gc, const char *name, strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } v = (gc->f)(gc->clientData, element); if (!v) v = val; if (!v) return 0; - return odr_strdup (gc->odr, v); + return odr_strdup(gc->odr, v); } -ILL_ISO_Time *ill_get_ILL_ISO_Time (struct ill_get_ctl *gc, const char *name, - const char *sub, const char *val) +ILL_ISO_Time *ill_get_ILL_ISO_Time(struct ill_get_ctl *gc, const char *name, + const char *sub, const char *val) { char element[128]; const char *v; @@ -120,38 +120,38 @@ ILL_ISO_Time *ill_get_ILL_ISO_Time (struct ill_get_ctl *gc, const char *name, strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } v = (gc->f)(gc->clientData, element); if (!v) v = val; if (!v) return 0; - return odr_strdup (gc->odr, v); + return odr_strdup(gc->odr, v); } -ILL_Person_Or_Institution_Symbol *ill_get_Person_Or_Insitution_Symbol ( +ILL_Person_Or_Institution_Symbol *ill_get_Person_Or_Insitution_Symbol( struct ill_get_ctl *gc, const char *name, const char *sub) { char element[128]; ODR o = gc->odr; ILL_Person_Or_Institution_Symbol *p = - (ILL_Person_Or_Institution_Symbol *) odr_malloc (o, sizeof(*p)); + (ILL_Person_Or_Institution_Symbol *) odr_malloc(o, sizeof(*p)); strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } p->which = ILL_Person_Or_Institution_Symbol_person_symbol; - if ((p->u.person_symbol = ill_get_ILL_String (gc, element, "person"))) + if ((p->u.person_symbol = ill_get_ILL_String(gc, element, "person"))) return p; p->which = ILL_Person_Or_Institution_Symbol_institution_symbol; if ((p->u.institution_symbol = - ill_get_ILL_String (gc, element, "institution"))) + ill_get_ILL_String(gc, element, "institution"))) return p; return 0; } @@ -162,22 +162,22 @@ static ILL_Name_Of_Person_Or_Institution *ill_get_Name_Of_Person_Or_Institution( char element[128]; ODR o = gc->odr; ILL_Name_Of_Person_Or_Institution *p = - (ILL_Name_Of_Person_Or_Institution *) odr_malloc (o, sizeof(*p)); + (ILL_Name_Of_Person_Or_Institution *) odr_malloc(o, sizeof(*p)); strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } p->which = ILL_Name_Of_Person_Or_Institution_name_of_person; if ((p->u.name_of_person = - ill_get_ILL_String (gc, element, "name-of-person"))) + ill_get_ILL_String(gc, element, "name-of-person"))) return p; p->which = ILL_Name_Of_Person_Or_Institution_name_of_institution; if ((p->u.name_of_institution = - ill_get_ILL_String (gc, element, "name-of-institution"))) + ill_get_ILL_String(gc, element, "name-of-institution"))) return p; return 0; } @@ -192,141 +192,141 @@ ILL_System_Id *ill_get_System_Id(struct ill_get_ctl *gc, strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - p = (ILL_System_Id *) odr_malloc (o, sizeof(*p)); - p->person_or_institution_symbol = ill_get_Person_Or_Insitution_Symbol ( + p = (ILL_System_Id *) odr_malloc(o, sizeof(*p)); + p->person_or_institution_symbol = ill_get_Person_Or_Insitution_Symbol( gc, element, "person-or-institution-symbol"); - p->name_of_person_or_institution = ill_get_Name_Of_Person_Or_Institution ( + p->name_of_person_or_institution = ill_get_Name_Of_Person_Or_Institution( gc, element, "name-of-person-or-institution"); return p; } -ILL_Transaction_Id *ill_get_Transaction_Id (struct ill_get_ctl *gc, - const char *name, const char *sub) +ILL_Transaction_Id *ill_get_Transaction_Id(struct ill_get_ctl *gc, + const char *name, const char *sub) { ODR o = gc->odr; - ILL_Transaction_Id *r = (ILL_Transaction_Id *) odr_malloc (o, sizeof(*r)); + ILL_Transaction_Id *r = (ILL_Transaction_Id *) odr_malloc(o, sizeof(*r)); char element[128]; strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } r->initial_requester_id = - ill_get_System_Id (gc, element, "initial-requester-id"); + ill_get_System_Id(gc, element, "initial-requester-id"); r->transaction_group_qualifier = - ill_get_ILL_String_x (gc, element, "transaction-group-qualifier", ""); + ill_get_ILL_String_x(gc, element, "transaction-group-qualifier", ""); r->transaction_qualifier = - ill_get_ILL_String_x (gc, element, "transaction-qualifier", ""); + ill_get_ILL_String_x(gc, element, "transaction-qualifier", ""); r->sub_transaction_qualifier = - ill_get_ILL_String (gc, element, "sub-transaction-qualifier"); + ill_get_ILL_String(gc, element, "sub-transaction-qualifier"); return r; } -ILL_Service_Date_this *ill_get_Service_Date_this ( +ILL_Service_Date_this *ill_get_Service_Date_this( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; ILL_Service_Date_this *r = - (ILL_Service_Date_this *) odr_malloc (o, sizeof(*r)); + (ILL_Service_Date_this *) odr_malloc(o, sizeof(*r)); char element[128]; strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - r->date = ill_get_ILL_ISO_Date (gc, element, "date", "20000101"); - r->time = ill_get_ILL_ISO_Time (gc, element, "time", 0); + r->date = ill_get_ILL_ISO_Date(gc, element, "date", "20000101"); + r->time = ill_get_ILL_ISO_Time(gc, element, "time", 0); return r; } -ILL_Service_Date_original *ill_get_Service_Date_original ( +ILL_Service_Date_original *ill_get_Service_Date_original( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; ILL_Service_Date_original *r = - (ILL_Service_Date_original *) odr_malloc (o, sizeof(*r)); + (ILL_Service_Date_original *) odr_malloc(o, sizeof(*r)); char element[128]; strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - r->date = ill_get_ILL_ISO_Date (gc, element, "date", 0); - r->time = ill_get_ILL_ISO_Time (gc, element, "time", 0); + r->date = ill_get_ILL_ISO_Date(gc, element, "date", 0); + r->time = ill_get_ILL_ISO_Time(gc, element, "time", 0); if (!r->date && !r->time) return 0; return r; } -ILL_Service_Date_Time *ill_get_Service_Date_Time ( +ILL_Service_Date_Time *ill_get_Service_Date_Time( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; ILL_Service_Date_Time *r = - (ILL_Service_Date_Time *) odr_malloc (o, sizeof(*r)); + (ILL_Service_Date_Time *) odr_malloc(o, sizeof(*r)); char element[128]; strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - r->date_time_of_this_service = ill_get_Service_Date_this ( + r->date_time_of_this_service = ill_get_Service_Date_this( gc, element, "this"); - r->date_time_of_original_service = ill_get_Service_Date_original ( + r->date_time_of_original_service = ill_get_Service_Date_original( gc, element, "original"); return r; } -ILL_Requester_Optional_Messages_Type *ill_get_Requester_Optional_Messages_Type ( +ILL_Requester_Optional_Messages_Type *ill_get_Requester_Optional_Messages_Type( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; ILL_Requester_Optional_Messages_Type *r = - (ILL_Requester_Optional_Messages_Type *) odr_malloc (o, sizeof(*r)); + (ILL_Requester_Optional_Messages_Type *) odr_malloc(o, sizeof(*r)); char element[128]; strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - r->can_send_RECEIVED = ill_get_bool (gc, element, "can-send-RECEIVED", 0); - r->can_send_RETURNED = ill_get_bool (gc, element, "can-send-RETURNED", 0); + r->can_send_RECEIVED = ill_get_bool(gc, element, "can-send-RECEIVED", 0); + r->can_send_RETURNED = ill_get_bool(gc, element, "can-send-RETURNED", 0); r->requester_SHIPPED = - ill_get_enumerated (gc, element, "requester-SHIPPED", 1); + ill_get_enumerated(gc, element, "requester-SHIPPED", 1); r->requester_CHECKED_IN = - ill_get_enumerated (gc, element, "requester-CHECKED-IN", 1); + ill_get_enumerated(gc, element, "requester-CHECKED-IN", 1); return r; } -ILL_Item_Id *ill_get_Item_Id ( +ILL_Item_Id *ill_get_Item_Id( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; - ILL_Item_Id *r = (ILL_Item_Id *) odr_malloc (o, sizeof(*r)); + ILL_Item_Id *r = (ILL_Item_Id *) odr_malloc(o, sizeof(*r)); char element[128]; strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - r->item_type = ill_get_enumerated (gc, element, "item-type", - ILL_Item_Id_monograph); + r->item_type = ill_get_enumerated(gc, element, "item-type", + ILL_Item_Id_monograph); r->held_medium_type = 0; r->call_number = ill_get_ILL_String(gc, element, "call-number"); r->author = ill_get_ILL_String(gc, element, "author"); @@ -359,7 +359,7 @@ ILL_Item_Id *ill_get_Item_Id ( } -ILL_Client_Id *ill_get_Client_Id ( +ILL_Client_Id *ill_get_Client_Id( struct ill_get_ctl *gc, const char *name, const char *sub) { char element[128]; @@ -369,17 +369,17 @@ ILL_Client_Id *ill_get_Client_Id ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - r->client_name = ill_get_ILL_String (gc, element, "client-name"); - r->client_status = ill_get_ILL_String (gc, element, "client-status"); - r->client_identifier = ill_get_ILL_String (gc, element, - "client-identifier"); + r->client_name = ill_get_ILL_String(gc, element, "client-name"); + r->client_status = ill_get_ILL_String(gc, element, "client-status"); + r->client_identifier = ill_get_ILL_String(gc, element, + "client-identifier"); return r; } -ILL_Postal_Address *ill_get_Postal_Address ( +ILL_Postal_Address *ill_get_Postal_Address( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -390,27 +390,27 @@ ILL_Postal_Address *ill_get_Postal_Address ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } r->name_of_person_or_institution = - ill_get_Name_Of_Person_Or_Institution ( + ill_get_Name_Of_Person_Or_Institution( gc, element, "name-of-person-or-institution"); r->extended_postal_delivery_address = - ill_get_ILL_String ( + ill_get_ILL_String( gc, element, "extended-postal-delivery-address"); r->street_and_number = - ill_get_ILL_String (gc, element, "street-and-number"); + ill_get_ILL_String(gc, element, "street-and-number"); r->post_office_box = - ill_get_ILL_String (gc, element, "post-office-box"); - r->city = ill_get_ILL_String (gc, element, "city"); - r->region = ill_get_ILL_String (gc, element, "region"); - r->country = ill_get_ILL_String (gc, element, "country"); - r->postal_code = ill_get_ILL_String (gc, element, "postal-code"); + ill_get_ILL_String(gc, element, "post-office-box"); + r->city = ill_get_ILL_String(gc, element, "city"); + r->region = ill_get_ILL_String(gc, element, "region"); + r->country = ill_get_ILL_String(gc, element, "country"); + r->postal_code = ill_get_ILL_String(gc, element, "postal-code"); return r; } -ILL_System_Address *ill_get_System_Address ( +ILL_System_Address *ill_get_System_Address( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -421,17 +421,17 @@ ILL_System_Address *ill_get_System_Address ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } r->telecom_service_identifier = - ill_get_ILL_String (gc, element, "telecom-service-identifier"); + ill_get_ILL_String(gc, element, "telecom-service-identifier"); r->telecom_service_address = - ill_get_ILL_String (gc, element, "telecom-service-addreess"); + ill_get_ILL_String(gc, element, "telecom-service-addreess"); return r; } -ILL_Delivery_Address *ill_get_Delivery_Address ( +ILL_Delivery_Address *ill_get_Delivery_Address( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -442,17 +442,17 @@ ILL_Delivery_Address *ill_get_Delivery_Address ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } r->postal_address = - ill_get_Postal_Address (gc, element, "postal-address"); + ill_get_Postal_Address(gc, element, "postal-address"); r->electronic_address = - ill_get_System_Address (gc, element, "electronic-address"); + ill_get_System_Address(gc, element, "electronic-address"); return r; } -ILL_Search_Type *ill_get_Search_Type ( +ILL_Search_Type *ill_get_Search_Type( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -462,19 +462,19 @@ ILL_Search_Type *ill_get_Search_Type ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } - r->level_of_service = ill_get_ILL_String (gc, element, "level-of-service"); - r->need_before_date = ill_get_ILL_ISO_Date (gc, element, - "need-before-date", 0); - r->expiry_date = ill_get_ILL_ISO_Date (gc, element, "expiry-date", 0); - r->expiry_flag = ill_get_enumerated (gc, element, "expiry-flag", 3); + r->level_of_service = ill_get_ILL_String(gc, element, "level-of-service"); + r->need_before_date = ill_get_ILL_ISO_Date(gc, element, + "need-before-date", 0); + r->expiry_date = ill_get_ILL_ISO_Date(gc, element, "expiry-date", 0); + r->expiry_flag = ill_get_enumerated(gc, element, "expiry-flag", 3); return r; } -ILL_Request *ill_get_ILLRequest ( +ILL_Request *ill_get_ILLRequest( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -484,56 +484,56 @@ ILL_Request *ill_get_ILLRequest ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } r->protocol_version_num = - ill_get_enumerated (gc, element, "protocol-version-num", - ILL_Request_version_2); + ill_get_enumerated(gc, element, "protocol-version-num", + ILL_Request_version_2); - r->transaction_id = ill_get_Transaction_Id (gc, element, "transaction-id"); + r->transaction_id = ill_get_Transaction_Id(gc, element, "transaction-id"); r->service_date_time = - ill_get_Service_Date_Time (gc, element, "service-date-time"); - r->requester_id = ill_get_System_Id (gc, element, "requester-id"); - r->responder_id = ill_get_System_Id (gc, element, "responder-id"); + ill_get_Service_Date_Time(gc, element, "service-date-time"); + r->requester_id = ill_get_System_Id(gc, element, "requester-id"); + r->responder_id = ill_get_System_Id(gc, element, "responder-id"); r->transaction_type = ill_get_enumerated(gc, element, "transaction-type", 1); r->delivery_address = - ill_get_Delivery_Address (gc, element, "delivery-address"); + ill_get_Delivery_Address(gc, element, "delivery-address"); r->delivery_service = 0; /* TODO */ - /* ill_get_Delivery_Service (gc, element, "delivery-service"); */ + /* ill_get_Delivery_Service(gc, element, "delivery-service"); */ r->billing_address = - ill_get_Delivery_Address (gc, element, "billing-address"); + ill_get_Delivery_Address(gc, element, "billing-address"); r->num_iLL_service_type = 1; - r->iLL_service_type = (ILL_Service_Type **) - odr_malloc (o, sizeof(*r->iLL_service_type)); + r->iLL_service_type =(ILL_Service_Type **) + odr_malloc(o, sizeof(*r->iLL_service_type)); *r->iLL_service_type = - ill_get_enumerated (gc, element, "ill-service-type", - ILL_Service_Type_copy_non_returnable); + ill_get_enumerated(gc, element, "ill-service-type", + ILL_Service_Type_copy_non_returnable); r->responder_specific_service = 0; r->requester_optional_messages = - ill_get_Requester_Optional_Messages_Type ( + ill_get_Requester_Optional_Messages_Type( gc, element,"requester-optional-messages"); r->search_type = ill_get_Search_Type(gc, element, "search-type"); r->num_supply_medium_info_type = 0; r->supply_medium_info_type = 0; - r->place_on_hold = ill_get_enumerated ( + r->place_on_hold = ill_get_enumerated( gc, element, "place-on-hold", ILL_Place_On_Hold_Type_according_to_responder_policy); - r->client_id = ill_get_Client_Id (gc, element, "client-id"); + r->client_id = ill_get_Client_Id(gc, element, "client-id"); - r->item_id = ill_get_Item_Id (gc, element, "item-id"); + r->item_id = ill_get_Item_Id(gc, element, "item-id"); r->supplemental_item_description = 0; r->cost_info_type = 0; r->copyright_compliance = ill_get_ILL_String(gc, element, "copyright-complicance"); r->third_party_info_type = 0; - r->retry_flag = ill_get_bool (gc, element, "retry-flag", 0); - r->forward_flag = ill_get_bool (gc, element, "forward-flag", 0); + r->retry_flag = ill_get_bool(gc, element, "retry-flag", 0); + r->forward_flag = ill_get_bool(gc, element, "forward-flag", 0); r->requester_note = ill_get_ILL_String(gc, element, "requester-note"); r->forward_note = ill_get_ILL_String(gc, element, "forward-note"); r->num_iLL_request_extensions = 0; @@ -541,7 +541,7 @@ ILL_Request *ill_get_ILLRequest ( return r; } -ILL_ItemRequest *ill_get_ItemRequest ( +ILL_ItemRequest *ill_get_ItemRequest( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -551,56 +551,56 @@ ILL_ItemRequest *ill_get_ItemRequest ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } r->protocol_version_num = - ill_get_enumerated (gc, element, "protocol-version-num", - ILL_Request_version_2); + ill_get_enumerated(gc, element, "protocol-version-num", + ILL_Request_version_2); - r->transaction_id = ill_get_Transaction_Id (gc, element, "transaction-id"); + r->transaction_id = ill_get_Transaction_Id(gc, element, "transaction-id"); r->service_date_time = - ill_get_Service_Date_Time (gc, element, "service-date-time"); - r->requester_id = ill_get_System_Id (gc, element, "requester-id"); - r->responder_id = ill_get_System_Id (gc, element, "responder-id"); + ill_get_Service_Date_Time(gc, element, "service-date-time"); + r->requester_id = ill_get_System_Id(gc, element, "requester-id"); + r->responder_id = ill_get_System_Id(gc, element, "responder-id"); r->transaction_type = ill_get_enumerated(gc, element, "transaction-type", 1); r->delivery_address = - ill_get_Delivery_Address (gc, element, "delivery-address"); + ill_get_Delivery_Address(gc, element, "delivery-address"); r->delivery_service = 0; /* TODO */ - /* ill_get_Delivery_Service (gc, element, "delivery-service"); */ + /* ill_get_Delivery_Service(gc, element, "delivery-service"); */ r->billing_address = - ill_get_Delivery_Address (gc, element, "billing-address"); + ill_get_Delivery_Address(gc, element, "billing-address"); r->num_iLL_service_type = 1; - r->iLL_service_type = (ILL_Service_Type **) - odr_malloc (o, sizeof(*r->iLL_service_type)); + r->iLL_service_type =(ILL_Service_Type **) + odr_malloc(o, sizeof(*r->iLL_service_type)); *r->iLL_service_type = - ill_get_enumerated (gc, element, "ill-service-type", - ILL_Service_Type_copy_non_returnable); + ill_get_enumerated(gc, element, "ill-service-type", + ILL_Service_Type_copy_non_returnable); r->responder_specific_service = 0; r->requester_optional_messages = - ill_get_Requester_Optional_Messages_Type ( + ill_get_Requester_Optional_Messages_Type( gc, element,"requester-optional-messages"); r->search_type = ill_get_Search_Type(gc, element, "search-type"); r->num_supply_medium_info_type = 0; r->supply_medium_info_type = 0; - r->place_on_hold = ill_get_enumerated ( + r->place_on_hold = ill_get_enumerated( gc, element, "place-on-hold", ILL_Place_On_Hold_Type_according_to_responder_policy); - r->client_id = ill_get_Client_Id (gc, element, "client-id"); + r->client_id = ill_get_Client_Id(gc, element, "client-id"); - r->item_id = ill_get_Item_Id (gc, element, "item-id"); + r->item_id = ill_get_Item_Id(gc, element, "item-id"); r->supplemental_item_description = 0; r->cost_info_type = 0; r->copyright_compliance = ill_get_ILL_String(gc, element, "copyright-complicance"); r->third_party_info_type = 0; - r->retry_flag = ill_get_bool (gc, element, "retry-flag", 0); - r->forward_flag = ill_get_bool (gc, element, "forward-flag", 0); + r->retry_flag = ill_get_bool(gc, element, "retry-flag", 0); + r->forward_flag = ill_get_bool(gc, element, "forward-flag", 0); r->requester_note = ill_get_ILL_String(gc, element, "requester-note"); r->forward_note = ill_get_ILL_String(gc, element, "forward-note"); r->num_iLL_request_extensions = 0; @@ -608,7 +608,7 @@ ILL_ItemRequest *ill_get_ItemRequest ( return r; } -ILL_Cancel *ill_get_Cancel ( +ILL_Cancel *ill_get_Cancel( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -618,18 +618,18 @@ ILL_Cancel *ill_get_Cancel ( strcpy(element, name); if (sub) { - strcat (element, ","); - strcat (element, sub); + strcat(element, ","); + strcat(element, sub); } r->protocol_version_num = - ill_get_enumerated (gc, element, "protocol-version-num", - ILL_Request_version_2); + ill_get_enumerated(gc, element, "protocol-version-num", + ILL_Request_version_2); - r->transaction_id = ill_get_Transaction_Id (gc, element, "transaction-id"); + r->transaction_id = ill_get_Transaction_Id(gc, element, "transaction-id"); r->service_date_time = - ill_get_Service_Date_Time (gc, element, "service-date-time"); - r->requester_id = ill_get_System_Id (gc, element, "requester-id"); - r->responder_id = ill_get_System_Id (gc, element, "responder-id"); + ill_get_Service_Date_Time(gc, element, "service-date-time"); + r->requester_id = ill_get_System_Id(gc, element, "requester-id"); + r->responder_id = ill_get_System_Id(gc, element, "responder-id"); r->requester_note = ill_get_ILL_String(gc, element, "requester-note"); r->num_cancel_extensions = 0; @@ -637,7 +637,7 @@ ILL_Cancel *ill_get_Cancel ( return r; } -ILL_APDU *ill_get_APDU ( +ILL_APDU *ill_get_APDU( struct ill_get_ctl *gc, const char *name, const char *sub) { ODR o = gc->odr; @@ -645,18 +645,18 @@ ILL_APDU *ill_get_APDU ( char element[128]; const char *v; - strcpy (element, name); - strcat (element, ",which"); + strcpy(element, name); + strcat(element, ",which"); v = (gc->f)(gc->clientData, element); if (!v) v = "request"; - if (!strcmp (v, "request")) + if (!strcmp(v, "request")) { r->which = ILL_APDU_ILL_Request; r->u.illRequest = ill_get_ILLRequest(gc, name, sub); } - else if (!strcmp (v, "cancel")) + else if (!strcmp(v, "cancel")) { r->which = ILL_APDU_Cancel; r->u.Cancel = ill_get_Cancel(gc, name, sub); diff --git a/src/nmemsdup.c b/src/nmemsdup.c index 9584cff..d3e6539 100644 --- a/src/nmemsdup.c +++ b/src/nmemsdup.c @@ -15,10 +15,10 @@ #include #include -char *nmem_strdup (NMEM mem, const char *src) +char *nmem_strdup(NMEM mem, const char *src) { - char *dst = (char *)nmem_malloc (mem, strlen(src)+1); - strcpy (dst, src); + char *dst = (char *) nmem_malloc(mem, strlen(src)+1); + strcpy(dst, src); return dst; } @@ -30,9 +30,9 @@ char *nmem_strdup_null(NMEM mem, const char *src) return nmem_strdup(mem, src); } -char *nmem_strdupn (NMEM mem, const char *src, size_t n) +char *nmem_strdupn(NMEM mem, const char *src, size_t n) { - char *dst = (char *)nmem_malloc (mem, n+1); + char *dst = (char *) nmem_malloc(mem, n+1); memcpy (dst, src, n); dst[n] = '\0'; return dst; @@ -40,14 +40,14 @@ char *nmem_strdupn (NMEM mem, const char *src, size_t n) nmem_int_t *nmem_intdup(NMEM mem, nmem_int_t v) { - nmem_int_t *dst = (nmem_int_t*) nmem_malloc (mem, sizeof(*dst)); + nmem_int_t *dst = (nmem_int_t*) nmem_malloc(mem, sizeof(*dst)); *dst = v; return dst; } nmem_bool_t *nmem_booldup(NMEM mem, nmem_bool_t v) { - nmem_bool_t *dst = (nmem_bool_t*) nmem_malloc (mem, sizeof(*dst)); + nmem_bool_t *dst = (nmem_bool_t*) nmem_malloc(mem, sizeof(*dst)); *dst = v; return dst; } diff --git a/src/odr.c b/src/odr.c index 0896859..7013ad7 100644 --- a/src/odr.c +++ b/src/odr.c @@ -22,12 +22,12 @@ #include #include "odr-priv.h" -static int log_level=0; -static int log_level_initialized=0; +static int log_level = 0; +static int log_level_initialized = 0; Odr_null *ODR_NULLVAL = (Odr_null *) "NULL"; /* the presence of a null value */ -Odr_null *odr_nullval (void) +Odr_null *odr_nullval(void) { return ODR_NULLVAL; } @@ -144,7 +144,7 @@ void odr_FILE_write(ODR o, void *handle, int type, fputs("\n", (FILE*) handle); } #endif - for (i = 0; i 3100) @@ -193,7 +193,7 @@ int odr_set_charset(ODR o, const char *to, const char *from) o->op->iconv_handle = 0; if (to && from) { - o->op->iconv_handle = yaz_iconv_open (to, from); + o->op->iconv_handle = yaz_iconv_open(to, from); if (o->op->iconv_handle == 0) return -1; } @@ -206,13 +206,13 @@ ODR odr_createmem(int direction) ODR o; if (!log_level_initialized) { - log_level=yaz_log_module_level("odr"); - log_level_initialized=1; + log_level = yaz_log_module_level("odr"); + log_level_initialized = 1; } - if (!(o = (ODR)xmalloc(sizeof(*o)))) + if (!(o = (ODR) xmalloc(sizeof(*o)))) return 0; - o->op = (struct Odr_private *) xmalloc (sizeof(*o->op)); + o->op = (struct Odr_private *) xmalloc(sizeof(*o->op)); o->direction = direction; o->buf = 0; o->size = o->pos = o->top = 0; @@ -223,7 +223,7 @@ ODR odr_createmem(int direction) o->op->iconv_handle = 0; odr_setprint(o, stderr); odr_reset(o); - yaz_log (log_level, "odr_createmem dir=%d o=%p", direction, o); + yaz_log(log_level, "odr_createmem dir=%d o=%p", direction, o); return o; } @@ -231,8 +231,8 @@ void odr_reset(ODR o) { if (!log_level_initialized) { - log_level=yaz_log_module_level("odr"); - log_level_initialized=1; + log_level = yaz_log_module_level("odr"); + log_level_initialized = 1; } odr_seterror(o, ONONE, 0); @@ -251,7 +251,7 @@ void odr_reset(ODR o) o->op->lenlen = 1; if (o->op->iconv_handle != 0) yaz_iconv(o->op->iconv_handle, 0, 0, 0, 0); - yaz_log (log_level, "odr_reset o=%p", o); + yaz_log(log_level, "odr_reset o=%p", o); } void odr_destroy(ODR o) @@ -262,17 +262,16 @@ void odr_destroy(ODR o) if (o->op->stream_close) o->op->stream_close(o->op->print); if (o->op->iconv_handle != 0) - yaz_iconv_close (o->op->iconv_handle); + yaz_iconv_close(o->op->iconv_handle); xfree(o->op); xfree(o); - yaz_log (log_level, "odr_destroy o=%p", o); + yaz_log(log_level, "odr_destroy o=%p", o); } void odr_setbuf(ODR o, char *buf, int len, int can_grow) { odr_seterror(o, ONONE, 0); o->bp = (unsigned char *) buf; - o->buf = (unsigned char *) buf; o->op->can_grow = can_grow; o->top = o->pos = 0; diff --git a/src/pquery.c b/src/pquery.c index 749ce02..8db6ac6 100644 --- a/src/pquery.c +++ b/src/pquery.c @@ -258,7 +258,7 @@ Z_AttributeList *get_attributeList(ODR o, int num_attr, Odr_int *attr_list, return attributes; } elements = (Z_AttributeElement**) - odr_malloc (o, num_attr * sizeof(*elements)); + odr_malloc(o, num_attr * sizeof(*elements)); attr_tmp = (Odr_int *)odr_malloc(o, num_attr * 2 * sizeof(*attr_tmp)); memcpy(attr_tmp, attr_list, num_attr * 2 * sizeof(*attr_tmp)); diff --git a/src/prt-ext.c b/src/prt-ext.c index f170994..7330103 100644 --- a/src/prt-ext.c +++ b/src/prt-ext.c @@ -223,7 +223,7 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) Odr_oct *oct; int r; if (!odr_implicit_tag(o, odr_octetstring, &oct, - ODR_CONTEXT, 1, 0, "octetaligned")) + ODR_CONTEXT, 1, 0, "octetaligned")) return 0; /* Save our decoding ODR members */ @@ -308,8 +308,8 @@ Z_External *z_ext_record_oid(ODR o, const Odr_oid *oid, const char *buf, int len return 0; } } - else if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs)) /* SUTRS is a single-ASN.1-type */ - { + else if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs)) + { /* SUTRS is a single-ASN.1-type */ Odr_oct *sutrs = (Odr_oct *)odr_malloc(o, sizeof(*sutrs)); thisext->which = Z_External_sutrs; diff --git a/src/seshigh.c b/src/seshigh.c index be9c54c..92627c2 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -788,7 +788,7 @@ static int cql2pqf(ODR odr, const char *cql, cql_transform_t ct, if (r == 0) { if (*out) - yaz_log (log_requestdetail, "srw_sortKeys '%s'", out); + yaz_log(log_requestdetail, "srw_sortKeys '%s'", out); *sortkeys_p = odr_strdup(odr, out); } else @@ -2616,7 +2616,7 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb) bsrr->extra_args = 0; bsrr->extra_response_data = 0; - yaz_log (log_requestdetail, "ResultSet '%s'", req->resultSetName); + yaz_log(log_requestdetail, "ResultSet '%s'", req->resultSetName); if (req->databaseNames) { int i; diff --git a/src/siconv.c b/src/siconv.c index 9ae3c39..7895db2 100644 --- a/src/siconv.c +++ b/src/siconv.c @@ -98,7 +98,7 @@ static int prepare_decoders(yaz_iconv_t cd, const char *tocode) yaz_iconv_t yaz_iconv_open(const char *tocode, const char *fromcode) { - yaz_iconv_t cd = (yaz_iconv_t) xmalloc (sizeof(*cd)); + yaz_iconv_t cd = (yaz_iconv_t) xmalloc(sizeof(*cd)); cd->encoder.data = 0; cd->encoder.write_handle = 0; diff --git a/src/sortspec.c b/src/sortspec.c index 3ea0dcb..07e4e0f 100644 --- a/src/sortspec.c +++ b/src/sortspec.c @@ -23,7 +23,7 @@ Z_SortKeySpecList *yaz_sort_spec(ODR out, const char *arg) { char sort_string_buf[64], sort_flags[64]; Z_SortKeySpecList *sksl = (Z_SortKeySpecList *) - odr_malloc (out, sizeof(*sksl)); + odr_malloc(out, sizeof(*sksl)); int off; sksl->num_specs = 0; @@ -41,7 +41,7 @@ Z_SortKeySpecList *yaz_sort_spec(ODR out, const char *arg) arg += off; sksl->specs[sksl->num_specs++] = sks; sks->sortElement = (Z_SortElement *) - odr_malloc (out, sizeof(*sks->sortElement)); + odr_malloc(out, sizeof(*sks->sortElement)); sks->sortElement->which = Z_SortElement_generic; sks->sortElement->u.generic = sk; @@ -60,7 +60,7 @@ Z_SortKeySpecList *yaz_sort_spec(ODR out, const char *arg) while (i < 10 && sort_string && sort_string_sep) { Z_AttributeElement *el = (Z_AttributeElement *) - odr_malloc (out, sizeof(*el)); + odr_malloc(out, sizeof(*el)); sk->u.sortAttributes->list->attributes[i] = el; el->attributeSet = 0; el->attributeType = odr_intdup(out, atoi(sort_string)); diff --git a/src/srwutil.c b/src/srwutil.c index a04516a..40c8039 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -46,7 +46,7 @@ Z_AttributeList *yaz_use_attribute_create(ODR o, const char *name) Z_AttributeElement ** elements; attributes->num_attributes = 1; elements = (Z_AttributeElement**) - odr_malloc (o, attributes->num_attributes * sizeof(*elements)); + odr_malloc(o, attributes->num_attributes * sizeof(*elements)); elements[0] = (Z_AttributeElement*) odr_malloc(o,sizeof(**elements)); elements[0]->attributeType = odr_intdup(o, 1); elements[0]->attributeSet = odr_nullval(); @@ -177,9 +177,9 @@ void yaz_add_srw_diagnostic_uri(ODR o, Z_SRW_diagnostic **d, const char *message, const char *details) { Z_SRW_diagnostic *d_new; - d_new = (Z_SRW_diagnostic *) odr_malloc (o, (*num + 1)* sizeof(**d)); + d_new = (Z_SRW_diagnostic *) odr_malloc(o, (*num + 1)* sizeof(**d)); if (*num) - memcpy (d_new, *d, *num *sizeof(**d)); + memcpy(d_new, *d, *num *sizeof(**d)); *d = d_new; yaz_mk_srw_diagnostic(o, *d + *num, uri, message, details); diff --git a/src/tcpdchk.c b/src/tcpdchk.c index 8cff301..91eb0bc 100644 --- a/src/tcpdchk.c +++ b/src/tcpdchk.c @@ -86,8 +86,8 @@ int check_ip_tcpd(void *cd, const char *addr, int len, int type) i = hosts_access(&request_info); if (!i) { - yaz_log (YLOG_DEBUG, "access denied from %s", - host_name ? host_name : host_addr); + yaz_log(YLOG_DEBUG, "access denied from %s", + host_name ? host_name : host_addr); return 1; } yaz_log(YLOG_DEBUG, "access granted from %s", diff --git a/src/xmalloc.c b/src/xmalloc.c index 3c28abe..b49d399 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -260,12 +260,12 @@ void *xrealloc_f(void *o, size_t size, const char *file, int line) } if (log_level) - yaz_log (log_level, - "%s:%d: xrealloc(s=%ld) %p -> %p", file, line, (long) size, o, p); + yaz_log(log_level, + "%s:%d: xrealloc(s=%ld) %p -> %p", file, line, (long) size, o, p); if (!p) { - yaz_log (YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%ld bytes)", - (long) size); + yaz_log(YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%ld bytes)", + (long) size); xmalloc_fatal(); } return p; diff --git a/src/zget.c b/src/zget.c index 5e9af9c..1d55972 100644 --- a/src/zget.c +++ b/src/zget.c @@ -499,7 +499,7 @@ Z_DefaultDiagFormat *zget_DefaultDiagFormat(ODR o, int error, const char *addinfo) { Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *) - odr_malloc (o, sizeof(*dr)); + odr_malloc(o, sizeof(*dr)); dr->diagnosticSetId = odr_oiddup(o, yaz_oid_diagset_bib_1); dr->condition = odr_intdup(o, error); @@ -529,8 +529,8 @@ Z_DiagRecs *zget_DiagRecs(ODR o, int error, const char *addinfo) Z_NamePlusRecord *zget_surrogateDiagRec(ODR o, const char *dbname, int error, const char *addinfo) { - Z_NamePlusRecord *rec = (Z_NamePlusRecord *) odr_malloc (o, sizeof(*rec)); - Z_DiagRec *drec = (Z_DiagRec *)odr_malloc (o, sizeof(*drec)); + Z_NamePlusRecord *rec = (Z_NamePlusRecord *) odr_malloc(o, sizeof(*rec)); + Z_DiagRec *drec = (Z_DiagRec *)odr_malloc(o, sizeof(*drec)); if (dbname) rec->databaseName = odr_strdup(o, dbname); @@ -576,8 +576,8 @@ Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo) d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d); x2->u.diag1 = d; d->num = 1; - d->elements = (Z_DiagnosticFormat_s**) odr_malloc (odr, sizeof *d->elements); - d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc (odr, sizeof *d->elements[0]); + d->elements = (Z_DiagnosticFormat_s**) odr_malloc(odr, sizeof *d->elements); + d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc(odr, sizeof *d->elements[0]); e = d->elements[0]; e->which = Z_DiagnosticFormat_s_defaultDiagRec; @@ -617,8 +617,8 @@ Z_External *zget_init_diagnostics_octet(ODR odr, int error, d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d); x2->u.diag1 = d; d->num = 1; - d->elements = (Z_DiagnosticFormat_s**) odr_malloc (odr, sizeof *d->elements); - d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc (odr, sizeof *d->elements[0]); + d->elements = (Z_DiagnosticFormat_s**) odr_malloc(odr, sizeof *d->elements); + d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc(odr, sizeof *d->elements[0]); e = d->elements[0]; e->which = Z_DiagnosticFormat_s_defaultDiagRec; -- 1.7.10.4