zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1355654 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/java/main/org/apache/jute/compiler/JRecord.java
Date Sat, 30 Jun 2012 06:44:13 GMT
Author: phunt
Date: Sat Jun 30 06:44:12 2012
New Revision: 1355654

URL: http://svn.apache.org/viewvc?rev=1355654&view=rev
Log:
ZOOKEEPER-1471. Jute generates invalid C++ code (Michi Mutsuzaki via phunt)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/java/main/org/apache/jute/compiler/JRecord.java

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1355654&r1=1355653&r2=1355654&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Sat Jun 30 06:44:12 2012
@@ -71,6 +71,9 @@ BUGFIXES:
   ZOOKEEPER-1236. Security uses proprietary Sun APIs
     (Adalberto Medeiros via phunt)
 
+  ZOOKEEPER-1471. Jute generates invalid C++ code
+    (Michi Mutsuzaki via phunt)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1389. it would be nice if start-foreground used exec $JAVA

Modified: zookeeper/branches/branch-3.4/src/java/main/org/apache/jute/compiler/JRecord.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/main/org/apache/jute/compiler/JRecord.java?rev=1355654&r1=1355653&r2=1355654&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/main/org/apache/jute/compiler/JRecord.java (original)
+++ zookeeper/branches/branch-3.4/src/java/main/org/apache/jute/compiler/JRecord.java Sat
Jun 30 06:44:12 2012
@@ -99,7 +99,7 @@ public class JRecord extends JCompType {
     }
 
     public String genCppDecl(String fname) {
-        return "  "+mName+" "+fname+";\n";
+        return "  "+ getCppNameSpace() + "::" + mName+" m"+fname+";\n";
     }
 
     public String genJavaReadMethod(String fname, String tag) {
@@ -320,9 +320,9 @@ public class JRecord extends JCompType {
             JField jf = i.next();
             String name = jf.getName();
             if (jf.getType() instanceof JBuffer) {
-                cc.write("  a_.serialize("+name+","+name+".length(),\""+jf.getTag()+"\");\n");
+                cc.write("  a_.serialize(m"+name+",m"+name+".length(),\""+jf.getTag()+"\");\n");
             } else {
-                cc.write("  a_.serialize("+name+",\""+jf.getTag()+"\");\n");
+                cc.write("  a_.serialize(m"+name+",\""+jf.getTag()+"\");\n");
             }
             cc.write("  bs_.reset("+fIdx+");\n");
         }
@@ -337,9 +337,9 @@ public class JRecord extends JCompType {
             JField jf = i.next();
             String name = jf.getName();
             if (jf.getType() instanceof JBuffer) {
-                cc.write("  { size_t len=0; a_.deserialize("+name+",len,\""+jf.getTag()+"\");}\n");
+                cc.write("  { size_t len=0; a_.deserialize(m"+name+",len,\""+jf.getTag()+"\");}\n");
             } else {
-                cc.write("  a_.deserialize("+name+",\""+jf.getTag()+"\");\n");
+                cc.write("  a_.deserialize(m"+name+",\""+jf.getTag()+"\");\n");
             }
             cc.write("  bs_.set("+fIdx+");\n");
         }
@@ -353,7 +353,7 @@ public class JRecord extends JCompType {
             JField jf = (JField) i.next();
             JType type = jf.getType();
             if (type instanceof JRecord) {
-                cc.write("  if (!"+jf.getName()+".validate()) return false;\n");
+                cc.write("  if (!m"+jf.getName()+".validate()) return false;\n");
             }
         }
         cc.write("  return true;\n");
@@ -364,7 +364,7 @@ public class JRecord extends JCompType {
         for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
             JField jf = i.next();
             String name = jf.getName();
-            cc.write("    && ("+name+" < peer_."+name+")\n");
+            cc.write("    && (m"+name+" < peer_.m"+name+")\n");
         }
         cc.write("  );\n");
         cc.write("}\n");
@@ -374,7 +374,7 @@ public class JRecord extends JCompType {
         for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
             JField jf = i.next();
             String name = jf.getName();
-            cc.write("    && ("+name+" == peer_."+name+")\n");
+            cc.write("    && (m"+name+" == peer_.m"+name+")\n");
         }
         cc.write("  );\n");
         cc.write("}\n");



Mime
View raw message