Update of /cvsroot/monetdb/pathfinder/runtime
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31184/runtime

Modified Files:
        shredder.mx 
Log Message:
propagated changes of Friday Feb 20 2009
from the Feb2009 branch to the development trunk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/02/20 - jflokstra: runtime/shredder.mx,1.153.2.4
- fix [ monetdb-Bugs-2586088 ] XQ: large text nodes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U shredder.mx
Index: shredder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/shredder.mx,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- shredder.mx 9 Feb 2009 08:31:03 -0000       1.154
+++ shredder.mx 20 Feb 2009 09:25:09 -0000      1.155
@@ -362,6 +362,7 @@
     int      sp;                 /* the stackpointer */
     /* buffer administration */
     int      content;            /* content ptr in char buff */
+    int             content_max;        /* max size of content buffer */
     char     *content_buf;       /* character buffer */
     /* */
     size_t   fileSize;           /* size of the input file */
@@ -1105,14 +1106,13 @@
                  int n)
 {
     shredCtxStruct *shredCtx = (shredCtxStruct*) xmlCtx;
-    int l = MIN(PFSHRED_STRLEN_MAX -(int) shredCtx->content, n);
-
-    memcpy(&(shredCtx->content_buf[shredCtx->content]), cs, l);
-    shredCtx->content += l;
 
-    if (l < n)
-        stream_printf(GDKout, "!WARNING: shred_characters truncated text node 
> %d characters(starts with `%.16s...')\n", 
-               (int) PFSHRED_STRLEN_MAX, cs);
+    if ( (shredCtx->content + n + 1) < shredCtx->content_max) {
+       shredCtx->content_max = shredCtx->content + n + 1;
+        shredCtx->content_buf = GDKrealloc(shredCtx->content_buf, 
shredCtx->content_max);
+    }
+    memcpy(&(shredCtx->content_buf[shredCtx->content]), cs, n);
+    shredCtx->content += n;
 }
 
 /**
@@ -1831,7 +1831,8 @@
     /* allocate some buffers used during parse */
     shredCtx->val = (char*) GDKmalloc(PFSHRED_BUFLEN+1);
     shredCtx->lifo = (node_t *) GDKmalloc((XML_DEPTH_MAX+1) * sizeof(node_t));
-    shredCtx->content_buf = (char*) GDKmalloc(PFSHRED_STRLEN_MAX);
+    shredCtx->content_max = PFSHRED_STRLEN_MAX;
+    shredCtx->content_buf = (char*) GDKmalloc(shredCtx->content_max);
     if (shredCtx->val == NULL || shredCtx->content_buf == NULL || 
shredCtx->lifo == NULL) {
         return shredder_free(shredCtx,-shredCtx->incremental);
     }


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to