db: Reject trailing space in numeric => enum/menu/device conversion
This is really a workaround for a Win32/MinGW bug in sscanf, which will only set the %n argument for the format "%u %n" when there is a space following the unsigned number. This changes the IOC's behavior very slightly.
This commit is contained in:
@@ -2600,7 +2600,7 @@ static long putStringEnum(
|
||||
status = (*prset->get_enum_strs)(paddr,&enumStrs);
|
||||
if(!status) {
|
||||
nchoices = enumStrs.no_str;
|
||||
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
|
||||
nargs = sscanf(pbuffer,"%u%n",&ind,&nchars);
|
||||
if(nargs==1 && nchars==strlen(pbuffer) && ind<nchoices) {
|
||||
*pfield = ind;
|
||||
return(0);
|
||||
@@ -2649,7 +2649,7 @@ static long putStringMenu(
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
|
||||
nargs = sscanf(pbuffer,"%u%n",&ind,&nchars);
|
||||
if(nargs==1 && nchars==strlen(pbuffer) && ind<nChoice) {
|
||||
*pfield = ind;
|
||||
return(0);
|
||||
@@ -2687,7 +2687,7 @@ static long putStringDevice(
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
|
||||
nargs = sscanf(pbuffer,"%u%n",&ind,&nchars);
|
||||
if(nargs==1 && nchars==strlen(pbuffer) && ind<nChoice) {
|
||||
*pfield = ind;
|
||||
return(0);
|
||||
|
||||
@@ -272,7 +272,7 @@ static long cvt_st_e(
|
||||
status = (*prset->get_enum_strs)(paddr,&enumStrs);
|
||||
if(!status) {
|
||||
nchoices = enumStrs.no_str;
|
||||
nargs = sscanf(from," %u %n",&ind,&nchars);
|
||||
nargs = sscanf(from,"%u%n",&ind,&nchars);
|
||||
if(nargs==1 && nchars==strlen(from) && ind<nchoices) {
|
||||
*pfield = ind;
|
||||
return(0);
|
||||
@@ -315,7 +315,7 @@ static long cvt_st_menu(
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
nargs = sscanf(from," %u %n",&ind,&nchars);
|
||||
nargs = sscanf(from,"%u%n",&ind,&nchars);
|
||||
if(nargs==1 && nchars==strlen(from) && ind<nChoice) {
|
||||
*to = ind;
|
||||
return(0);
|
||||
@@ -347,7 +347,7 @@ static long cvt_st_device(
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
nargs = sscanf(from," %u %n",&ind,&nchars);
|
||||
nargs = sscanf(from,"%u%n",&ind,&nchars);
|
||||
if(nargs==1 && nchars==strlen(from) && ind<nChoice) {
|
||||
*to = ind;
|
||||
return(0);
|
||||
|
||||
Reference in New Issue
Block a user