From 6835889492d68a285d59cfb1a156517a34937130 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 15 Mar 2010 19:51:56 +0100 Subject: [PATCH] Reindent - including tabs -> spaces. --- src/marc_read_xml.c | 102 +++++++++++---------- src/marcdisp.c | 255 +++++++++++++++++++++++++++------------------------ util/marcdump.c | 6 +- 3 files changed, 192 insertions(+), 171 deletions(-) diff --git a/src/marc_read_xml.c b/src/marc_read_xml.c index 3f3e05b..f448b5b 100644 --- a/src/marc_read_xml.c +++ b/src/marc_read_xml.c @@ -90,30 +90,33 @@ int yaz_marc_read_xml_subfields(yaz_marc_t mt, const xmlNode *ptr) return 0; } -const char *tag_value_extract(const char *name, char tag_buffer[5]) { - size_t length = strlen(name); - if (length == 3) { - strcpy(tag_buffer, name); - return tag_buffer; - } - return 0; +const char *tag_value_extract(const char *name, char tag_buffer[5]) +{ + size_t length = strlen(name); + if (length == 3) + { + strcpy(tag_buffer, name); + return tag_buffer; + } + return 0; } // Given a xmlNode ptr, extract a value from either a element name or from a given attribute -const char *element_attribute_value_extract(const xmlNode *ptr, const char *attribute_name, NMEM nmem) { +const char *element_attribute_value_extract(const xmlNode *ptr, + const char *attribute_name, + NMEM nmem) +{ - const char *name = ptr->name; - size_t length = strlen(name); - if (length > 1 ) { - return nmem_strdup(nmem, name+1); - } - // TODO Extract from attribute where matches attribute_name - xmlAttr *attr; + const char *name = ptr->name; + size_t length = strlen(name); + if (length > 1 ) + return nmem_strdup(nmem, name+1); + // TODO Extract from attribute where matches attribute_name + xmlAttr *attr; for (attr = ptr->properties; attr; attr = attr->next) - if (!strcmp((const char *)attr->name, attribute_name)) { - return nmem_text_node_cdata(attr->children, nmem); - } - return 0; + if (!strcmp((const char *)attr->name, attribute_name)) + return nmem_text_node_cdata(attr->children, nmem); + return 0; } @@ -124,12 +127,12 @@ int yaz_marc_read_turbo_xml_subfields(yaz_marc_t mt, const xmlNode *ptr) { if (ptr->type == XML_ELEMENT_NODE) { - xmlNode *p; + xmlNode *p; if (!strncmp((const char *) ptr->name, "s", 1)) { - NMEM nmem = yaz_marc_get_nmem(mt); - char *buffer = (char *) nmem_malloc(nmem, 5); - const char *tag_value = element_attribute_value_extract(ptr, "code", nmem); + NMEM nmem = yaz_marc_get_nmem(mt); + char *buffer = (char *) nmem_malloc(nmem, 5); + const char *tag_value = element_attribute_value_extract(ptr, "code", nmem); if (!tag_value) { yaz_marc_cprintf( @@ -139,13 +142,13 @@ int yaz_marc_read_turbo_xml_subfields(yaz_marc_t mt, const xmlNode *ptr) size_t ctrl_data_len = 0; char *ctrl_data_buf = 0; - ctrl_data_len = strlen((const char *) tag_value); - // Extract (length) from CDATA - xmlNode *p; - for (p = ptr->children; p ; p = p->next) + ctrl_data_len = strlen((const char *) tag_value); + // Extract (length) from CDATA + xmlNode *p; + for (p = ptr->children; p ; p = p->next) if (p->type == XML_TEXT_NODE) ctrl_data_len += strlen((const char *)p->content); - // Allocate memory for code value (1 character (can be multi-byte) and data + // Allocate memory for code value (1 character (can be multi-byte) and data ctrl_data_buf = (char *) nmem_malloc(nmem, ctrl_data_len+1); // Build a string with "" strcpy(ctrl_data_buf, (const char *) tag_value); @@ -180,8 +183,8 @@ static int yaz_marc_read_xml_leader(yaz_marc_t mt, const xmlNode **ptr_p) for(; ptr; ptr = ptr->next) if (ptr->type == XML_ELEMENT_NODE) { - if ( !strcmp( (const char *) ptr->name, "leader") || - (!strncmp((const char *) ptr->name, "l", 1) )) + if ( !strcmp( (const char *) ptr->name, "leader") || + (!strncmp((const char *) ptr->name, "l", 1) )) { xmlNode *p = ptr->children; for(; p; p = p->next) @@ -222,7 +225,7 @@ static int yaz_marc_read_xml_fields(yaz_marc_t mt, const xmlNode *ptr) for(; ptr; ptr = ptr->next) if (ptr->type == XML_ELEMENT_NODE) { - if (!strcmp( (const char *) ptr->name, "controlfield")) + if (!strcmp( (const char *) ptr->name, "controlfield")) { const xmlNode *ptr_tag = 0; struct _xmlAttr *attr; @@ -300,10 +303,10 @@ static int yaz_marc_read_turbo_xml_fields(yaz_marc_t mt, const xmlNode *ptr) for(; ptr; ptr = ptr->next) if (ptr->type == XML_ELEMENT_NODE) { - if (!strncmp( (const char *) ptr->name, "c", 1)) + if (!strncmp( (const char *) ptr->name, "c", 1)) { - NMEM nmem = yaz_marc_get_nmem(mt); - const char *tag_value = element_attribute_value_extract(ptr, "tag", nmem); + NMEM nmem = yaz_marc_get_nmem(mt); + const char *tag_value = element_attribute_value_extract(ptr, "tag", nmem); if (!tag_value) { yaz_marc_cprintf( @@ -315,21 +318,21 @@ static int yaz_marc_read_turbo_xml_fields(yaz_marc_t mt, const xmlNode *ptr) else if (!strncmp((const char *) ptr->name, "d",1)) { struct _xmlAttr *attr; - NMEM nmem = yaz_marc_get_nmem(mt); + NMEM nmem = yaz_marc_get_nmem(mt); char *indstr = nmem_malloc(nmem, 11); /* 0(unused), 1,....9, + zero term */ int index = 0; for (index = 0; index < 11; index++) - indstr[index] = '\0'; - const char *tag_value = element_attribute_value_extract(ptr, "tag", nmem); + indstr[index] = '\0'; + const char *tag_value = element_attribute_value_extract(ptr, "tag", nmem); if (!tag_value) - { + { yaz_marc_cprintf( mt, "Missing attribute 'tag' for 'datafield'" ); return -1; } for (attr = ptr->properties; attr; attr = attr->next) if (strlen((const char *)attr->name) == 2 && - attr->name[0] == 'i') + attr->name[0] == 'i') { //extract indicator attribute from i#="Y" pattern int no = atoi((const char *)attr->name+1); @@ -371,12 +374,14 @@ int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr) for(; ptr; ptr = ptr->next) if (ptr->type == XML_ELEMENT_NODE) { - //TODO Should actually look at the namespace but... - if (!strcmp((const char *) ptr->name, "record")) { + //TODO Should actually look at the namespace but... + if (!strcmp((const char *) ptr->name, "record")) + { yaz_marc_set_read_format(mt, YAZ_MARC_MARCXML); break; } - else if (!strcmp((const char *) ptr->name, "r")) { + else if (!strcmp((const char *) ptr->name, "r")) + { yaz_marc_set_read_format(mt, YAZ_MARC_TMARCXML); break; } @@ -397,13 +402,14 @@ int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr) if (yaz_marc_read_xml_leader(mt, &ptr)) return -1; - switch (yaz_marc_get_read_format(mt)) { - case YAZ_MARC_MARCXML: - return yaz_marc_read_xml_fields(mt, ptr->next); - case YAZ_MARC_TMARCXML: - return yaz_marc_read_turbo_xml_fields(mt, ptr->next); + switch (yaz_marc_get_read_format(mt)) + { + case YAZ_MARC_MARCXML: + return yaz_marc_read_xml_fields(mt, ptr->next); + case YAZ_MARC_TMARCXML: + return yaz_marc_read_turbo_xml_fields(mt, ptr->next); } - return -1; + return -1; } #endif diff --git a/src/marcdisp.c b/src/marcdisp.c index 5cda038..e8c3956 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -164,7 +164,7 @@ void yaz_marc_add_controlfield_xml(yaz_marc_t mt, const xmlNode *ptr_tag, } void yaz_marc_add_controlfield_turbo_xml(yaz_marc_t mt, char *tag, - const xmlNode *ptr_data) + const xmlNode *ptr_data) { struct yaz_marc_node *n = yaz_marc_add_node(mt); n->which = YAZ_MARC_CONTROLFIELD; @@ -245,30 +245,32 @@ void yaz_marc_add_datafield(yaz_marc_t mt, const char *tag, // if not, and if the attribute name is not null, it will append a attribute element with the value // if attribute name is null it will return a non-zero value meaning it couldnt handle the value. -int element_name_append_attribute_value(yaz_marc_t mt, WRBUF buffer, const char *attribute_name, char *code_data, size_t code_len) { - // TODO Map special codes to something possible for XML ELEMENT names - - int encode = 0; - int index = 0; - for (index = 0; index < code_len; index++) { - if (!((code_data[index] >= '0' && code_data[index] <= '9') || - (code_data[index] >= 'a' && code_data[index] <= 'z') || - (code_data[index] >= 'A' && code_data[index] <= 'Z'))) - encode = 1; - } - int success = 0; - // Add as attribute - if (encode && attribute_name) - wrbuf_printf(buffer, " %s=\"", attribute_name); - - if (!encode || attribute_name) - wrbuf_iconv_write_cdata(buffer, mt->iconv_cd, code_data, code_len); - else - success = -1; - - if (encode && attribute_name) - wrbuf_printf(buffer, "\""); // return error if we couldn't handle it. - return success; +int element_name_append_attribute_value(yaz_marc_t mt, WRBUF buffer, const char *attribute_name, char *code_data, size_t code_len) +{ + // TODO Map special codes to something possible for XML ELEMENT names + + int encode = 0; + int index = 0; + for (index = 0; index < code_len; index++) + { + if (!((code_data[index] >= '0' && code_data[index] <= '9') || + (code_data[index] >= 'a' && code_data[index] <= 'z') || + (code_data[index] >= 'A' && code_data[index] <= 'Z'))) + encode = 1; + } + int success = 0; + // Add as attribute + if (encode && attribute_name) + wrbuf_printf(buffer, " %s=\"", attribute_name); + + if (!encode || attribute_name) + wrbuf_iconv_write_cdata(buffer, mt->iconv_cd, code_data, code_len); + else + success = -1; + + if (encode && attribute_name) + wrbuf_printf(buffer, "\""); // return error if we couldn't handle it. + return success; } #if YAZ_HAVE_XML2 @@ -641,7 +643,8 @@ static int yaz_marc_write_marcxml_ns1(yaz_marc_t mt, WRBUF wr, if (mt->enable_collection != no_collection) { - if (mt->enable_collection == collection_first) { + if (mt->enable_collection == collection_first) + { wrbuf_printf(wr, "<%s xmlns=\"%s\">\n", collection_name[turbo], ns); mt->enable_collection = collection_second; } @@ -664,79 +667,84 @@ static int yaz_marc_write_marcxml_ns1(yaz_marc_t mt, WRBUF wr, { case YAZ_MARC_DATAFIELD: - wrbuf_printf(wr, " <%s", datafield_name[turbo]); + wrbuf_printf(wr, " <%s", datafield_name[turbo]); if (!turbo) wrbuf_printf(wr, " tag=\""); wrbuf_iconv_write_cdata(wr, mt->iconv_cd, n->u.datafield.tag, strlen(n->u.datafield.tag)); - if (!turbo) - wrbuf_printf(wr, "\""); + if (!turbo) + wrbuf_printf(wr, "\""); if (n->u.datafield.indicator) { int i; for (i = 0; n->u.datafield.indicator[i]; i++) { - wrbuf_printf(wr, " %s%d=\"", indicator_name[turbo], i+1); - wrbuf_iconv_write_cdata(wr, mt->iconv_cd, - n->u.datafield.indicator+i, 1); - wrbuf_iconv_puts(wr, mt->iconv_cd, "\""); - } + wrbuf_printf(wr, " %s%d=\"", indicator_name[turbo], i+1); + wrbuf_iconv_write_cdata(wr, mt->iconv_cd, + n->u.datafield.indicator+i, 1); + wrbuf_iconv_puts(wr, mt->iconv_cd, "\""); + } } - wrbuf_printf(wr, ">\n"); + wrbuf_printf(wr, ">\n"); for (s = n->u.datafield.subfields; s; s = s->next) { size_t using_code_len = get_subfield_len(mt, s->code_data, identifier_length); wrbuf_printf(wr, " <%s", subfield_name[turbo]); - if (!turbo) { - wrbuf_printf(wr, " code=\""); - wrbuf_iconv_write_cdata(wr, mt->iconv_cd, - s->code_data, using_code_len); - wrbuf_iconv_puts(wr, mt->iconv_cd, "\">"); - } else { - element_name_append_attribute_value(mt, wr, "code", s->code_data, using_code_len); - wrbuf_puts(wr, ">"); - } + if (!turbo) + { + wrbuf_printf(wr, " code=\""); + wrbuf_iconv_write_cdata(wr, mt->iconv_cd, + s->code_data, using_code_len); + wrbuf_iconv_puts(wr, mt->iconv_cd, "\">"); + } + else + { + element_name_append_attribute_value(mt, wr, "code", s->code_data, using_code_len); + wrbuf_puts(wr, ">"); + } wrbuf_iconv_write_cdata(wr, mt->iconv_cd, s->code_data + using_code_len, strlen(s->code_data + using_code_len)); marc_iconv_reset(mt, wr); - wrbuf_printf(wr, "code_data, using_code_len); + wrbuf_printf(wr, "code_data, using_code_len); wrbuf_puts(wr, ">\n"); } wrbuf_printf(wr, " iconv_cd, n->u.datafield.tag, - strlen(n->u.datafield.tag)); + strlen(n->u.datafield.tag)); wrbuf_printf(wr, ">\n", datafield_name[turbo]); break; case YAZ_MARC_CONTROLFIELD: - wrbuf_printf(wr, " <%s", controlfield_name[turbo]); - if (!turbo) { + wrbuf_printf(wr, " <%s", controlfield_name[turbo]); + if (!turbo) + { wrbuf_printf(wr, " tag=\""); - wrbuf_iconv_write_cdata(wr, mt->iconv_cd, n->u.controlfield.tag, + wrbuf_iconv_write_cdata(wr, mt->iconv_cd, n->u.controlfield.tag, strlen(n->u.controlfield.tag)); - wrbuf_iconv_puts(wr, mt->iconv_cd, "\">"); - } - else { - //TODO convert special - wrbuf_iconv_write_cdata(wr, mt->iconv_cd, n->u.controlfield.tag, + wrbuf_iconv_puts(wr, mt->iconv_cd, "\">"); + } + else + { + //TODO convert special + wrbuf_iconv_write_cdata(wr, mt->iconv_cd, n->u.controlfield.tag, strlen(n->u.controlfield.tag)); - wrbuf_iconv_puts(wr, mt->iconv_cd, ">"); - } - wrbuf_iconv_write_cdata(wr, mt->iconv_cd, - n->u.controlfield.data, - strlen(n->u.controlfield.data)); - marc_iconv_reset(mt, wr); - wrbuf_printf(wr, "iconv_cd, n->u.controlfield.tag, + wrbuf_iconv_puts(wr, mt->iconv_cd, ">"); + } + wrbuf_iconv_write_cdata(wr, mt->iconv_cd, + n->u.controlfield.data, + strlen(n->u.controlfield.data)); + marc_iconv_reset(mt, wr); + wrbuf_printf(wr, "iconv_cd, n->u.controlfield.tag, strlen(n->u.controlfield.tag)); - wrbuf_puts(wr, ">\n"); + wrbuf_puts(wr, ">\n"); break; case YAZ_MARC_COMMENT: wrbuf_printf(wr, "\n"); break; case YAZ_MARC_LEADER: - wrbuf_printf(wr, " <%s>", leader_name[turbo]); - wrbuf_iconv_write_cdata(wr, + wrbuf_printf(wr, " <%s>", leader_name[turbo]); + wrbuf_iconv_write_cdata(wr, 0 , /* no charset conversion for leader */ n->u.leader, strlen(n->u.leader)); wrbuf_printf(wr, "\n", leader_name[turbo]); @@ -810,7 +818,7 @@ static int yaz_marc_write_marcxml_ns2(yaz_marc_t mt, WRBUF wr, { wrbuf_printf(wr, " ind%d=\"", i+1); wrbuf_iconv_write_cdata(wr, mt->iconv_cd, - n->u.datafield.indicator+i, 1); + n->u.datafield.indicator+i, 1); wrbuf_iconv_puts(wr, mt->iconv_cd, "\""); } } @@ -875,9 +883,9 @@ static int yaz_marc_write_marcxml_ns(yaz_marc_t mt, WRBUF wr, xmlNode *root_ptr; if (yaz_marc_get_write_format(mt) == YAZ_MARC_MARCXML) - ret = yaz_marc_write_xml(mt, &root_ptr, ns, format, type); + ret = yaz_marc_write_xml(mt, &root_ptr, ns, format, type); else // Check for Turbo XML - ret = yaz_marc_write_turbo_xml(mt, &root_ptr, ns, format, type); + ret = yaz_marc_write_turbo_xml(mt, &root_ptr, ns, format, type); if (ret == 0) { xmlChar *buf_out; @@ -930,11 +938,13 @@ void add_marc_datafield_turbo_xml(yaz_marc_t mt, struct yaz_marc_node *n, xmlNod xmlNode *ptr; struct yaz_marc_subfield *s; int turbo = mt->output_format == YAZ_MARC_TMARCXML; - if (!turbo) { + if (!turbo) + { ptr = xmlNewChild(record_ptr, ns_record, BAD_CAST "datafield", 0); xmlNewProp(ptr, BAD_CAST "tag", BAD_CAST n->u.datafield.tag); } - else { + else + { //TODO consider if safe char field[10]; field[0] = 'd'; @@ -953,10 +963,10 @@ void add_marc_datafield_turbo_xml(yaz_marc_t mt, struct yaz_marc_node *n, xmlNod ind_val[0] = n->u.datafield.indicator[i]; ind_val[1] = '\0'; sprintf(ind_str, "%s%d", indicator_name[turbo], i+1); - xmlNewProp(ptr, BAD_CAST ind_str, BAD_CAST ind_val); + xmlNewProp(ptr, BAD_CAST ind_str, BAD_CAST ind_val); } } - WRBUF subfield_name = wrbuf_alloc(); + WRBUF subfield_name = wrbuf_alloc(); for (s = n->u.datafield.subfields; s; s = s->next) { xmlNode *ptr_subfield; @@ -966,38 +976,41 @@ void add_marc_datafield_turbo_xml(yaz_marc_t mt, struct yaz_marc_node *n, xmlNod wrbuf_iconv_puts(wr_cdata, mt->iconv_cd, s->code_data + using_code_len); marc_iconv_reset(mt, wr_cdata); - if (!turbo) { - ptr_subfield = xmlNewTextChild( - ptr, ns_record, - BAD_CAST "subfield", BAD_CAST wrbuf_cstr(wr_cdata)); - // Generate code attribute value and add - wrbuf_rewind(wr_cdata); - wrbuf_iconv_write(wr_cdata, mt->iconv_cd,s->code_data, using_code_len); - xmlNewProp(ptr_subfield, BAD_CAST "code", - BAD_CAST wrbuf_cstr(wr_cdata)); + if (!turbo) + { + ptr_subfield = xmlNewTextChild( + ptr, ns_record, + BAD_CAST "subfield", BAD_CAST wrbuf_cstr(wr_cdata)); + // Generate code attribute value and add + wrbuf_rewind(wr_cdata); + wrbuf_iconv_write(wr_cdata, mt->iconv_cd,s->code_data, using_code_len); + xmlNewProp(ptr_subfield, BAD_CAST "code", + BAD_CAST wrbuf_cstr(wr_cdata)); } - else { // Turbo format - wrbuf_rewind(subfield_name); - wrbuf_puts(subfield_name, "s"); - int not_written = element_name_append_attribute_value(mt, subfield_name, 0, s->code_data, using_code_len) != 0; - ptr_subfield = xmlNewTextChild(ptr, ns_record, - BAD_CAST wrbuf_cstr(subfield_name), - BAD_CAST wrbuf_cstr(wr_cdata)); - if (not_written) { + else + { // Turbo format + wrbuf_rewind(subfield_name); + wrbuf_puts(subfield_name, "s"); + int not_written = element_name_append_attribute_value(mt, subfield_name, 0, s->code_data, using_code_len) != 0; + ptr_subfield = xmlNewTextChild(ptr, ns_record, + BAD_CAST wrbuf_cstr(subfield_name), + BAD_CAST wrbuf_cstr(wr_cdata)); + if (not_written) + { // Generate code attribute value and add wrbuf_rewind(wr_cdata); - wrbuf_iconv_write(wr_cdata, mt->iconv_cd,s->code_data, using_code_len); - xmlNewProp(ptr_subfield, BAD_CAST "code", BAD_CAST wrbuf_cstr(wr_cdata)); - } + wrbuf_iconv_write(wr_cdata, mt->iconv_cd,s->code_data, using_code_len); + xmlNewProp(ptr_subfield, BAD_CAST "code", BAD_CAST wrbuf_cstr(wr_cdata)); + } } } - wrbuf_destroy(subfield_name); + wrbuf_destroy(subfield_name); } int yaz_marc_write_turbo_xml(yaz_marc_t mt, xmlNode **root_ptr, - const char *ns, - const char *format, - const char *type) + const char *ns, + const char *format, + const char *type) { struct yaz_marc_node *n; int identifier_length; @@ -1038,28 +1051,30 @@ int yaz_marc_write_turbo_xml(yaz_marc_t mt, xmlNode **root_ptr, switch(n->which) { case YAZ_MARC_DATAFIELD: - add_marc_datafield_turbo_xml(mt, n, record_ptr, ns_record, wr_cdata, identifier_length); + add_marc_datafield_turbo_xml(mt, n, record_ptr, ns_record, wr_cdata, identifier_length); break; case YAZ_MARC_CONTROLFIELD: wrbuf_rewind(wr_cdata); wrbuf_iconv_puts(wr_cdata, mt->iconv_cd, n->u.controlfield.data); marc_iconv_reset(mt, wr_cdata); - if (!turbo) { - ptr = xmlNewTextChild(record_ptr, ns_record, - BAD_CAST "controlfield", - BAD_CAST wrbuf_cstr(wr_cdata)); - xmlNewProp(ptr, BAD_CAST "tag", BAD_CAST n->u.controlfield.tag); + if (!turbo) + { + ptr = xmlNewTextChild(record_ptr, ns_record, + BAD_CAST "controlfield", + BAD_CAST wrbuf_cstr(wr_cdata)); + xmlNewProp(ptr, BAD_CAST "tag", BAD_CAST n->u.controlfield.tag); } - else { + else + { // TODO required iconv? char field[10]; - field[0] = 'c'; + field[0] = 'c'; strncpy(field + 1, n->u.controlfield.tag, 3); field[4] = '\0'; ptr = xmlNewTextChild(record_ptr, ns_record, - BAD_CAST field, - BAD_CAST wrbuf_cstr(wr_cdata)); + BAD_CAST field, + BAD_CAST wrbuf_cstr(wr_cdata)); } break; @@ -1068,14 +1083,14 @@ int yaz_marc_write_turbo_xml(yaz_marc_t mt, xmlNode **root_ptr, xmlAddChild(record_ptr, ptr); break; case YAZ_MARC_LEADER: - { - char *field = "leader"; - if (turbo) - field = "l"; - xmlNewTextChild(record_ptr, ns_record, BAD_CAST field, - BAD_CAST n->u.leader); - } - break; + { + char *field = "leader"; + if (turbo) + field = "l"; + xmlNewTextChild(record_ptr, ns_record, BAD_CAST field, + BAD_CAST n->u.leader); + } + break; } } wrbuf_destroy(wr_cdata); @@ -1386,7 +1401,7 @@ int yaz_marc_get_write_format(yaz_marc_t mt) */ void yaz_marc_xml(yaz_marc_t mt, int xmlmode) { - yaz_marc_set_write_format(mt, xmlmode); + yaz_marc_set_write_format(mt, xmlmode); } diff --git a/util/marcdump.c b/util/marcdump.c index edacc07..9ed9d1c 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -143,8 +143,8 @@ static void marcdump_read_xml(yaz_marc_t mt, const char *fname) else { int write_rc = yaz_marc_write_mode(mt, wrbuf); - if (write_rc) - yaz_log(YLOG_WARN, "yaz_marc_write_mode: write error: %d", write_rc); + if (write_rc) + yaz_log(YLOG_WARN, "yaz_marc_write_mode: write error: %d", write_rc); fputs(wrbuf_cstr(wrbuf), stdout); wrbuf_rewind(wrbuf); @@ -168,7 +168,7 @@ static void marcdump_read_xml(yaz_marc_t mt, const char *fname) continue; } if (!strcmp((const char *) ptr->name, "record") || - !strcmp((const char *) ptr->name, "r")) + !strcmp((const char *) ptr->name, "r")) { int r = yaz_marc_read_xml(mt, ptr); if (r) -- 1.7.10.4