ecere/com/BTNode: Serialize/Deserialize as BinaryTree as 32 bit for compatibility...
authorJerome St-Louis <jerome@ecere.com>
Mon, 30 Sep 2013 07:14:13 +0000 (03:14 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 30 Sep 2013 07:14:13 +0000 (03:14 -0400)
- Keep compatibility between 32/64 bit app [limit of 32 bit for using default serialization]
- Fixes EDB 64 bit compatibility issues (e.g. MedDB sample)

compiler/bootstrap/ecere/bootstrap/BTNode.c
compiler/bootstrap/ecere/bootstrap/ecere.main.c
ecere/src/com/BTNode.ec

index 9841ed3..b8071bf 100644 (file)
@@ -303,18 +303,20 @@ void __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(struct __ec
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_bool;
 
-extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_uintptr;
-
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_uint;
 
 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_OnSerialize(struct __ecereNameSpace__ecere__com__Class * class, struct __ecereNameSpace__ecere__sys__BTNode * this, struct __ecereNameSpace__ecere__com__Instance * channel)
 {
 if((struct __ecereNameSpace__ecere__sys__BTNode *)this)
 {
+unsigned int __internalValue000;
 unsigned int truth = 0x1;
 
 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_bool, &truth);
-__ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_uintptr, this->key);
+__ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_uint, __extension__ ({
+__internalValue000 = (unsigned int)this->key;
+&__internalValue000;
+}));
 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass___ecereNameSpace__ecere__sys__BTNode, this->left);
 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass___ecereNameSpace__ecere__sys__BTNode, this->right);
 }
@@ -342,7 +344,12 @@ __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ece
 if(truth)
 {
 (*this) = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__BTNode);
-__ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass_uintptr, &(*this)->key);
+{
+unsigned int k;
+
+__ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass_uint, &k);
+(*this)->key = k;
+}
 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass___ecereNameSpace__ecere__sys__BTNode, &(*this)->left);
 if((*this)->left)
 {
index 8be8240..77661c7 100644 (file)
@@ -577,8 +577,6 @@ struct __ecereNameSpace__ecere__com__Class * __ecereClass_uint;
 
 struct __ecereNameSpace__ecere__com__Class * __ecereClass_uint64;
 
-struct __ecereNameSpace__ecere__com__Class * __ecereClass_uintptr;
-
 void __ecereRegisterModule_BufferedFile(struct __ecereNameSpace__ecere__com__Instance * module);
 
 void __ecereUnregisterModule_BufferedFile(struct __ecereNameSpace__ecere__com__Instance * module);
@@ -1063,7 +1061,6 @@ __ecereClass_int = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "int"
 __ecereClass_int64 = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "int64");
 __ecereClass_uint = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "uint");
 __ecereClass_uint64 = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "uint64");
-__ecereClass_uintptr = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "uintptr");
 __ecereCreateModuleInstances_i18n();
 __ecereNameSpace__ecere__LoadTranslatedStrings(module, "ecere");
 }
index 609bded..797d707 100644 (file)
@@ -29,7 +29,7 @@ public:
       {
          bool truth = true;
          channel.Serialize(truth);
-         channel.Serialize(key);
+         channel.Serialize((uint)key); // Serialize/Deserialize as 32 bit for compatibility (e.g. EDB)
          channel.Serialize(left);
          channel.Serialize(right);
       }
@@ -48,7 +48,7 @@ public:
       {
          // TODO: Fix typed_object issues
          this = eInstance_New(class(BTNode));
-         channel.Unserialize(key);
+         { uint k; channel.Unserialize(k); key = k; }
          channel.Unserialize(left);
          if(left) { left.parent = this; }
          channel.Unserialize(right);