/*
- * Copyright (c) 1995-2000, Index Data.
+ * Copyright (c) 1995-2001, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_read.c,v $
- * Revision 1.35 2000-12-05 14:44:25 adam
+ * Revision 1.38 2001-03-27 23:06:21 adam
+ * Quotes and slashes may occur within attributes.
+ *
+ * Revision 1.37 2001/02/28 09:00:06 adam
+ * Fixed problem with stack overflow for very nested records.
+ *
+ * Revision 1.36 2001/02/21 13:46:53 adam
+ * C++ fixes.
+ *
+ * Revision 1.35 2000/12/05 14:44:25 adam
* Readers skips <! ...> sections.
*
* Revision 1.34 2000/12/05 10:06:23 adam
c = (*get_byte)(fh);
if (!c || c == '>' || c == '/')
break;
- *pp = p = nmem_malloc (m, sizeof(*p));
+ *pp = p = (data1_xattr *) nmem_malloc (m, sizeof(*p));
p->next = 0;
pp = &p->next;
p->value = 0;
}
wrbuf_putc (wrbuf, '\0');
len = wrbuf_len(wrbuf);
- p->name = nmem_malloc (m, len);
+ p->name = (char*) nmem_malloc (m, len);
strcpy (p->name, wrbuf_buf(wrbuf));
if (c == '=')
{
c = (*get_byte)(fh);
if (c == '"')
- c = (*get_byte)(fh);
- wrbuf_rewind(wrbuf);
- while (c && c != '"' && c != '>' && c != '/')
{
- wrbuf_putc (wrbuf, c);
- c = (*get_byte)(fh);
+ c = (*get_byte)(fh);
+ wrbuf_rewind(wrbuf);
+ while (c && c != '"')
+ {
+ wrbuf_putc (wrbuf, c);
+ c = (*get_byte)(fh);
+ }
+ if (c)
+ c = (*get_byte)(fh);
}
+ else
+ {
+ wrbuf_rewind(wrbuf);
+ while (c && c != '>' && c != '/')
+ {
+ wrbuf_putc (wrbuf, c);
+ c = (*get_byte)(fh);
+ }
+ }
wrbuf_putc (wrbuf, '\0');
len = wrbuf_len(wrbuf);
- p->value = nmem_malloc (m, len);
+ p->value = (char*) nmem_malloc (m, len);
strcpy (p->value, wrbuf_buf(wrbuf));
- if (c == '"')
- c = (*get_byte)(fh);
}
}
*ch = c;
parent->child = res;
d1_stack[level] = res;
d1_stack[level+1] = 0;
- if (!null_tag)
+ if (level < 250 && !null_tag)
++level;
}
else /* != '<'... this is a body of text */