Commits

Satish Balay committed 0835312

cygwin: gcc fix warnings with isalpha()

>>>>>
CC arch-mswin-c-debug/obj/src/sys/objects/options.o
/home/balay/petsc.test/src/sys/objects/options.c: In function ‘PetscOptionsValidKey’:
/home/balay/petsc.test/src/sys/objects/options.c:332:3: warning: array subscript has type ‘char’ [-Wchar-subscripts]
if (!isalpha(in_str[1])) PetscFunctionReturn(0);
^
/home/balay/petsc.test/src/sys/objects/options.c:335:3: warning: array subscript has type ‘char’ [-Wchar-subscripts]
if ((inf || INF) && !(in_str[4] == '_' || isalnum(in_str[4]))) PetscFunctionReturn(0);
^
<<<<<<
prototypes appear to be:
int isalnum(int c);
int isalpha(int c);

Comments (0)

Files changed (1)

src/sys/objects/options.c

   if (!in_str) PetscFunctionReturn(0);
   if (in_str[0] != '-') PetscFunctionReturn(0);
   if (in_str[1] == '-') in_str++;
-  if (!isalpha(in_str[1])) PetscFunctionReturn(0);
+  if (!isalpha((int)(in_str[1]))) PetscFunctionReturn(0);
   ierr = PetscStrncmp(in_str+1,"inf",3,&inf);CHKERRQ(ierr);
   ierr = PetscStrncmp(in_str+1,"INF",3,&INF);CHKERRQ(ierr);
-  if ((inf || INF) && !(in_str[4] == '_' || isalnum(in_str[4]))) PetscFunctionReturn(0);
+  if ((inf || INF) && !(in_str[4] == '_' || isalnum((int)(in_str[4])))) PetscFunctionReturn(0);
   *key = PETSC_TRUE;
   PetscFunctionReturn(0);
 }