diff options
author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 19:19:56 -0300 |
---|---|---|
committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 19:19:56 -0300 |
commit | fbf360db614483cc1655e47be4744b5bd00d54f5 (patch) | |
tree | 15cf74264e91ede73e5d4a0e18a3d32091ceddc2 /deps | |
parent | 647775860805ea26a377c10d1490686a6f7a3434 (diff) | |
parent | 0574020490ffae5686b0c75d7753bfbcf2286114 (diff) |
Update upstream source from tag 'upstream/2.0.17pre'
Update to upstream version '2.0.17pre'
with Debian dir 5d26fb98f3078817a456822b48c33e4ffac5c49e
Diffstat (limited to 'deps')
-rw-r--r-- | deps/sysobj_early/src/nice_name.c | 28 | ||||
-rw-r--r-- | deps/sysobj_early/src/util_ids.c | 4 |
2 files changed, 20 insertions, 12 deletions
diff --git a/deps/sysobj_early/src/nice_name.c b/deps/sysobj_early/src/nice_name.c index e5e15a46..fdb4557c 100644 --- a/deps/sysobj_early/src/nice_name.c +++ b/deps/sysobj_early/src/nice_name.c @@ -34,11 +34,15 @@ gboolean str_shorten(gchar *str, const gchar *find, const gchar *replace) { long unsigned lr = strlen(replace); gchar *p = strstr(str, find); if (p) { - if (lr > lf) lr = lf; - gchar *buff = g_strnfill(lf, ' '); - strncpy(buff, replace, lr); - strncpy(p, buff, lf); - g_free(buff); + if(lr==lf){ + strncpy(p, replace, lf); + } else { + if (lr > lf) lr = lf; + gchar *buff = g_strnfill(lf, ' '); + if(lr) strncpy(buff, replace, lr); + strncpy(p, buff, lf); + g_free(buff); + } return TRUE; } return FALSE; @@ -50,11 +54,15 @@ gboolean str_shorten_anycase(gchar *str, const gchar *find, const gchar *replace long unsigned lr = strlen(replace); gchar *p = strcasestr(str, find); if (p) { - if (lr > lf) lr = lf; - gchar *buff = g_strnfill(lf, ' '); - strncpy(buff, replace, lr); - strncpy(p, buff, lf); - g_free(buff); + if(lr==lf){ + strncpy(p, replace, lf); + } else { + if (lr > lf) lr = lf; + gchar *buff = g_strnfill(lf, ' '); + if(lr) strncpy(buff, replace, lr); + strncpy(p, buff, lf); + g_free(buff); + } return TRUE; } return FALSE; diff --git a/deps/sysobj_early/src/util_ids.c b/deps/sysobj_early/src/util_ids.c index 197b1ed3..9546a8b7 100644 --- a/deps/sysobj_early/src/util_ids.c +++ b/deps/sysobj_early/src/util_ids.c @@ -243,7 +243,7 @@ GSList *ids_file_all_get_all(const gchar *file, split_loc_function split_loc_fun ids_query_result *working = g_new0(ids_query_result, 1); gchar **qparts = g_new0(gchar*, IDS_LOOKUP_MAX_DEPTH + 1); for(tabs = IDS_LOOKUP_MAX_DEPTH-1; tabs>=0; tabs--) - qparts[tabs] = g_malloc0(IDS_LOOKUP_BUFF_SIZE); + qparts[tabs] = g_malloc0(IDS_LOOKUP_BUFF_SIZE+1); tabs = 0; if (!split_loc_func) split_loc_func = split_loc_default; @@ -290,7 +290,7 @@ GSList *ids_file_all_get_all(const gchar *file, split_loc_function split_loc_fun // now p = id, name = name // ids_msg("p: %s -- name: %s", p, name); - strncpy(qparts[tabs], p, IDS_LOOKUP_BUFF_SIZE-1); + strncpy(qparts[tabs], p, IDS_LOOKUP_BUFF_SIZE); ids_query_result_set_str(working, tabs, name); if (tabs < tabs_last) for(;tabs_last > tabs; tabs_last--) { |