Package: saods9 Severity: normal Tags: patch
With gcc-3.4/gcc-4.0 I get: fitsimage.C: In member function `void FitsImage::initWCS(FitsHead*)': fitsimage.C:1763: error: array bound forbidden after parenthesized type-id fitsimage.C:1763: note: try removing the parentheses around the type-id strm.C: In constructor `FitsFitsStream<T>::FitsFitsStream(FitsFile::ScanMode, FitsFile::FlushMode)': strm.C:333: error: `valid_' undeclared (first use this function) strm.C:333: error: (Each undeclared identifier is reported only once for each function it appears in.) strm.C:336: error: `flush_' undeclared (first use this function) strm.C:338: error: `EXACT' undeclared (first use this function) strm.C:338: error: `pExt_' undeclared (first use this function) strm.C:338: error: `pIndex_' undeclared (first use this function) ... and so on. The following patch allows saods9 to compile with gcc-3.4. --- saotk/frame/fitsimage.C.orig 2005-07-11 23:26:59.000000000 -0700 +++ saotk/frame/fitsimage.C 2005-07-11 23:27:21.000000000 -0700 @@ -1760,7 +1760,7 @@ delete [] wcstan; // wcsinit is sloooowwww! so try to figure it out first - wcs = new (WorldCoor*)[MULTWCS]; + wcs = new WorldCoor*[MULTWCS]; for (int i=0; i<MULTWCS; i++) wcs[i] = NULL; --- saotk/fitsy++/strm.C.orig 2005-07-12 16:57:36.000000000 -0700 +++ saotk/fitsy++/strm.C 2005-07-12 17:22:30.000000000 -0700 @@ -11,28 +11,28 @@ template<class T> FitsStream<T>::FitsStream() { - stream_ =0; - dataSize_ = 0; - dataManage_ = 0; - flush_ = NOFLUSH; + this->stream_ =0; + this->dataSize_ = 0; + this->dataManage_ = 0; + this->flush_ = NOFLUSH; } template<class T> FitsStream<T>::~FitsStream() { - if (dataManage_ && data_) - delete [] (T*)data_; + if (this->dataManage_ && this->data_) + delete [] (T*)this->data_; } // FILE* int FitsStream<FILE*>::read(char* where, off_t size) { - return fread(where, 1, size, stream_); + return fread(where, 1, size, this->stream_); } void FitsStream<FILE*>::close() { - fclose(stream_); + fclose(this->stream_); } // Socket @@ -42,7 +42,7 @@ int rr = 0; int r; do { - r = recv(stream_ , where+rr, (size>FTY_BLOCK)?FTY_BLOCK:size, 0); + r = recv(this->stream_ , where+rr, (size>FTY_BLOCK)?FTY_BLOCK:size, 0); size -= r; rr += r; } while (r>0 && size>0); @@ -59,16 +59,16 @@ int rr = 0; int r = 0; - if (stream_->transparent) { - if (stream_->useHeader) { - memcpy(where,stream_->header,2); + if (this->stream_->transparent) { + if (this->stream_->useHeader) { + memcpy(where,this->stream_->header,2); size -= 2; rr += 2; - stream_->useHeader = 0; + this->stream_->useHeader = 0; } do { - r = recv(stream_->id , where+rr, (size>GZBUFSIZE) ? GZBUFSIZE : size, 0); + r = recv(this->stream_->id , where+rr, (size>GZBUFSIZE) ? GZBUFSIZE : size, 0); size -= r; rr += r; } while (r>0 && size>0); @@ -76,33 +76,33 @@ return rr; } else { - ((z_stream*)stream_)->avail_out = size; - ((z_stream*)stream_)->next_out = (unsigned char*)where; + ((z_stream*)this->stream_)->avail_out = size; + ((z_stream*)this->stream_)->next_out = (unsigned char*)where; if (DebugGZ) - cerr << "***read init " << ((z_stream*)stream_)->avail_out + cerr << "***read init " << ((z_stream*)this->stream_)->avail_out << " bytes" << endl; do { - if (((z_stream*)stream_)->avail_in == 0) { - ((z_stream*)stream_)->next_in = stream_->buf; - int aa = recv(stream_->id , stream_->buf, GZBUFSIZE, 0); + if (((z_stream*)this->stream_)->avail_in == 0) { + ((z_stream*)this->stream_)->next_in = this->stream_->buf; + int aa = recv(this->stream_->id , this->stream_->buf, GZBUFSIZE, 0); if (aa<0) return rr; - ((z_stream*)stream_)->avail_in = aa; + ((z_stream*)this->stream_)->avail_in = aa; if (DebugGZ) cerr << " read from socket " << aa << " bytes" << endl; } if (DebugGZ) cerr << " inflate Start: avail_in " - << ((z_stream*)stream_)->avail_in - << " avail_out " << ((z_stream*)stream_)->avail_out << endl; + << ((z_stream*)this->stream_)->avail_in + << " avail_out " << ((z_stream*)this->stream_)->avail_out << endl; - int before = ((z_stream*)stream_)->avail_out; - int result = inflate(((z_stream*)stream_), Z_NO_FLUSH); - r = before - ((z_stream*)stream_)->avail_out; + int before = ((z_stream*)this->stream_)->avail_out; + int result = inflate(((z_stream*)this->stream_), Z_NO_FLUSH); + r = before - ((z_stream*)this->stream_)->avail_out; size -= r; rr += r; @@ -110,16 +110,16 @@ switch (result) { case Z_OK: if (DebugGZ) - cerr << " inflate OK: avail_in " << ((z_stream*)stream_)->avail_in - << " avail_out " << ((z_stream*)stream_)->avail_out << endl; + cerr << " inflate OK: avail_in " << ((z_stream*)this->stream_)->avail_in + << " avail_out " << ((z_stream*)this->stream_)->avail_out << endl; break; case Z_STREAM_END: if (DebugGZ) cerr << " inflate STRM_END: avail_in " - << ((z_stream*)stream_)->avail_in - << " avail_out " << ((z_stream*)stream_)->avail_out - << " total_in " << ((z_stream*)stream_)->total_in - << " total_out " << ((z_stream*)stream_)->total_out << endl; + << ((z_stream*)this->stream_)->avail_in + << " avail_out " << ((z_stream*)this->stream_)->avail_out + << " total_in " << ((z_stream*)this->stream_)->total_in + << " total_out " << ((z_stream*)this->stream_)->total_out << endl; return rr; default: if (DebugGZ) @@ -137,14 +137,14 @@ void FitsStream<gzStream>::close() { - if (!stream_->transparent) { - if (inflateEnd((z_stream*)stream_) != Z_OK) + if (!this->stream_->transparent) { + if (inflateEnd((z_stream*)this->stream_) != Z_OK) if (DebugGZ) cerr << "inflateEnd error" << endl; if (DebugGZ) - cerr << "inflateEnd: avail_in " << ((z_stream*)stream_)->avail_in - << " avail_out " << ((z_stream*)stream_)->avail_out << endl; + cerr << "inflateEnd: avail_in " << ((z_stream*)this->stream_)->avail_in + << " avail_out " << ((z_stream*)this->stream_)->avail_out << endl; } } @@ -152,7 +152,7 @@ int FitsStream<Tcl_Channel>::read(char* where, off_t size) { - return Tcl_Read(stream_, where, size); + return Tcl_Read(this->stream_, where, size); } void FitsStream<Tcl_Channel>::close() {} @@ -161,7 +161,7 @@ int FitsStream<gzFile>::read(char* where, off_t size) { - int r = gzread(stream_, where, size); + int r = gzread(this->stream_, where, size); // sometimes we don't get everything if (r>0) return size; @@ -171,7 +171,7 @@ void FitsStream<gzFile>::close() { - gzclose(stream_); + gzclose(this->stream_); } template<class T> FitsHead* FitsStream<T>::headRead() @@ -238,25 +238,25 @@ template<class T> int FitsStream<T>::dataRead(off_t bytes) { - data_ = NULL; - dataSize_ = 0; - dataManage_ = 0; + this->data_ = NULL; + this->dataSize_ = 0; + this->dataManage_ = 0; if (!bytes) return 0; - data_ = new char[bytes]; - if (!data_) + this->data_ = new char[bytes]; + if (!this->data_) return 0; - if (read((char*)data_, bytes) != bytes) { - delete (char*)data_; - data_ = NULL; + if (read((char*)this->data_, bytes) != bytes) { + delete (char*)this->data_; + this->data_ = NULL; return 0; } - dataSize_ = bytes; - dataManage_ = 1; + this->dataSize_ = bytes; + this->dataManage_ = 1; return 1; } @@ -286,39 +286,39 @@ template<class T> void FitsStream<T>::found() { // only read realbytes, since the data seg maybe short - if (!dataRead(head_->realbytes())) { - error(); + if (!dataRead(this->head_->realbytes())) { + this->error(); return; } // read any dead space til next block - if (head_->databytes() > head_->realbytes()) - dataSkip(head_->databytes()-head_->realbytes()); + if (this->head_->databytes() > this->head_->realbytes()) + dataSkip(this->head_->databytes()-this->head_->realbytes()); - inherit_ = head_->inherit(); - valid_ = 1; + this->inherit_ = this->head_->inherit(); + this->valid_ = 1; - if (flush_ == FLUSH) - skipEnd(); + if (this->flush_ == FitsFile::FLUSH) + this->skipEnd(); } template<class T> void FitsStream<T>::error() { // try to clean up - if ((flush_ == FLUSH) && (head_ || primary_)) - skipEnd(); + if ((this->flush_ == FitsFile::FLUSH) && (this->head_ || this->primary_)) + this->skipEnd(); - if (manageHead_ && head_) - delete head_; - head_ = NULL; - - if (managePrimary_ && primary_) - delete primary_; - primary_ = NULL; - - data_ = NULL; - dataSize_ = 0; - valid_ = 0; + if (this->manageHead_ && this->head_) + delete this->head_; + this->head_ = NULL; + + if (this->managePrimary_ && this->primary_) + delete this->primary_; + this->primary_ = NULL; + + this->data_ = NULL; + this->dataSize_ = 0; + this->valid_ = 0; } template class FitsStream<FILE*>; @@ -330,12 +330,12 @@ template<class T> FitsFitsStream<T>::FitsFitsStream(FitsFile::ScanMode mode, FitsFile::FlushMode f) { - if (!valid_) + if (!this->valid_) return; - flush_ = f; + this->flush_ = f; - if (mode == EXACT || pExt_ || pIndex_) + if (mode == FitsFile::EXACT || this->pExt_ || this->pIndex_) processExact(); else processRelax(); @@ -343,11 +343,11 @@ template<class T> void FitsFitsStream<T>::processExact() { - if (!(pExt_ || (pIndex_>0))) { + if (!(this->pExt_ || (this->pIndex_>0))) { // we are only looking for a primary image - if (head_ = headRead()) { - found(); + if (this->head_ = this->headRead()) { + this->found(); return; } } @@ -355,124 +355,124 @@ // we are looking for an extension // keep the primary header - primary_ = headRead(); - managePrimary_ = 1; - if (!primary_) { - error(); + this->primary_ = this->headRead(); + this->managePrimary_ = 1; + if (!this->primary_) { + this->error(); return; } - dataSkip(primary_->datablocks()*FTY_BLOCK); + dataSkip(this->primary_->datablocks()*FTY_BLOCK); - if (pExt_) { + if (this->pExt_) { while (1) { - if (!(head_ = headRead())) { - error(); + if (!(this->head_ = this->headRead())) { + this->error(); return; } - ext_++; + this->ext_++; - if (head_->extname()) { - char* a = toUpper(head_->extname()); - char* b = toUpper(pExt_); + if (this->head_->extname()) { + char* a = toUpper(this->head_->extname()); + char* b = toUpper(this->pExt_); if (!strcmp(a,b)) { delete [] a; delete [] b; - found(); + this->found(); return; } delete [] a; delete [] b; } - dataSkip(head_->datablocks()*FTY_BLOCK); - delete head_; - head_ = NULL; + dataSkip(this->head_->datablocks()*FTY_BLOCK); + delete this->head_; + this->head_ = NULL; } } else { - for (int i=1; i<pIndex_; i++) { - if (!(head_ = headRead())) { - error(); + for (int i=1; i<this->pIndex_; i++) { + if (!(this->head_ = this->headRead())) { + this->error(); return; } - ext_++; + this->ext_++; - dataSkip(head_->datablocks()*FTY_BLOCK); - delete head_; - head_ = NULL; + dataSkip(this->head_->datablocks()*FTY_BLOCK); + delete this->head_; + this->head_ = NULL; } - if (head_ = headRead()) { - ext_++; - found(); + if (this->head_ = this->headRead()) { + this->ext_++; + this->found(); return; } } } // we must have an error - error(); + this->error(); } template<class T> void FitsFitsStream<T>::processRelax() { // check to see if there is an image in the primary - if (!(head_ = headRead())) { - error(); + if (!(this->head_ = this->headRead())) { + this->error(); return; } else { - if (head_->isValid() && - head_->naxes() > 0 && - head_->naxis(0) > 0 && - head_->naxis(1) > 0) { - found(); + if (this->head_->isValid() && + this->head_->naxes() > 0 && + this->head_->naxis(0) > 0 && + this->head_->naxis(1) > 0) { + this->found(); return; } } // ok, no image, save primary and lets check extensions - primary_ = head_; - managePrimary_ = 1; - dataSkip(head_->datablocks()*FTY_BLOCK); - head_ = NULL; + this->primary_ = this->head_; + this->managePrimary_ = 1; + dataSkip(this->head_->datablocks()*FTY_BLOCK); + this->head_ = NULL; // ok, no image, lets check extensions while (1) { - if (!(head_ = headRead())) { - error(); + if (!(this->head_ = this->headRead())) { + this->error(); return; } - ext_++; + this->ext_++; - if (head_->isImage() && - head_->naxes() > 0 && - head_->naxis(0) > 0 && - head_->naxis(1) > 0) { - found(); + if (this->head_->isImage() && + this->head_->naxes() > 0 && + this->head_->naxis(0) > 0 && + this->head_->naxis(1) > 0) { + this->found(); return; } // else, check for bin table named STDEVT, EVENTS, RAYEVENT - if (head_->isTable() && head_->extname()) { - char* a = toUpper(head_->extname()); + if (this->head_->isTable() && this->head_->extname()) { + char* a = toUpper(this->head_->extname()); if (!strcmp("STDEVT", a) || !strcmp("EVENTS", a) || !strcmp("RAYEVENT", a)) { delete [] a; - found(); + this->found(); return; } else delete [] a; } - dataSkip(head_->datablocks()*FTY_BLOCK); - delete head_; - head_ = NULL; + dataSkip(this->head_->datablocks()*FTY_BLOCK); + delete this->head_; + this->head_ = NULL; } - error(); + this->error(); } template class FitsFitsStream<FILE*>; @@ -485,21 +485,21 @@ { FitsStream<T>* prev = (FitsStream<T>*)p; - head_ = prev->head(); - manageHead_ = 0; - primary_ = prev->primary(); - managePrimary_ = 0; - ext_ = prev->ext(); - inherit_ = head_->inherit(); - - data_ = (char*)prev->data() + head_->pixbytes(); - dataSize_ = 0; - dataManage_ = 0; + this->head_ = prev->head(); + this->manageHead_ = 0; + this->primary_ = prev->primary(); + this->managePrimary_ = 0; + this->ext_ = prev->ext(); + this->inherit_ = this->head_->inherit(); + + this->data_ = (char*)prev->data() + this->head_->pixbytes(); + this->dataSize_ = 0; + this->dataManage_ = 0; - byteswap_ = prev->byteswap(); - valid_ = 1; + this->byteswap_ = prev->byteswap(); + this->valid_ = 1; - stream_ = prev->stream(); + this->stream_ = prev->stream(); } template class FitsFitsNextStream<FILE*>; @@ -510,45 +510,45 @@ template<class T> FitsArrStream<T>::FitsArrStream(FitsFile::FlushMode f) { - if (!valid_) + if (!this->valid_) return; - flush_ = f; + this->flush_ = f; // check to see if we have a nonzero width, height, and bitpix - if (!validArrayParams()) { - valid_=0; + if (!this->validArrayParams()) { + this->valid_=0; return; } // skip header - if (pSkip_) - dataSkip(pSkip_); + if (this->pSkip_) + dataSkip(this->pSkip_); // read data - if (!dataRead(pWidth_ * pHeight_ * pDepth_ * abs(pBitpix_)/8)) { - if ((flush_ == FLUSH) && data_) - skipEnd(); - valid_=0; + if (!dataRead(this->pWidth_ * this->pHeight_ * this->pDepth_ * abs(this->pBitpix_)/8)) { + if ((this->flush_ == FitsFile::FLUSH) && this->data_) + this->skipEnd(); + this->valid_=0; return; } // create blank header - head_ = new FitsHead(pWidth_, pHeight_, pDepth_, pBitpix_); - if (!head_->isValid()) { - error(); + this->head_ = new FitsHead(this->pWidth_, this->pHeight_, this->pDepth_, this->pBitpix_); + if (!this->head_->isValid()) { + this->error(); return; } // do we need to byteswap? - setArrayByteSwap(); + this->setArrayByteSwap(); // made it this far, must be good - valid_ = 1; - orgFits_ = 0; + this->valid_ = 1; + this->orgFits_ = 0; - if (flush_ == FLUSH) - skipEnd(); + if (this->flush_ == FitsFile::FLUSH) + this->skipEnd(); } template class FitsArrStream<FILE*>; @@ -559,35 +559,35 @@ template<class T> FitsMosaicStream<T>::FitsMosaicStream(FitsFile::FlushMode f) { - if (!valid_) + if (!this->valid_) return; - flush_ = f; - primary_ = headRead(); - managePrimary_ = 1; - if (!(primary_ && primary_->isValid())) { - error(); + this->flush_ = f; + this->primary_ = this->headRead(); + this->managePrimary_ = 1; + if (!(this->primary_ && this->primary_->isValid())) { + this->error(); return; } - dataSkip(primary_->datablocks()*FTY_BLOCK); + dataSkip(this->primary_->datablocks()*FTY_BLOCK); // first extension - head_ = headRead(); - if (!(head_ && head_->isValid())) { - error(); + this->head_ = this->headRead(); + if (!(this->head_ && this->head_->isValid())) { + this->error(); return; } - ext_++; + this->ext_++; // be sure to read all blocks, so that the next call starts on a boundary - if (!dataRead(head_->datablocks()*FTY_BLOCK)) { - error(); + if (!dataRead(this->head_->datablocks()*FTY_BLOCK)) { + this->error(); return; } // don't flush, more to come - inherit_ = head_->inherit(); - valid_ = 1; + this->inherit_ = this->head_->inherit(); + this->valid_ = 1; } template class FitsMosaicStream<FILE*>; @@ -599,28 +599,28 @@ template<class T> FitsMosaicNextStream<T>::FitsMosaicNextStream(FitsFile* p, FitsFile::FlushMode f) { - flush_ = f; + this->flush_ = f; FitsStream<T>* prev = (FitsStream<T>*)p; - primary_ = prev->primary(); - managePrimary_ = 0; - stream_ = prev->stream(); - ext_ = prev->ext(); + this->primary_ = prev->primary(); + this->managePrimary_ = 0; + this->stream_ = prev->stream(); + this->ext_ = prev->ext(); - head_ = headRead(); - if (!(head_ && head_->isValid())) { - error(); + this->head_ = this->headRead(); + if (!(this->head_ && this->head_->isValid())) { + this->error(); return; } - ext_++; + this->ext_++; // be sure to read all blocks, so that the next call starts on a boundary - if (!dataRead(head_->datablocks()*FTY_BLOCK)) { - error(); + if (!dataRead(this->head_->datablocks()*FTY_BLOCK)) { + this->error(); return; } - inherit_ = head_->inherit(); - valid_ = 1; + this->inherit_ = this->head_->inherit(); + this->valid_ = 1; } template class FitsMosaicNextStream<FILE*>; -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.11-perfctr-2.6.13-bmc Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]