Rodolfo Ochoa has proposed merging lp:~zorba-coders/zorba/bug905028 into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #905028 in Zorba: "Base URI can't be set to undefined"
  https://bugs.launchpad.net/zorba/+bug/905028

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug905028/+merge/104447

BaseURI can now be cleared throgh a method.
When BaseUri is undefined it returns an empty string instead of asserting.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug905028/+merge/104447
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/static_context.h'
--- include/zorba/static_context.h	2012-04-24 12:39:38 +0000
+++ include/zorba/static_context.h	2012-05-02 20:26:19 +0000
@@ -319,6 +319,12 @@
   getCopyNamespacesMode( preserve_mode_t& aPreserve,
                          inherit_mode_t& aInherit ) const = 0;
 
+  /** \brief Clears the base URI and sets it to undefined state.
+   *         (see http://www.w3.org/TR/xquery/#static_context)
+   */
+  virtual void
+  clearBaseURI() = 0;
+
   /** \brief Set the base URI.
    *         (see http://www.w3.org/TR/xquery/#static_context)
    *

=== modified file 'src/api/staticcontextimpl.cpp'
--- src/api/staticcontextimpl.cpp	2012-04-24 18:22:23 +0000
+++ src/api/staticcontextimpl.cpp	2012-05-02 20:26:19 +0000
@@ -591,6 +591,23 @@
   ZORBA_CATCH
 }
 
+void
+StaticContextImpl::clearBaseURI()
+{
+  try
+  {
+    theCtx->clear_base_uri();
+  }
+  catch (ZorbaException const& e)
+  {
+    ZorbaImpl::notifyError(theDiagnosticHandler, e);
+  }
+  catch (std::exception const& e)
+  {
+    ZorbaImpl::notifyError(theDiagnosticHandler, e.what());
+  }
+}
+
 
 bool
 StaticContextImpl::setBaseURI( const String& aBaseURI )

=== modified file 'src/api/staticcontextimpl.h'
--- src/api/staticcontextimpl.h	2012-04-24 18:22:23 +0000
+++ src/api/staticcontextimpl.h	2012-05-02 20:26:19 +0000
@@ -143,6 +143,9 @@
   getCopyNamespacesMode( preserve_mode_t& preserve,
                          inherit_mode_t& inherit ) const;
 
+  virtual void
+  clearBaseURI();
+
   virtual bool
   setBaseURI( const String& baseURI );
 

=== modified file 'src/compiler/rewriter/tools/dataflow_annotations.h'
--- src/compiler/rewriter/tools/dataflow_annotations.h	2012-04-24 12:39:38 +0000
+++ src/compiler/rewriter/tools/dataflow_annotations.h	2012-05-02 20:26:19 +0000
@@ -18,11 +18,12 @@
 #define ZORBA_COMPILER_DATAFLOW_ANNOTATIONS_H
 
 #include "compiler/expression/expr_classes.h"
+#include "compiler/rewriter/framework/rewriter_context.h"
 
 namespace zorba 
 {
 
-class UDFCallChain;
+//class UDFCallChain;
 
 
 /*******************************************************************************

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2012-04-27 10:20:33 +0000
+++ src/context/static_context.cpp	2012-05-02 20:26:19 +0000
@@ -1265,8 +1265,7 @@
 
     sctx = sctx->theParent;
   }
-
-  ZORBA_ASSERT(false);
+  return "";  //undefined
 }
 
 
@@ -1298,6 +1297,17 @@
   compute_base_uri();
 }
 
+/***************************************************************************//**
+
+********************************************************************************/
+void static_context::clear_base_uri()
+{
+  if (theBaseUriInfo)
+    delete theBaseUriInfo;
+
+    theBaseUriInfo = new BaseUriInfo;
+}
+
 
 /***************************************************************************//**
   Base Uri Computation
@@ -1419,8 +1429,8 @@
     return;
   }
 
-  theBaseUriInfo->theBaseUri = get_implementation_baseuri();
-  theBaseUriInfo->theHaveBaseUri = true;
+  theBaseUriInfo->theBaseUri = "";
+  theBaseUriInfo->theHaveBaseUri = false;
   return;
 }
 

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2012-04-24 18:22:23 +0000
+++ src/context/static_context.h	2012-05-02 20:26:19 +0000
@@ -651,6 +651,8 @@
 
   zstring get_base_uri() const;
 
+  void clear_base_uri();
+
   void set_base_uri(const zstring& uri, bool from_prolog = true);
 
   void compute_base_uri();

=== modified file 'src/functions/func_ft_module_impl.cpp'
--- src/functions/func_ft_module_impl.cpp	2012-04-26 13:25:13 +0000
+++ src/functions/func_ft_module_impl.cpp	2012-05-02 20:26:19 +0000
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "stdafx.h"
 #include "functions/func_ft_module_impl.h"
 
 #include "runtime/full_text/ft_module.h"

=== modified file 'src/functions/func_sequences_impl.h'
--- src/functions/func_sequences_impl.h	2012-04-24 12:39:38 +0000
+++ src/functions/func_sequences_impl.h	2012-05-02 20:26:19 +0000
@@ -224,7 +224,7 @@
 
   bool propagatesInputNodes(expr* fo, csize input) const
   {
-    return ANNOTATION_TRUE_FIXED;
+    return ANNOTATION_TRUE_FIXED!=0;
   }
 
   bool mustCopyInputNodes(expr* fo, csize input) const
@@ -276,7 +276,7 @@
 
   bool propagatesInputNodes(expr* fo, csize input) const
   {
-    return ANNOTATION_TRUE_FIXED;
+    return ANNOTATION_TRUE_FIXED!=0;
   }
 
   bool mustCopyInputNodes(expr* fo, csize input) const

=== modified file 'src/runtime/full_text/ft_module_impl.cpp'
--- src/runtime/full_text/ft_module_impl.cpp	2012-04-28 00:48:03 +0000
+++ src/runtime/full_text/ft_module_impl.cpp	2012-05-02 20:26:19 +0000
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+#include "stdafx.h"
 #include <zorba/config.h>
 
 // This entire file should be effectively skipped when building with

=== modified file 'src/store/naive/atomic_items.cpp'
--- src/store/naive/atomic_items.cpp	2012-04-26 16:49:06 +0000
+++ src/store/naive/atomic_items.cpp	2012-05-02 20:26:19 +0000
@@ -3510,7 +3510,7 @@
     {
       throw ZORBA_EXCEPTION( zerr::ZOSE0003_STREAM_READ_FAILURE );
     }
-    if (len == 0)
+    if (len == std::streampos(0))
     {
       return;
     }

=== modified file 'src/zorbautils/locale.cpp'
--- src/zorbautils/locale.cpp	2012-04-24 18:22:23 +0000
+++ src/zorbautils/locale.cpp	2012-05-02 20:26:19 +0000
@@ -70,7 +70,7 @@
 static char* get_win32_locale_info( int constant ) {
   int bytes = ::GetLocaleInfoA( LOCALE_USER_DEFAULT, constant, NULL, 0 );
   ZORBA_FATAL( bytes, "GetLocaleInfoA() failed" );
-  unique_ptr<char[]> info = new char[ bytes ];
+  unique_ptr<char[]> info (new char[ bytes ]);
   bytes = ::GetLocaleInfoA( LOCALE_USER_DEFAULT, constant, info.get(), bytes );
   ZORBA_FATAL( bytes, "GetLocaleInfoA() failed" );
   return info.release();

-- 
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