1From a15f2abef1463c20bc62a455e983e34b2278f279 Mon Sep 17 00:00:00 2001 2From: David Kilzer <ddkilzer@webkit.org> 3Date: Fri, 8 Apr 2022 12:16:51 -0700 4Subject: [PATCH 260/300] Use UPDATE_COMPAT() consistently in buf.c 5 6* buf.c: 7(xmlBufCreate): 8(xmlBufCreateSize): 9(xmlBufDetach): 10(xmlBufCreateStatic): 11(xmlBufFromBuffer): 12 13Reference:https://github.com/GNOME/libxml2/commit/a15f2abef1463c20bc62a455e983e34b2278f279 14Conflict:Context adaptation 15 16--- 17 buf.c | 20 +++++--------------- 18 1 file changed, 5 insertions(+), 15 deletions(-) 19 20diff --git a/buf.c b/buf.c 21index 40a5ee0..d341750 100644 22--- a/buf.c 23+++ b/buf.c 24@@ -131,12 +131,11 @@ xmlBufCreate(void) { 25 xmlBufMemoryError(NULL, "creating buffer"); 26 return(NULL); 27 } 28- ret->compat_use = 0; 29 ret->use = 0; 30 ret->error = 0; 31 ret->buffer = NULL; 32 ret->size = xmlDefaultBufferSize; 33- ret->compat_size = xmlDefaultBufferSize; 34+ UPDATE_COMPAT(ret); 35 ret->alloc = xmlBufferAllocScheme; 36 ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); 37 if (ret->content == NULL) { 38@@ -167,13 +166,12 @@ xmlBufCreateSize(size_t size) { 39 xmlBufMemoryError(NULL, "creating buffer"); 40 return(NULL); 41 } 42- ret->compat_use = 0; 43 ret->use = 0; 44 ret->error = 0; 45 ret->buffer = NULL; 46 ret->alloc = xmlBufferAllocScheme; 47 ret->size = (size ? size + 1 : 0); /* +1 for ending null */ 48- ret->compat_size = (ret->size > INT_MAX ? INT_MAX : ret->size); 49+ UPDATE_COMPAT(ret); 50 if (ret->size){ 51 ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); 52 if (ret->content == NULL) { 53@@ -215,8 +213,7 @@ xmlBufDetach(xmlBufPtr buf) { 54 buf->content = NULL; 55 buf->size = 0; 56 buf->use = 0; 57- buf->compat_use = 0; 58- buf->compat_size = 0; 59+ UPDATE_COMPAT(buf); 60 61 return ret; 62 } 63@@ -245,15 +242,9 @@ xmlBufCreateStatic(void *mem, size_t size) { 64 xmlBufMemoryError(NULL, "creating buffer"); 65 return(NULL); 66 } 67- if (size < INT_MAX) { 68- ret->compat_use = size; 69- ret->compat_size = size; 70- } else { 71- ret->compat_use = INT_MAX; 72- ret->compat_size = INT_MAX; 73- } 74 ret->use = size; 75 ret->size = size; 76+ UPDATE_COMPAT(ret); 77 ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE; 78 ret->content = (xmlChar *) mem; 79 ret->error = 0; 80@@ -1159,8 +1150,7 @@ xmlBufFromBuffer(xmlBufferPtr buffer) { 81 } 82 ret->use = buffer->use; 83 ret->size = buffer->size; 84- ret->compat_use = buffer->use; 85- ret->compat_size = buffer->size; 86+ UPDATE_COMPAT(ret); 87 ret->error = 0; 88 ret->buffer = buffer; 89 ret->alloc = buffer->alloc; 90-- 912.27.0 92 93