"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "putkey.c" between
cfitsio-3.49.tar.gz and cfitsio-4.0.0.tar.gz

About: CFITSIO is a library of C and Fortran subroutines for reading and writing data files in the FITS (Flexible Image Transport System) data format.

putkey.c  (cfitsio-3.49):putkey.c  (cfitsio-4.0.0)
skipping to change at line 1402 skipping to change at line 1402
slen = strlen(datestr); slen = strlen(datestr);
if (slen == 8 || slen == 10) if (slen == 8 || slen == 10)
return(*status); /* OK, no time fields */ return(*status); /* OK, no time fields */
else if (slen < 19) else if (slen < 19)
{ {
ffpmsg("input date string has illegal format:"); ffpmsg("input date string has illegal format:");
ffpmsg(datestr); ffpmsg(datestr);
return(*status = BAD_DATE); return(*status = BAD_DATE);
} }
else if (datestr[10] == 'T' && datestr[13] == ':' && datestr[16] == ':') else if (datestr[10] == 'T')
{ {
if (isdigit((int) datestr[11]) && isdigit((int) datestr[12]) if (datestr[13] == ':' && datestr[16] == ':') {
&& isdigit((int) datestr[14]) && isdigit((int) datestr[15]) if (isdigit((int) datestr[11]) && isdigit((int) datestr[12])
&& isdigit((int) datestr[17]) && isdigit((int) datestr[18]) ) && isdigit((int) datestr[14]) && isdigit((int) datestr[15])
{ && isdigit((int) datestr[17]) && isdigit((int) datestr[18]) )
{
if (slen > 19 && datestr[19] != '.') if (slen > 19 && datestr[19] != '.')
{ {
ffpmsg("input date string has illegal format:"); ffpmsg("input date string has illegal format:");
ffpmsg(datestr); ffpmsg(datestr);
return(*status = BAD_DATE); return(*status = BAD_DATE);
} }
/* this is a new format string: "yyyy-mm-ddThh:mm:ss.dddd" */ /* this is a new format string: "yyyy-mm-ddThh:mm:ss.dddd" */
if (hour) if (hour)
*hour = atoi(&datestr[11]); *hour = atoi(&datestr[11]);
if (minute) if (minute)
*minute = atoi(&datestr[14]); *minute = atoi(&datestr[14]);
if (second) if (second)
*second = atof(&datestr[17]); *second = atof(&datestr[17]);
} }
else else
{ {
ffpmsg("input date string has illegal format:"); ffpmsg("input date string has illegal format:");
ffpmsg(datestr); ffpmsg(datestr);
return(*status = BAD_DATE); return(*status = BAD_DATE);
} }
}
else
{
ffpmsg("input date string has illegal format:");
ffpmsg(datestr);
return(*status = BAD_DATE);
}
} }
} }
else /* no date fields */ else /* no date fields */
{ {
if (datestr[2] == ':' && datestr[5] == ':') /* time string */ if (datestr[2] == ':' && datestr[5] == ':') /* time string */
{ {
if (isdigit((int) datestr[0]) && isdigit((int) datestr[1]) if (isdigit((int) datestr[0]) && isdigit((int) datestr[1])
&& isdigit((int) datestr[3]) && isdigit((int) datestr[4]) && isdigit((int) datestr[3]) && isdigit((int) datestr[4])
&& isdigit((int) datestr[6]) && isdigit((int) datestr[7]) ) && isdigit((int) datestr[6]) && isdigit((int) datestr[7]) )
{ {
skipping to change at line 1565 skipping to change at line 1573
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
skipping to change at line 1624 skipping to change at line 1632
/* by looking to see if the last non-blank character is a '&' char */ /* by looking to see if the last non-blank character is a '&' char */
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
skipping to change at line 1683 skipping to change at line 1691
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
skipping to change at line 1741 skipping to change at line 1749
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
skipping to change at line 1800 skipping to change at line 1808
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
skipping to change at line 1859 skipping to change at line 1867
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
skipping to change at line 1918 skipping to change at line 1926
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
skipping to change at line 1977 skipping to change at line 1985
repeat = 0; repeat = 0;
if (comm) if (comm)
{ {
len = strlen(comm[0]); len = strlen(comm[0]);
while (len > 0 && comm[0][len - 1] == ' ') while (len > 0 && comm[0][len - 1] == ' ')
len--; /* ignore trailing blanks */ len--; /* ignore trailing blanks */
if (comm[0][len - 1] == '&') if (len > 0 && comm[0][len - 1] == '&')
{ {
len = minvalue(len, FLEN_COMMENT); len = minvalue(len, FLEN_COMMENT);
tcomment[0] = '\0'; tcomment[0] = '\0';
strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */
repeat = 1; repeat = 1;
} }
} }
else else
{ {
repeat = 1; repeat = 1;
 End of changes. 13 change blocks. 
17 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)