int calcChecksum (char *buffer, int length) { int CHECKSUM_MASK = 0xFFFF; int checkSum, i; if(length < 4) { return -1; } checkSum = buffer[0] & LSB_MASK; for(i=1; i<length-2; i=i+2) { checkSum += convert2int (&buffer[i]); } return (checkSum & CHECKSUM_MASK); }
void WARNING_CharSize(variable *var) { if ( var->v_nbdim == 0 ) { if ( convert2int(var->v_dimchar) > 2050 ) { printf("WARNING : The dimension of the character %s \n", var->v_nomvar); printf(" is upper than 2050. You must change \n"); printf(" the dimension of carray0 \n"); printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); printf(" line 247. Replace 300 with %d. \n", convert2int(var->v_dimchar)+100); } Save_Length_int(convert2int(var->v_dimchar),1); } else if ( var->v_nbdim == 1 ) { if ( convert2int(var->v_dimchar) > 300 ) { printf("WARNING : The dimension of the character %s \n", var->v_nomvar); printf(" is upper than 300. You must change \n"); printf(" the dimension of carray1 \n"); printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); printf(" line 247. Replace 300 with %d. \n", convert2int(var->v_dimchar)+100); } Save_Length_int(convert2int(var->v_dimchar),2); } else if ( var->v_nbdim == 2 ) { if ( convert2int(var->v_dimchar) > 300 ) { printf("WARNING : The dimension of the character %s \n", var->v_nomvar); printf(" is upper than 300. You must change \n"); printf(" the dimension of carray2 \n"); printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); printf(" line 247. Replace 300 with %d. \n", convert2int(var->v_dimchar)+100); } Save_Length_int(convert2int(var->v_dimchar),3); } else if ( var->v_nbdim == 3 ) { if ( convert2int(var->v_dimchar) > 300 ) { printf("WARNING : The dimension of the character %s \n", var->v_nomvar); printf(" is upper than 300. You must change \n"); printf(" the dimension of carray3 \n"); printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); printf(" line 247. Replace 300 with %d. \n", convert2int(var->v_dimchar)+100); } Save_Length_int(convert2int(var->v_dimchar),4); } }