[sync] ActiveSync issues
Ivan Kouvykov
ivan at kouvykov.com
Tue Aug 13 09:06:59 UTC 2013
С уважением, / Kindest regards,
Иван Кувыков / Ivan Kouvykov
ivan at kouvykov.com
> -----Original Message-----
> From: sync-bounces at lists.horde.org [mailto:sync-bounces at lists.horde.org]
> On Behalf Of Michael J Rubinsky
> Sent: Tuesday, August 13, 2013 4:21 AM
> To: sync at lists.horde.org
> Subject: Re: [sync] ActiveSync issues
>
>
> Quoting Ivan kouvykov <ivan at kouvykov.com>:
>
>
> >
> > It turned out that my box CPU is big-endian while data in blob is
> > little-endian. Once I changed endianness in unpack format calendars
> > started syncing.
>
> So, did you do something like this in php?
>
> function isLittleEndian() {
> $testint = 0x00FF;
> $p = pack('S', $testint);
> return $testint===current(unpack('v', $p)); }
>
>
> function chbo($num) {
> $data = dechex($num);
> if (strlen($data) <= 2) {
> return $num;
> }
> $u = unpack("H*", strrev(pack("H*", $data)));
> $f = hexdec($u[1]);
> return $f;
> }
>
> if (!isLittleEndian()) {
> $data = chbo($timezoneblob)?
> }
>
> If not, how did you change endianness so I can add it upstream....
File attached.
I've made the following changes:
function isLittleEndian() {
$testint = 0x00FF;
$p = pack('S', $testint);
return ($testint === current(unpack('v', $p)));
}
function chbo($num) {
$u = unpack('l', strrev(pack('l', $num)));
return $u[1];
}
In static public function getOffsetsFromSyncTZ($data) (before return):
if (!isLittleEndian()) {
$tz['bias'] = chbo($tz['bias']);
$tz['stdbias'] = chbo($tz['stdbias']);
$tz['dstbias'] = chbo($tz['dstbias']);
}
In static public function getSyncTZFromOffsets(array $offsets) (before pack):
if (!isLittleEndian()) {
$offsets['bias'] = chbo($offsets['bias']);
$offsets['stdbias'] = chbo($offsets['stdbias']);
$offsets['dstbias'] = chbo($offsets['dstbias']);
}
> --
> mike
>
> The Horde Project (www.horde.org)
> mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Timezone.zip
Type: application/x-zip-compressed
Size: 4489 bytes
Desc: not available
URL: <http://lists.horde.org/archives/sync/attachments/20130813/03f19f3f/attachment.bin>
More information about the sync
mailing list