kopia lustrzana https://gitlab.com/sane-project/backends
epson2: fixed whitespace trimming of model name
Whitespace trimming was incorrect for model names with a space character.merge-requests/1/head
rodzic
94ec5cb8a8
commit
6cc0d7641f
|
@ -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);
|
||||
|
|
Ładowanie…
Reference in New Issue