| 738 | } |
| 739 | |
| 740 | static int |
| 741 | xmlSBufGrow(xmlSBuf *buf, unsigned len) { |
| 742 | xmlChar *mem; |
| 743 | unsigned cap; |
| 744 | |
| 745 | if (len >= UINT_MAX / 2 - buf->size) { |
| 746 | if (buf->code == XML_ERR_OK) |
| 747 | buf->code = XML_ERR_RESOURCE_LIMIT; |
| 748 | return(-1); |
| 749 | } |
| 750 | |
| 751 | cap = (buf->size + len) * 2; |
| 752 | if (cap < 240) |
| 753 | cap = 240; |
| 754 | |
| 755 | mem = xmlRealloc(buf->mem, cap); |
| 756 | if (mem == NULL) { |
| 757 | buf->code = XML_ERR_NO_MEMORY; |
| 758 | return(-1); |
| 759 | } |
| 760 | |
| 761 | buf->mem = mem; |
| 762 | buf->cap = cap; |
| 763 | |
| 764 | return(0); |
| 765 | } |
| 766 | |
| 767 | static void |
| 768 | xmlSBufAddString(xmlSBuf *buf, const xmlChar *str, unsigned len) { |
no outgoing calls
no test coverage detected