From 283db828471c773510a3b0dd4377e59beb032452 Mon Sep 17 00:00:00 2001 From: "minje.ahn" Date: Wed, 6 Mar 2024 13:19:16 +0900 Subject: [PATCH] Use g_strlcpy, g_strlcat directly Change-Id: Ibdf1641a85f97d90af4795ade6964d62e6102302 Signed-off-by: minje.ahn --- src/common/media-svc-media.c | 2 +- src/common/media-svc-storage.c | 4 ++-- src/common/media-svc-util.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c index 2c64f20..facd740 100755 --- a/src/common/media-svc-media.c +++ b/src/common/media-svc-media.c @@ -199,7 +199,7 @@ int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, cha return ret; } - SAFE_STRLCPY(thumbnail_path, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_PATHNAME_SIZE); + g_strlcpy(thumbnail_path, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_PATHNAME_SIZE); SQLITE3_FINALIZE(sql_stmt); diff --git a/src/common/media-svc-storage.c b/src/common/media-svc-storage.c index 6ef0b53..730912a 100755 --- a/src/common/media-svc-storage.c +++ b/src/common/media-svc-storage.c @@ -169,7 +169,7 @@ int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get root path"); if (MS_STRING_VALID(internal_path) && strncmp(path, internal_path, strlen(internal_path)) == 0) { - SAFE_STRLCPY(storage_id, DB_TABLE_MEDIA, MEDIA_SVC_UUID_SIZE + 1); + g_strlcpy(storage_id, DB_TABLE_MEDIA, MEDIA_SVC_UUID_SIZE + 1); g_free(internal_path); return MS_MEDIA_ERR_NONE; } @@ -182,7 +182,7 @@ int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); if (MS_STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0))) - SAFE_STRLCPY(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE + 1); + g_strlcpy(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE + 1); SQLITE3_FINALIZE(sql_stmt); diff --git a/src/common/media-svc-util.c b/src/common/media-svc-util.c index 8e28312..a6096a3 100644 --- a/src/common/media-svc-util.c +++ b/src/common/media-svc-util.c @@ -254,7 +254,7 @@ static bool __media_svc_get_file_ext(const char *file_path, char *file_ext) for (i = strlen(file_path); i >= 0; i--) { if (file_path[i] == '.') { - SAFE_STRLCPY(file_ext, &file_path[i + 1], MEDIA_SVC_FILE_EXT_LEN_MAX); + g_strlcpy(file_ext, &file_path[i + 1], MEDIA_SVC_FILE_EXT_LEN_MAX); return true; } @@ -1076,7 +1076,7 @@ int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_me ret = __media_svc_get_thumbnail_path(thumb_path, path, NULL, uid); if (ret != MS_MEDIA_ERR_NONE) { media_svc_error("Failed to create thumbnail path[%d]", ret); - SAFE_STRLCPY(thumb_path, "", MAX_FILEPATH_LEN); + g_strlcpy(thumb_path, "", MAX_FILEPATH_LEN); return ret; } -- 2.7.4