From cf3400f2505d845f3ddc40db8b7cc22e3ab01313 Mon Sep 17 00:00:00 2001 From: "dahyeong.kim" Date: Thu, 18 Apr 2013 15:02:44 +0900 Subject: [PATCH] Change log macro for privacy Change-Id: I3e95252bed17b8f9eeea919d270860b9b4c26b62 Signed-off-by: dahyeong.kim --- src/base/utility/FBaseUtil_FileUnzipperImpl.cpp | 24 ++++++++++++------------ src/base/utility/FBaseUtil_FileZipperImpl.cpp | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/base/utility/FBaseUtil_FileUnzipperImpl.cpp b/src/base/utility/FBaseUtil_FileUnzipperImpl.cpp index d2cade7..99c62c5 100644 --- a/src/base/utility/FBaseUtil_FileUnzipperImpl.cpp +++ b/src/base/utility/FBaseUtil_FileUnzipperImpl.cpp @@ -85,7 +85,7 @@ _FileUnzipperImpl::CreateDirectories(char* pFilePath) if (ret == -1) { r = _NativeError::ConvertNativeErrorToResult(errno, true); - SysTryReturnResult(NID_BASE_UTIL, + SysSecureTryReturnResult(NID_BASE_UTIL, (r == E_SUCCESS) || (r == E_FILE_ALREADY_EXIST), r, "Unable to create directory [%s]", pFilePath); } } @@ -130,10 +130,10 @@ _FileUnzipperImpl::Construct(const String& filePath) SysTryReturnResult(NID_BASE_UTIL, pFilePathBuff != null, E_INVALID_ARG, "Invalid file path."); const char* pFilePath = reinterpret_cast (pFilePathBuff->GetPointer()); - SysTryReturnResult(NID_BASE_UTIL, access(pFilePath, F_OK) == 0, E_FILE_NOT_FOUND, "Invalid file path [%s].", pFilePath); + SysSecureTryReturnResult(NID_BASE_UTIL, access(pFilePath, F_OK) == 0, E_FILE_NOT_FOUND, "Invalid file path [%s].", pFilePath); std::unique_ptr< void, CloseUnzipFile > pUnzipFile(unzOpen(pFilePath)); - SysTryReturnResult(NID_BASE_UTIL, pUnzipFile != null, E_IO, "Failed to open [%s].", pFilePath); + SysSecureTryReturnResult(NID_BASE_UTIL, pUnzipFile != null, E_IO, "Failed to open [%s].", pFilePath); int dirCount = 0; int fileCount = 0; @@ -185,13 +185,13 @@ _FileUnzipperImpl::UnzipCurrentFileTo(void* pUnZipFile, FilePath outPath, int us SysTryReturnResult(NID_BASE_UTIL, err == UNZ_OK, E_IO, "Failed to get file entry info from the zip file."); result r = _FileUnzipperImpl::CreateDirectories(outPath); - SysTryReturnResult(NID_BASE_UTIL, r == E_SUCCESS, r, "Failed to create Directory [%s]", outPath); + SysSecureTryReturnResult(NID_BASE_UTIL, r == E_SUCCESS, r, "Failed to create Directory [%s]", outPath); if(outPath[strlen(outPath) - 1] != '/') { std::unique_ptr< FILE, CloseFile > pFile(fopen(outPath, "w")); r = __ConvertNativeErrorToResult(errno); - SysTryReturnResult(NID_BASE_UTIL, pFile != null, r, "Failed to open file [name: %s, errorno: %d].", outPath, errno); + SysSecureTryReturnResult(NID_BASE_UTIL, pFile != null, r, "Failed to open file [name: %s, errorno: %d].", outPath, errno); err = unzOpenCurrentFile(pUnZipFile); SysTryReturnResult(NID_BASE_UTIL, err == UNZ_OK, E_IO, "Failed to open current zip file."); @@ -204,7 +204,7 @@ _FileUnzipperImpl::UnzipCurrentFileTo(void* pUnZipFile, FilePath outPath, int us readLen = unzReadCurrentFile(pUnZipFile, writeBuf, sizeof(writeBuf)); r = (readLen < 0) ? E_IO : E_SUCCESS; SysTryCatch(NID_BASE_UTIL, r == E_SUCCESS, unzCloseCurrentFile(pUnZipFile), r, - "[%s] Failed to read from zip file (%s).", GetErrorMessage(E_IO), outPath); + "[%s] Failed to read from zip file.", GetErrorMessage(E_IO)); if (readLen > 0) { @@ -246,7 +246,7 @@ _FileUnzipperImpl::UnzipTo(const String& dirPath) const strncat(outPath, reinterpret_cast (pDirBuff->GetPointer()), dirPathLength); std::unique_ptr< void, CloseUnzipFile > pUnzipFile(unzOpen(__pArchiveName.get())); - SysTryReturnResult(NID_BASE_UTIL, pUnzipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); + SysSecureTryReturnResult(NID_BASE_UTIL, pUnzipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); int err = unzGoToFirstFile(pUnzipFile.get()); SysTryReturnResult(NID_BASE_UTIL, err == UNZ_OK, E_IO, "Failed to get the first file entry in the zip file."); @@ -293,10 +293,10 @@ _FileUnzipperImpl::UnzipTo(const String& dirPath, const String& zipEntryName) co const char* pZipEntryName = reinterpret_cast (pZipEntryBuff->GetPointer()); std::unique_ptr< void, CloseUnzipFile > pUnzipFile(unzOpen(__pArchiveName.get())); - SysTryReturnResult(NID_BASE_UTIL, pUnzipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); + SysSecureTryReturnResult(NID_BASE_UTIL, pUnzipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); int err = unzLocateFile(pUnzipFile.get(), pZipEntryName, UNZ_COMP_CASE_SENSITIVE); - SysTryReturnResult(NID_BASE_UTIL, err == UNZ_OK, E_FILE_NOT_FOUND, "Failed to locate file entry (%s).", pZipEntryName); + SysSecureTryReturnResult(NID_BASE_UTIL, err == UNZ_OK, E_FILE_NOT_FOUND, "Failed to locate file entry (%s).", pZipEntryName); return UnzipCurrentFileTo(pUnzipFile.get(), outPath, dirPathLength); } @@ -399,10 +399,10 @@ _FileUnzipperImpl::GetEntry(const String& zipEntryName, ZipEntry& entry) const const char* pZipEntryName = reinterpret_cast (pZipEntryBuff->GetPointer()); std::unique_ptr< void, CloseUnzipFile > pZipFile(unzOpen(__pArchiveName.get())); - SysTryReturnResult(NID_BASE_UTIL, pZipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); + SysSecureTryReturnResult(NID_BASE_UTIL, pZipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); int err = unzLocateFile(pZipFile.get(), pZipEntryName, UNZ_COMP_CASE_SENSITIVE); - SysTryReturnResult(NID_BASE_UTIL, err == UNZ_OK, E_FILE_NOT_FOUND, "Failed to locate file entry (%s).", pZipEntryName); + SysSecureTryReturnResult(NID_BASE_UTIL, err == UNZ_OK, E_FILE_NOT_FOUND, "Failed to locate file entry (%s).", pZipEntryName); return GetCurrentFileInfo(pZipFile.get(), entry); } @@ -414,7 +414,7 @@ _FileUnzipperImpl::GetEntry(int index, ZipEntry& entry) const SysAssertf(__pArchiveName != null, "Not yet constructed! Construct() should be called before use"); std::unique_ptr< void, CloseUnzipFile > pZipFile(unzOpen(__pArchiveName.get())); - SysTryReturnResult(NID_BASE_UTIL, pZipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); + SysSecureTryReturnResult(NID_BASE_UTIL, pZipFile != null, E_IO, "Failed to open [%s].", __pArchiveName.get()); // goto the first file in the archive int err = unzGoToFirstFile(pZipFile.get()); diff --git a/src/base/utility/FBaseUtil_FileZipperImpl.cpp b/src/base/utility/FBaseUtil_FileZipperImpl.cpp index 162afbd..b5d1b1b 100644 --- a/src/base/utility/FBaseUtil_FileZipperImpl.cpp +++ b/src/base/utility/FBaseUtil_FileZipperImpl.cpp @@ -77,11 +77,11 @@ _FileZipperImpl::Construct(const String& filePath) const char* pFilePath = reinterpret_cast (pFilePathBuff->GetPointer()); result r = IsFileExists(pFilePath); - SysTryReturnResult(NID_BASE_UTIL, (r == E_SUCCESS) || (r == E_FILE_NOT_FOUND), r, "Invalid file path [%s].", pFilePath); + SysSecureTryReturnResult(NID_BASE_UTIL, (r == E_SUCCESS) || (r == E_FILE_NOT_FOUND), r, "Invalid file path [%s].", pFilePath); int createOption = (r == E_FILE_NOT_FOUND)? APPEND_STATUS_CREATE : APPEND_STATUS_ADDINZIP; std::unique_ptr< void, ZipFileDeleter > pZfile(zipOpen(pFilePath, createOption)); - SysTryReturnResult(NID_BASE_UTIL, pZfile != null, E_IO, "Invalid file path [%s].", pFilePath); + SysSecureTryReturnResult(NID_BASE_UTIL, pZfile != null, E_IO, "Invalid file path [%s].", pFilePath); int len = strlen(pFilePath); std::unique_ptr< char[] > pArchiveName(new (std::nothrow) char[len + 1]); @@ -169,7 +169,7 @@ _FileZipperImpl::AddToZip(const char* pFilePath, const char* pFilePathForZip, in result r = E_SUCCESS; std::unique_ptr< void, ZipFileDeleter > pZfile(zipOpen(__pArchiveName.get(), APPEND_STATUS_ADDINZIP)); - SysTryReturnResult(NID_BASE_UTIL, pZfile != null, E_IO, "Invalid file path [%s].", __pArchiveName.get()); + SysSecureTryReturnResult(NID_BASE_UTIL, pZfile != null, E_IO, "Invalid file path [%s].", __pArchiveName.get()); zip_fileinfo zipInfo = {{0}}; err = zipOpenNewFileInZip(pZfile.get(), pFilePathForZip, &zipInfo, null, 0, null, 0, null, Z_DEFLATED, level); @@ -179,7 +179,7 @@ _FileZipperImpl::AddToZip(const char* pFilePath, const char* pFilePathForZip, in if (pFile == null) { zipCloseFileInZip(pZfile.get()); - SysTryReturnResult(NID_BASE_UTIL, pFile != null, __ConvertNativeErrorToResult(errno), "[%s] Failed to open the file."); + SysTryReturnResult(NID_BASE_UTIL, pFile != null, __ConvertNativeErrorToResult(errno), "Failed to open the file."); } int readCnt = 1; -- 2.7.4