add clip folders, icon margins, fix safe regions, update neophyte, fix folder edl...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / filexml.C
index 9c99d3f8364b262c318cb5980a77b09889b69ede..f474317853562554b3a36b9429adc3352ff90bc3 100644 (file)
@@ -58,7 +58,7 @@ XMLBuffer::XMLBuffer(const char *buf, long buf_size, int del)
        destroy = del;
 }
 
-XMLBuffer::XMLBuffer(long buf_size, const char *buf, int del)
+XMLBuffer::XMLBuffer(long buf_size, char *buf, int del)
 {      // writing
        bfr = (unsigned char *)buf;
        bsz = buf_size;
@@ -73,9 +73,10 @@ XMLBuffer::~XMLBuffer()
        if( destroy ) delete [] bfr;
 }
 
-unsigned char *&XMLBuffer::demand(long len)
+int XMLBuffer::demand(long len)
 {
        if( len > bsz ) {
+               if( !destroy ) return 0;
                long sz = inp-bfr;
                len += sz/2 + BCTEXTLEN;
                unsigned char *np = new unsigned char[len];
@@ -85,13 +86,13 @@ unsigned char *&XMLBuffer::demand(long len)
                lmt = np + len;  bsz = len;
                delete [] bfr;   bfr = np;
        }
-       return bfr;
+       return 1;
 }
 
 int XMLBuffer::write(const char *bp, int len)
 {
-       if( !destroy && lmt-inp < len ) len = lmt-inp;
        if( len <= 0 ) return 0;
+       if( !destroy && lmt-inp < len ) len = lmt-inp;
        demand(otell()+len);
        memmove(inp,bp,len);
        inp += len;
@@ -324,8 +325,12 @@ int XMLTag::read_tag(FileXML *xml)
                else
                        term = ' ';
                value_start = buf->itell()-1;
-               while( ch >= 0 && (ch!=term && ch!=right_delm && ch!='\n') )
+               while( ch >= 0 ) {
+// old edl bug work-around, allow nl in quoted string
+                       if( ch==term || ch==right_delm ) break;
+                       if( ch=='\n' && term!='\"' ) break;
                        ch = buf->next();
+               }
                if( ch < 0 ) EOB_RETURN();
                value_end = buf->itell()-1;
 // add property
@@ -518,7 +523,7 @@ int FileXML::read_data_until(const char *tag_end, char *out, int len, int skip)
                ++pos;
        }
 // if end tag is reached, pos is left on the < of the end tag
-       if( !skip && pos >= 0 && !tag_end[pos] && !skip )
+       if( !skip && pos >= 0 && !tag_end[pos] )
                buffer->iseek(ipos);
        return opos;
 }