Re: XML_ParseBuffer keeps returning 4 bytes?
Mohun Biswas <[email protected]>
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
It sounds like you're confusing the size of the pointer with the size of
the buffer it points to. The size of a *pointer* will almost always be 4
bytes. The size of the area it points at is whatever you allocate. You
didn't post code but consider the sample code in reference.html:
for (;;) {
int bytes_read;
void *buff = XML_GetBuffer(p, BUFF_SIZE);
if (buff == NULL) {
/* handle error */
}
bytes_read = read(docfd, buff, BUFF_SIZE);
if (bytes_read < 0) {
/* handle error */
}
if (! XML_ParseBuffer(p, bytes_read, bytes_read == 0)) {
/* handle parse error */
}
if (bytes_read == 0)
break;
}
Sounds like you're using sizeof(buff) in the read() call rather than
BUFF_SIZE.
MB