1 /*****************************************************************/
2 /* Utilities to convert various numeric types from the Windows */
3 /* (Little endian) format to native types */
5 /* This file is part of catdoc project */
6 /* (c) Victor Wagner 1996-2003, (c) Alex Ott 2003 */
7 /*****************************************************************/
10 /********************************************************************/
11 /* Reads 2-byte LSB int from buffer at given offset platfom-indepent
13 *********************************************************************/
14 unsigned int getshort(unsigned char *buffer,int offset) {
15 return (unsigned short int)buffer[offset]|((unsigned short int)buffer[offset+1]<<8);
17 /********************************************************************/
18 /* Reads 4-byte LSB int from buffer at given offset almost platfom-indepent
20 *********************************************************************/
21 long int getlong(unsigned char *buffer,int offset) {
22 return (long)buffer[offset]|((long)buffer[offset+1]<<8L)
23 |((long)buffer[offset+2]<<16L)|((long)buffer[offset+3]<<24L);
26 unsigned long int getulong(unsigned char *buffer,int offset) {
27 return (unsigned long)buffer[offset]|((unsigned long)buffer[offset+1]<<8L)
28 |((unsigned long)buffer[offset+2]<<16L)|((unsigned long)buffer[offset+3]<<24L);