epson2: fixed whitespace trimming of model name

Whitespace trimming was incorrect for model names with
a space character.
merge-requests/1/head
Alessandro Zummo 2009-06-16 23:46:52 +02:00
rodzic 94ec5cb8a8
commit 6cc0d7641f
1 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -318,7 +318,7 @@ SANE_Status
e2_set_model(Epson_Scanner * s, unsigned char *model, size_t len)
{
unsigned char *buf;
char *p;
unsigned char *p;
struct Epson_Device *dev = s->hw;
buf = malloc(len + 1);
@ -328,9 +328,12 @@ e2_set_model(Epson_Scanner * s, unsigned char *model, size_t len)
memcpy(buf, model, len);
buf[len] = '\0';
p = strchr((const char *) buf, ' ');
if (p != NULL)
p = &buf[len - 1];
while (*p == ' ') {
*p = '\0';
p--;
}
if (dev->model)
free(dev->model);