1
Author: Ole Streicher <debian@liska.ath.cx>
2
Description: Fix some bugs in fitsCmds.c:
3
* In fitsTcl_get(), the header is allocated by ffhdr2str(), but is freed by
4
ckfree(). This causes crashes if ckfree() is not just a free() alias.
5
* Fix some variable declarations and type casts to match prototypes.
6
* Check the number of arguments in "get translatedKeywords".
7
* Fix status parameter in exxor handling of fits_copy_cell2image() of
8
"get translatedKeywords".
13
} else if( !strcmp("filesize",argv[2]) ) {
15
- sprintf(result,"%ld",curFile->fptr->Fptr->filesize/2880);
16
+ sprintf(result,"%lld",curFile->fptr->Fptr->filesize/2880);
17
Tcl_SetResult(curFile->interp, result, TCL_VOLATILE);
19
} else if( !strcmp("hdutype",argv[2]) ) {
23
int columns[FITS_MAXDIMS];
30
/* Pan Chai: there is only 2 columns */
35
- if ( ffhdr2str(dummyptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
36
+ if ( ffhdr2str(dummyptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
37
Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
41
Tcl_ListObjAppendElement( curFile->interp, listObj, Tcl_NewListObj(5,data) );
42
Tcl_SetObjResult(curFile->interp, listObj);
44
- ckfree( (char*) header);
48
} else if( !strcmp("translatedKeywords", argv[2]) ) {
49
@@ -1058,6 +1058,13 @@
54
+ Tcl_SetResult(curFile->interp,
55
+ "Usage: get translatedKeywords rownum colname",
60
strcpy(outfile, "mem://_1");
62
/* Copy the image into new primary array and open it as the current */
63
@@ -1075,13 +1082,14 @@
65
if (fits_copy_cell2image(curFile->fptr, newptr, argv[3], rownum, &status) > 0)
68
ffpmsg("Failed to copy table cell to new primary array:");
69
- ffclos(curFile->fptr, status);
70
+ ffclos(curFile->fptr, &status2);
71
curFile->fptr = 0; /* return null file pointer */
75
- if ( ffhdr2str(newptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
76
+ if ( ffhdr2str(newptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
77
Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
81
Tcl_SetObjResult(curFile->interp, listObj);
84
- ckfree( (char*) header);
88
} else if( !strcmp("header2str", argv[2]) ) {
90
/* int *nkeys, O - returned number of 80-char keywords */
91
/* int *status) IO - error status */
93
- if ( ffhdr2str(curFile->fptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
94
+ if ( ffhdr2str(curFile->fptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
95
Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
99
Tcl_ListObjAppendElement( curFile->interp, listObj, Tcl_NewIntObj( nkeys ) );
100
Tcl_SetObjResult(curFile->interp, listObj);
102
- ckfree( (char*) header);
106
} else if( !strcmp("imgwcs", argv[2]) ) {