libcupsfilters: In ieee1284NormalizeMakeAndModel() fix parsing device IDs
Some device IDs have spaces before and after the
manufacturer and model names. These need to be removed when generating
make-and-model strings for display, sorting, ... THis especially leads
to duplicate manufacturer names (extra mention of manufacturer in
model name) not being recognized and removed.
@@ -787,6 +787,7 @@ ieee1284NormalizeMakeAndModel(
bufptr = buffer;
while (*makeptr != ':') makeptr ++;
makeptr ++;
+ while (isspace(*makeptr)) makeptr ++;
while (*makeptr != ';' && *makeptr != '\0' &&
bufptr < buffer + bufsize - 1)
{
@@ -794,6 +795,7 @@ ieee1284NormalizeMakeAndModel(
makeptr ++;
bufptr ++;
}
+ while (isspace(*(bufptr - 1))) bufptr --;
if (bufptr < buffer + bufsize - 1)
{
*bufptr = ' ';
@@ -803,6 +805,7 @@ ieee1284NormalizeMakeAndModel(
makeptr = bufptr;
while (*modelptr != ':') modelptr ++;
modelptr ++;
+ while (isspace(*modelptr)) modelptr ++;
while (*modelptr != ';' && *modelptr != '\0' &&
bufptr < buffer + bufsize - 1)
{
@@ -810,6 +813,7 @@ ieee1284NormalizeMakeAndModel(
modelptr ++;
bufptr ++;
}
+ while (isspace(*(bufptr - 1))) bufptr --;
*bufptr = '\0';
if (!nomakemodel && makeptr != bufptr)
modelptr = makeptr;
