Re: ActiveSync issues

"Ivan Kouvykov" <[email protected]>
Newsgroups gmane.comp.horde.sync
Message-ID <!&!AAAAAAAAAAAYAAAAAAAAABJ6OQDldAJBrNfI1+T5HLEinAAAEAAAAPRFFbHcwApLr59L8bC51ycBAAAAAA==@kouvykov.com>

С уважением, / Kindest regards,
Иван Кувыков / Ivan Kouvykov

[email protected]


> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Michael J Rubinsky
> Sent: Tuesday, August 13, 2013 4:21 AM
> To: [email protected]
> Subject: Re: [sync] ActiveSync issues
> 
> 
> Quoting Ivan kouvykov <[email protected]>:
> 
> 
> >
> > 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)
> [email protected]

-- 
sync mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
Timezone.zip (application/x-zip-compressed, 4.4 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.