Fix format-truncation warning for gcc9 06/221006/2 accepted/tizen/unified/20191230.120925 submit/tizen/20191230.112257
authorSeonah Moon <seonah1.moon@samsung.com>
Thu, 26 Dec 2019 08:14:06 +0000 (17:14 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 26 Dec 2019 08:23:33 +0000 (17:23 +0900)
Change-Id: I5e3fd217a7f1242a0a61f1bcaf39a1a5fb60d3eb
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
src/download-manager-util.cpp

index 344ff76..549f9c7 100755 (executable)
@@ -474,7 +474,6 @@ string DownloadUtil::saveContent(string filePath, string userInstallDir)
        string extensionName;
        string countStr;
        int count = 0;
-       char tempStr[10] = {0};
        FileUtility fileObj;
 
        if (userInstallDir.empty()) {
@@ -506,8 +505,8 @@ string DownloadUtil::saveContent(string filePath, string userInstallDir)
 
        while(fileObj.isExistedFile(finalPath, false)) {
                count++;
-               snprintf(tempStr, 10, "_%d", count);
-               countStr.assign(tempStr);
+               auto tempStr = to_string(count);
+               countStr.assign("_" + tempStr);
                finalPath.clear();
                if (!extensionName.empty())
                        finalPath = dirPath + contentName + countStr + extensionName;
@@ -518,7 +517,6 @@ string DownloadUtil::saveContent(string filePath, string userInstallDir)
                        finalPath.clear();
                        break;
                }
-               memset(tempStr, 0, 10);
        }
 
        DM_SLOGI("finalPath[%s]", finalPath.c_str());