[svn-r3611]

Purpose:
    avoid a windows bug for string handling
Description:
Solution:
Platforms tested:
     windows 2000, linux
This commit is contained in:
MuQun Yang 2001-03-12 15:26:18 -05:00
parent 22f31e6cc6
commit 3ad1acdd03

View File

@ -1177,8 +1177,6 @@ int test_imageattr() {
uint8 palette_data[NUM_COLORS * 3]; uint8 palette_data[NUM_COLORS * 3];
int32 num_comp,num_entries; int32 num_comp,num_entries;
intn i, j; intn i, j;
char* ri_attrname;
char*file_attrname;
/* Open the file. */ /* Open the file. */
file_id = Hopen(FILEGRPAL, DFACC_CREATE, 0); file_id = Hopen(FILEGRPAL, DFACC_CREATE, 0);
@ -1219,23 +1217,17 @@ int test_imageattr() {
/* set GR global attribute. */ /* set GR global attribute. */
file_attrname=malloc(strlen(F_ATT1_NAME)); istat = GRsetattr(gr_id,"File Attribute",DFNT_CHAR8,F_ATT1_N_VALUES,(VOIDP)F_ATT1_VAL);
strcpy(file_attrname,F_ATT1_NAME);
istat = GRsetattr(gr_id,file_attrname,DFNT_CHAR8,F_ATT1_N_VALUES,(VOIDP)F_ATT1_VAL);
if(istat == FAIL) { if(istat == FAIL) {
printf("fail to set GR global attribute.\n"); printf("fail to set GR global attribute.\n");
return FAIL; return FAIL;
} }
/* set GR attribute. */ /* set GR attribute. */
ri_attrname=malloc(strlen(RI_ATT1_NAME)); istat = GRsetattr(ri_id,"Image Attribute",DFNT_CHAR8,RI_ATT1_N_VALUES,(VOIDP)RI_ATT1_VAL);
strcpy(ri_attrname,RI_ATT1_NAME);
istat = GRsetattr(ri_id,ri_attrname,DFNT_CHAR8,RI_ATT1_N_VALUES,(VOIDP)RI_ATT1_VAL);
if(istat == FAIL) { if(istat == FAIL) {
printf("fail to set GR attribute.\n"); printf("fail to set GR attribute.\n");
return FAIL; return FAIL;
} }
free(file_attrname);
free(ri_attrname);
/* Write the stored data to the image array. */ /* Write the stored data to the image array. */
istat = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)image_data); istat = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)image_data);
if(istat == FAIL) { if(istat == FAIL) {