Changeset fb3ce85 in subsurface


Ignore:
Timestamp:
Jun 11, 2017, 3:56:41 PM (3 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
16efcf2
Parents:
74bf8d52
git-author:
Lubomir I. Ivanov <neolit123@…> (06/09/17 15:25:17)
git-committer:
Dirk Hohndel <dirk@…> (06/11/17 15:56:41)
Message:

datatrak.c: don't use POSIX %m format for sscanf() in dtrak_prepare_data()

The format option "%m" doesn't work for MINGW/Windows and is reported as
an unknown conversation type and this sscanf() call would not work.

The alternative is to malloc() enough space manually - e.g.
strlen(input) + 1.

Signed-off-by: Lubomir I. Ivanov <neolit123@…>
Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/datatrak.c

    rc6bc88b rfb3ce85  
    116116                i++;
    117117        dev_data->model = copy_string(g_models[i].name);
    118         sscanf(g_models[i].name,"%m[A-Za-z] ", &dev_data->vendor);
     118        dev_data->vendor = (const char *)malloc(strlen(g_models[i].name) + 1);
     119        sscanf(g_models[i].name, "%[A-Za-z] ", (char *)dev_data->vendor);
    119120        dev_data->product = copy_string(strchr(g_models[i].name, ' ') + 1);
    120121
Note: See TracChangeset for help on using the changeset viewer.