cd $AMBERHOME patch -p0 -N -r patch_rejects < ptraj_2010-07-08-fixEndian.patch Author: Daniel R. Roe Date: 2010-07-08 Description: Fixes reading of hex values on big endian machines which prevented correct identification of files and/or reading incorrect number of frames in gzipped trajectory files. ----------------------------------------------------------------------------- --- AmberTools/src/ptraj/io.c 2010-07-08 11:23:02.546875000 -0400 +++ AmberTools/src/ptraj/io.c 2010-07-08 15:22:02.843750000 -0400 @@ -680,7 +680,8 @@ */ int gzipFileSize(char *filename) { FILE *infile; - int b1,b2,b3,b4,val; + uint8_t b1,b2,b3,b4; + int val; if (filename==NULL) return -1; if ( (infile = fopen(filename,"rb"))==NULL ) { @@ -774,7 +775,7 @@ * -2: Internal error */ int id_Filesig(char *filename, FILE *infile) { - int *h; + uint8_t *h; int i, type; /* Check that either filename or infile is specified, but not both */ @@ -797,7 +798,7 @@ rewind(infile); /* Read first 3 bytes from file */ - h=(int*) calloc(3,sizeof(int)); + h=(uint8_t*) calloc(3,sizeof(uint8_t)); fread(h,1,1,infile); fread(h+1,1,1,infile); fread(h+2,1,1,infile);