Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/82045

Fixed bug when parsing a document with a base-uri attribute
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/82045
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2011-11-11 10:37:11 +0000
+++ ChangeLog	2011-11-12 06:51:25 +0000
@@ -36,6 +36,7 @@
   * Fixed bug #859522 (Fatal error if a PUL contains two delete document primitives)
   * Fixed bug #859968 (Using put on an attribute produces an invalid XDM instance and may cause segmentation faults)
   * Fixed bug #855314 (should not fold a constant expr that returns an error item)
+  * Fixed bug when parsing a document with a base-uri attribute.
   * Added ExternalFunctionParameter class to be registered in the DynamicContext
   * Fixed bug #863320 (Sentence is incorrectly incremented when token characters end without sentence terminator)
   * Fixed bug #863730 (static delete-node* functions don't raise ZDDY0012)

=== modified file 'src/store/naive/loader_dtd.cpp'
--- src/store/naive/loader_dtd.cpp	2011-10-30 15:47:55 +0000
+++ src/store/naive/loader_dtd.cpp	2011-11-12 06:51:25 +0000
@@ -586,17 +586,23 @@
     theBuffer.resize(static_cast<unsigned int>(fileSize+1));
     theBuffer[fileSize] = 0;
 
-    std::streamsize numChars = readPacket(stream, static_cast<char*>(&theBuffer[0]), fileSize);
+    std::streamsize numChars = readPacket(stream,
+                                          static_cast<char*>(&theBuffer[0]),
+                                          fileSize);
 
     if (numChars < 0)
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));
+
       abortload();
       return NULL;
     }
     else if (numChars == 0)
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, ERROR_PARAMS(ZED(NoInputData))));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR,
+                                    ERROR_PARAMS(ZED(NoInputData))));
       abortload();
       return NULL;
     }
@@ -1200,6 +1206,8 @@
         }
 
         elemNode->getBaseURI(baseUri);
+
+        ++i;
       }
 
       loader.theOrdPath.nextChild();
@@ -1226,9 +1234,8 @@
   }
   catch (...)
   {
-    loader.theXQueryDiagnostics->add_error(
-      NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR )
-    );
+    loader.theXQueryDiagnostics->
+    add_error(NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR));
   }
 }
 

=== modified file 'src/store/naive/loader_fast.cpp'
--- src/store/naive/loader_fast.cpp	2011-11-02 17:19:09 +0000
+++ src/store/naive/loader_fast.cpp	2011-11-12 06:51:25 +0000
@@ -704,6 +704,9 @@
           }
 
           elemNode->getBaseURI(baseUri);
+
+          ++i;
+          ++numAttributes;
         }
 
         loader.theOrdPath.nextChild();
@@ -727,9 +730,8 @@
   }
   catch (...)
   {
-    loader.theXQueryDiagnostics->add_error(
-      NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR )
-    );
+    loader.theXQueryDiagnostics->
+    add_error(NEW_ZORBA_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR));
   }
 }
 

=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2011-11-02 17:19:09 +0000
+++ src/store/naive/node_items.cpp	2011-11-12 06:51:25 +0000
@@ -2660,9 +2660,7 @@
 
   if (found && ns2 != ns)
   {
-    throw XQUERY_EXCEPTION_VAR(
-      ecode, ERROR_PARAMS( qname->show(), prefix, ns2 )
-    );
+    throw XQUERY_EXCEPTION_VAR(ecode, ERROR_PARAMS(qname->show(), prefix, ns2));
   }
 }
 
@@ -2678,11 +2676,9 @@
   for (; ite != end; ++ite)
   {
     AttributeNode* attr = static_cast<AttributeNode*>(*ite);
-    if (!attr->isHidden() && attr->getNodeName()->equals(attrName))
+    if (attr != NULL && !attr->isHidden() && attr->getNodeName()->equals(attrName))
     {
-      throw XQUERY_EXCEPTION(
-        err::XQDY0025, ERROR_PARAMS( attrName->getStringValue() )
-      );
+      throw XQUERY_EXCEPTION(err::XQDY0025, ERROR_PARAMS(attrName->getStringValue()));
     }
   }
 }
@@ -2713,9 +2709,7 @@
 
       if (!otherAttr->isHidden() && otherAttr->getNodeName()->equals(attrName))
       {
-        throw XQUERY_EXCEPTION(
-          err::XUDY0021, ERROR_PARAMS( attrName->getStringValue() )
-        );
+        throw XQUERY_EXCEPTION(err::XUDY0021, ERROR_PARAMS(attrName->getStringValue()));
       }
     }
   }

=== added file 'test/rbkt/Queries/zorba/misc/baseuri.xml'
--- test/rbkt/Queries/zorba/misc/baseuri.xml	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/misc/baseuri.xml	2011-11-12 06:51:25 +0000
@@ -0,0 +1,1 @@
+<id xml:base='http://wow' xml:id='id0'/>

=== added file 'test/rbkt/Queries/zorba/misc/baseuri.xq'
--- test/rbkt/Queries/zorba/misc/baseuri.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/misc/baseuri.xq	2011-11-12 06:51:25 +0000
@@ -0,0 +1,2 @@
+
+doc("temp.xml")

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to