Skip to content

Commit

Permalink
Merge pull request #2028 from Unidata/gh2027.wif
Browse files Browse the repository at this point in the history
Fix in support of #2027
  • Loading branch information
WardF authored Jul 6, 2021
2 parents e89b29c + b6c3568 commit 2ba84ea
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions nc_test4/tst_fill_attr_vanish.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define ATTNAME "TextAttribute"
#define ATTVAL "This is a text attribute used for testing."

#define ATTVAL_LEN 43

/*! Main function for tst_fill_attr_vanish.c
*
Expand Down Expand Up @@ -78,10 +78,13 @@ int main()

/* Query existing attribute. */
{
char *attval = malloc(sizeof(char) * strlen(ATTVAL));
char *attval = (char*)malloc(1+(sizeof(char) * strlen(ATTVAL)));
memset(attval,'\0',(1+(sizeof(char) * strlen(ATTVAL))));
printf("**** Checking that attribute still exists:\t");
if(nc_get_att_text(ncid,test_id,ATTNAME,attval)) {printf("Fail\n"); ERR;}
else {printf("%s\n",attval);}
if(nc_get_att_text(ncid,test_id,ATTNAME,attval))
{printf("Fail\n"); ERR;}
else
{printf("%42s\n",attval);}
free(attval);

}
Expand All @@ -98,7 +101,8 @@ int main()

/* Query existing attribute. */
{
char *attval = malloc(sizeof(char) * strlen(ATTVAL));
char *attval = (char*)malloc(1+(sizeof(char) * strlen(ATTVAL)));
memset(attval,'\0',(1+(sizeof(char) * strlen(ATTVAL))));
printf("**** Checking that attribute still exists, pre-write:\t");
if(nc_get_att_text(ncid,test_id,ATTNAME,attval)) {printf("Fail\n"); ERR;}
else {printf("%s\n",attval);}
Expand All @@ -118,7 +122,8 @@ int main()

/* Query existing attribute. */
{
char *attval = malloc(sizeof(char) * strlen(ATTVAL));
char *attval = (char*)malloc(1+(sizeof(char) * strnlen(ATTVAL,ATTVAL_LEN)));
memset(attval,'\0',(1+(sizeof(char) * strlen(ATTVAL))));
printf("**** Checking that attribute still exists:\t");
if(nc_get_att_text(ncid,test_id,ATTNAME,attval)) {printf("Fail\n"); ERR;}
else {printf("%s\n",attval);}
Expand Down

0 comments on commit 2ba84ea

Please sign in to comment.