Perfect.

For other readers of the thread - QNAP is behaving as a mixed endian
system unlike other little endian ARM systems such as Radio/Touch and a
big-endian Freecom FSG3 NAS which I have.
The output of a code pasted below is as follows on different ARM
systems 

Touch:         ENDIAN:LITTLE  Test of unpack: 0000000000000ff3  Swap
flag:0
QNAP:          ENDIAN:LITTLE  Test of unpack: 00000ff300000000  Swap
flag:1
FSG3:          ENDIAN:BIG     Test of unpack: f30f000000000000  Swap
flag:0

The problem is a word swap which is peculiar to ARM architecture and
some ports of Linux and/or the compiler..

I believe this has confirmed the problem - now the fix needs to be
written.. 


Code:
--------------------
    
  use constant ENDIAN => unpack('S', pack('C2', 0, 1)) == 1 ? 'BIG' : 'LITTLE'; 
                                                                                
                        
  
  my $swapDoubles;                                                              
                                                                                
                
  my $double = pack ("d",1);                                                    
                                                                                
                
  my $hex =  unpack("h*",$double);                                              
                                                                                
                
  if ( $hex eq "00000ff300000000"){                                             
                                                                                
                    
  $swapDoubles=1;                                                               
                                                                                
  }                                                                             
                                                                                
                    
  else {                                                                        
                                                                                
                    
  $swapDoubles=0;                                                               
                                                                                
  }                                                                             
                                                                        
  
  print "ENDIAN:" . ENDIAN. "  Test of unpack: $hex  Swap flag:$swapDoubles\n";
--------------------

I copied the code from this CPAN module
http://cpansearch.perl.org/src/EXIFTOOL/Image-ExifTool-7.89/lib/Image/ExifTool.pm
- look for swapWord anbd SwapWords in the file.


-- 
bpa
------------------------------------------------------------------------
bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=70812

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to