Re: Data recording
Nathan Hjelm <[email protected]>
| Newsgroups | gmane.comp.mobile.bitpim.devel |
|---|---|
| Message-ID | <[email protected]> |
It was easy enough to fix always assuming little endian. Patch attached. -Nathan On Jun 29, 2008, at 8:52 AM, Nathan Hjelm wrote: > Data recording has endianness issues. I see three possible ways to > address the endianness issue. The easiest is to always use one > endianness when writing the file. Given most people are using intel > then little-endian would be desireable. Other was to address the > endianness issue would be to add an additional binary value in the > header to help detect the endianness of the file or just use ASCII for > everything. > > -Nathan > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > BitPim-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/bitpim-devel ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ BitPim-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bitpim-devel
DR.patch
(application/octet-stream, 914 B)
Index: src/data_recording.py
===================================================================
--- src/data_recording.py (revision 4621)
+++ src/data_recording.py (working copy)
@@ -253,7 +253,7 @@
def _write_record(self, dr_type, dr_data, dr_class=None):
_rec=DR_Record(dr_type, dr_data, dr_class)
_s=cPickle.dumps(_rec)
- self._file.write(DR_Rec_Marker+struct.pack('L', len(_s))+_s)
+ self._file.write(DR_Rec_Marker+struct.pack('<L', len(_s))+_s)
def stop(self):
global DR_On, _the_recorder
@@ -299,7 +299,7 @@
return None
try:
_slen=self._file.read(struct.calcsize('L'))
- _data_len=struct.unpack('L', _slen)[0]
+ _data_len=struct.unpack('<L', _slen)[0]
_sdata=self._file.read(_data_len)
return cPickle.loads(_sdata)
except (MemoryError, cPickle.UnpicklingError):