incubator-vxquery-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject svn commit: r1390770 - in /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions: cast/CastToQNameOperation.java qname/FnQNameScalarEvaluatorFactory.java strings/AbstractCharacterIteratorCopyingEvaluator.java
Date Wed, 26 Sep 2012 23:06:04 GMT
Author: prestonc
Date: Wed Sep 26 23:06:03 2012
New Revision: 1390770

URL: http://svn.apache.org/viewvc?rev=1390770&view=rev
Log:
Found more functions that used writeChar function incorrectly. Updated to use our custom function
in the helper class.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToQNameOperation.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnQNameScalarEvaluatorFactory.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/AbstractCharacterIteratorCopyingEvaluator.java

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToQNameOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToQNameOperation.java?rev=1390770&r1=1390769&r2=1390770&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToQNameOperation.java
(original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToQNameOperation.java
Wed Sep 26 23:06:03 2012
@@ -24,6 +24,7 @@ import org.apache.vxquery.datamodel.valu
 import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.strings.ICharacterIterator;
 import org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator;
+import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -49,7 +50,7 @@ public class CastToQNameOperation extend
             if (c == Character.valueOf(':')) {
                 prefixLength = abvsInner.getLength();
             } else {
-                dOutInner.writeChar(c);
+                FunctionHelper.writeChar((char) c, dOutInner);
             }
         }
 

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnQNameScalarEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnQNameScalarEvaluatorFactory.java?rev=1390770&r1=1390769&r2=1390770&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnQNameScalarEvaluatorFactory.java
(original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnQNameScalarEvaluatorFactory.java
Wed Sep 26 23:06:03 2012
@@ -109,7 +109,7 @@ public class FnQNameScalarEvaluatorFacto
                         if (c == Character.valueOf(':')) {
                             prefixLength = abvsParamQName.getLength();
                         } else {
-                            dOutParamQName.writeChar(c);
+                            FunctionHelper.writeChar((char) c, dOutParamQName);
                         }
                     }
 

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/AbstractCharacterIteratorCopyingEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/AbstractCharacterIteratorCopyingEvaluator.java?rev=1390770&r1=1390769&r2=1390770&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/AbstractCharacterIteratorCopyingEvaluator.java
(original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/AbstractCharacterIteratorCopyingEvaluator.java
Wed Sep 26 23:06:03 2012
@@ -24,6 +24,7 @@ import org.apache.vxquery.datamodel.valu
 import org.apache.vxquery.exceptions.ErrorCode;
 import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
+import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import edu.uci.ics.hyracks.data.std.api.IPointable;
@@ -50,29 +51,19 @@ public abstract class AbstractCharacterI
             out.write(ValueTag.XS_STRING_TAG);
 
             // Default values for the length and update later
-            out.write(0xFF);
-            out.write(0xFF);
+            out.write(0);
+            out.write(0);
 
             int c;
             while (ICharacterIterator.EOS_CHAR != (c = charIterator.next())) {
-                if ((c >= 0x0001) && (c <= 0x007F)) {
-                    out.write((byte) c);
-                } else if (c > 0x07FF) {
-                    out.write((byte) (0xE0 | ((c >> 12) & 0x0F)));
-                    out.write((byte) (0x80 | ((c >> 6) & 0x3F)));
-                    out.write((byte) (0x80 | ((c >> 0) & 0x3F)));
-                } else {
-                    out.write((byte) (0xC0 | ((c >> 6) & 0x1F)));
-                    out.write((byte) (0x80 | ((c >> 0) & 0x3F)));
-                }
+                FunctionHelper.writeChar((char) c, out);
             }
 
             // Update the full length string in the byte array.
-            byte[] stringResult = abvs.getByteArray();
-            stringResult[1] = (byte) (((abvs.getLength() - 3) >>> 8) & 0xFF);
-            stringResult[2] = (byte) (((abvs.getLength() - 3) >>> 0) & 0xFF);
+            abvs.getByteArray()[1] = (byte) (((abvs.getLength() - 3) >>> 8) &
0xFF);
+            abvs.getByteArray()[2] = (byte) (((abvs.getLength() - 3) >>> 0) &
0xFF);
 
-            result.set(stringResult, 0, abvs.getLength());
+            result.set(abvs.getByteArray(), abvs.getStartOffset(), abvs.getLength());
         } catch (IOException e) {
             throw new SystemException(ErrorCode.SYSE0001, e);
         }



Mime
View raw message