forked from Ivasoft/DSView
fix: The long file name be truncated
This commit is contained in:
@@ -201,8 +201,8 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int mode, int status,
|
||||
sdi->version = g_strdup(version);
|
||||
}
|
||||
|
||||
if (model && *model){
|
||||
strncpy(sdi->name, model, sizeof(sdi->name)-1);
|
||||
if (model && *model){
|
||||
sdi->name = g_strdup(model);
|
||||
}
|
||||
|
||||
return sdi;
|
||||
@@ -236,6 +236,7 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi)
|
||||
safe_free(sdi->vendor);
|
||||
safe_free(sdi->version);
|
||||
safe_free(sdi->path);
|
||||
safe_free(sdi->name);
|
||||
|
||||
g_free(sdi);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ struct sr_dev_inst {
|
||||
ds_device_handle handle;
|
||||
|
||||
/** device name. */
|
||||
char name[50];
|
||||
char *name;
|
||||
|
||||
char *path;
|
||||
|
||||
|
||||
@@ -1328,13 +1328,13 @@ typedef unsigned long long ds_device_handle;
|
||||
struct ds_device_base_info
|
||||
{
|
||||
ds_device_handle handle;
|
||||
char name[50];
|
||||
char name[150];
|
||||
};
|
||||
|
||||
struct ds_device_full_info
|
||||
{
|
||||
ds_device_handle handle;
|
||||
char name[50];
|
||||
char name[150];
|
||||
char path[256]; //file path
|
||||
char driver_name[20];
|
||||
int dev_type; // enum sr_device_type
|
||||
|
||||
@@ -1459,7 +1459,7 @@ static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data)
|
||||
SR_PRIV int sr_new_virtual_device(const char *filename, struct sr_dev_inst **out_di)
|
||||
{
|
||||
struct sr_dev_inst *sdi;
|
||||
char short_name[50];
|
||||
char short_name[150];
|
||||
GKeyFile *kf;
|
||||
char **sections, **keys, *metafile, *val;
|
||||
int mode = LOGIC;
|
||||
@@ -1560,7 +1560,7 @@ SR_PRIV int sr_new_virtual_device(const char *filename, struct sr_dev_inst **out
|
||||
sdi->dev_type = DEV_TYPE_FILELOG;
|
||||
|
||||
get_file_short_name(filename, short_name, sizeof(short_name) - 1);
|
||||
strncpy(sdi->name, (char*)short_name, sizeof(short_name) - 1);
|
||||
sdi->name = g_strdup((const char*)short_name);
|
||||
sdi->path = g_strdup(filename);
|
||||
|
||||
*out_di = sdi;
|
||||
|
||||
Reference in New Issue
Block a user