[BioC] makecdfenv bug

Cyrus Harmon ch-bioc at bobobeach.com
Sat May 7 01:10:31 CEST 2005


Dear BioC,

In the makecdfenv-1.5.1 package there is, I think, a bug in the file  
read_cdf_xda.c.

Starting at line 297, read_cdf_xda.c says:

static size_t fread_uchar(unsigned char *destination, int n, FILE  
*instream){

   int i=0;
   size_t result;

   result = fread(destination,sizeof(unsigned char),n,instream);

#ifdef WORDS_BIGENDIAN
   /* Probably don't need to do anything for characters */
   destination = ~destination;
#endif

   return result;

}

The assignment destination = ~destination looks bogus to me. And the  
compiler (gcc 3.3 on OS X 10.4) doesn't like it either, claiming  
there is an "error: wrong type argument to bit-complement". In  
similar functions, we're bit-complementing stuff that destination  
points to. This probably isn't the right thing to do since we  
probably don't need to do anything for characters (or char's at  
least) and this line should be commented out. If anything were to  
need to be done here, setting the pointer to the complement of the  
pointer is probably not going to do it. But I don't think we need to  
bit-complement what destination points to either.


The following patch at least enables makecdfenv to compile for me:




--- read_cdf_xda.c    2005/05/06 23:07:37    1.1
+++ read_cdf_xda.c    2005/05/06 23:07:39
@@ -303,7 +303,7 @@
#ifdef WORDS_BIGENDIAN
    /* Probably don't need to do anything for characters */
-  destination = ~destination;
+  /* destination = ~destination; */
#endif
    return result;



In the future, should things like this go to the BioC list or to the  
maintainers of the specific package?

Thanks for considering this,

Cyrus



More information about the Bioconductor mailing list