#include "InstallerUtil.h"
-#define OSP_INSTALLER_VERSION "version=[20130405.1]"
+#define OSP_INSTALLER_VERSION "version=[20130405.2]"
#define DIR_BIN L"/bin"
#define DIR_INFO L"/info"
File systemXml;
r = systemXml.Construct(systemXmlPath, L"w");
- TryReturn(!IsFailed(r), false, "systemXmlPath.Construct is failed");
+ TryReturn(!IsFailed(r), false, "systemXmlPath.Construct() is failed.");
- systemXml.Write(pMergedBuf.get(), fileSize);
+ r = systemXml.Write(pMergedBuf.get(), fileSize);
+ TryReturn(!IsFailed(r), false, "systemXmlPath.Write() is failed.");
AppLog("pMergedBuf.get()=0x%0x, length=%d", (unsigned int)pMergedBuf.get(), fileSize);
InstallerUtil::DumpLogData(pMergedBuf.get(), fileSize);
void
InstallerManager::PrintResult(void)
{
+ TryReturnVoid(__pContext, "__pContext is null.");
+
int errorType = GetErrorType();
InstallerOperation operation = __pContext->GetInstallerOperation();
const char* pOperation = InstallerUtil::GetInstallerOperationString(operation);
const wchar_t* pPackageId = L"Unknown";
- if (__pContext && !__pContext->__packageId.IsEmpty())
+ if (!__pContext->__packageId.IsEmpty())
{
pPackageId = __pContext->__packageId.GetPointer();
}
const wchar_t* pMainAppName = L"Unknown";
- if (__pContext && !__pContext->__mainAppName.IsEmpty())
+ if (!__pContext->__mainAppName.IsEmpty())
{
pMainAppName = __pContext->__mainAppName.GetPointer();
}
packageId = pContext->__packageId;
CATCH:
- pInstallManager->SetErrorType(errorType);
-
if (pInstallManager)
{
+ pInstallManager->SetErrorType(errorType);
+
if (!(option & INSTALLER_OPTION_NO_INPUT))
{
pInstallManager->PrintResult();
std::unique_ptr<ByteBuffer> pHashValue(hash.GetHashN(*pEncodedData.get()));
TryReturn(pHashValue, false, "pHashValue is null.");
- StringUtil::EncodeToBase64String(*pHashValue, base64Value);
+ r = StringUtil::EncodeToBase64String(*pHashValue, base64Value);
+ TryReturn(r == E_SUCCESS, false, "EncodeToBase64String() is failed.");
std::unique_ptr<char[]> pHashEncodedValue(_StringConverter::CopyToCharArrayN(base64Value));
TryReturn(pHashEncodedValue, false, "pHashEncodedValue is null.");
app_install = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "app_install"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_install == null))
{
AppLog("Install(): dlsym() failed. [%s]", pErrorMsg);
dlclose(pHandle);
app_uninstall = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "app_uninstall"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_uninstall == null))
{
AppLog("Uninstall(): dlsym() failed. [%s]", pErrorMsg);
dlclose(pHandle);
app_label_dir = reinterpret_cast <int (*)(const char*, const char*)>(dlsym(pHandle, "app_label_dir"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_label_dir == null))
{
AppLog("AddLabelDir(): dlsym() failed. [%s]", pErrorMsg);
dlclose(pHandle);
app_label_shared_dir = reinterpret_cast <int (*)(const char*, const char*, const char*)>(dlsym(pHandle, "app_label_shared_dir"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_label_shared_dir == null))
{
AppLog("AddLabelSharedDir(): dlsym() failed. [%s]", pErrorMsg);
dlclose(pHandle);
add_shared_dir_readers = reinterpret_cast <int (*)(const char*, const char**)>(dlsym(pHandle, "add_shared_dir_readers"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (add_shared_dir_readers == null))
{
AppLog("AddSharedDirReaders(): dlsym() failed. [%s]", pErrorMsg);
dlclose(pHandle);
app_add_friend = reinterpret_cast <int (*)(const char*, const char*)>(dlsym(pHandle, "app_add_friend"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_add_friend == null))
{
AppLog("AddFriend(): dlsym() failed. [%s]", pErrorMsg);
dlclose(pHandle);
app_enable_permissions = reinterpret_cast <int (*)(const char*, int, const char**, bool)>(dlsym(pHandle, "app_enable_permissions"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_enable_permissions == null))
{
AppLog("EnablePermissions(): dlsym() failed. [%s]", pErrorMsg);
dlclose(pHandle);
app_revoke_permissions = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "app_revoke_permissions"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_revoke_permissions == null))
{
AppLog("RevokePermissions(): dlsym() failed. [%s][%s]", pPackageId, pErrorMsg);
dlclose(pHandle);
app_add_permissions = reinterpret_cast <int (*)(const char*, const char**)>(dlsym(pHandle, "app_add_permissions"));
pErrorMsg = dlerror();
- if (pErrorMsg != null)
+ if ((pErrorMsg != null) || (app_add_permissions == null))
{
AppLog("AddPermissions(): dlsym() failed. [%s][%s]", pPackageId, pErrorMsg);
dlclose(pHandle);
TryReturn(pPackageInfoImpl, INSTALLER_ERROR_OUT_OF_MEMORY, "pPackageInfoImpl is null.");
AppLog("packageId = %ls", packageId.GetPointer());
- pPackageInfoImpl->Construct(packageId);
+
+ result r = pPackageInfoImpl->Construct(packageId);
+ TryReturn(r == E_SUCCESS, INSTALLER_ERROR_INTERNAL_STATE, "pPackageInfoImpl->Construct(%ls) failed.", packageId.GetPointer());
__pContext->__rootPath = pPackageInfoImpl->GetAppRootPath();
if (__pContext->__rootPath.StartsWith(PATH_USR_APPS, 0) == true)
r = file.Write(logs2, length+1);
if (IsFailed(r))
{
+ va_end(args);
return false;
}
va_end(args);
bool
InstallerUtil::GetRdsList(const PackageId& packageId, IList* pDeletedList, IList* pAddedList, IList* pModifiedList)
{
+ bool res = true;
FILE* fp = null;
char rdsFilePath[1024] = {0};
char buffer[1024] = {0};
}
std::unique_ptr<String> pStr(new (std::nothrow) String(buffer));
- TryReturn(pStr, false, "pStr is null.");
- TryReturn(pStr->IsEmpty() == false, false, "pStr is empty.");
+ TryCatch(pStr, res = false, "pStr is null.");
+ TryCatch(pStr->IsEmpty() == false, res = false, "pStr is empty.");
pStr->Trim();
AppLog(".rds_delta: line(%03d)=[%ls]", line, pStr->GetPointer());
memset(buffer, 0, sizeof(buffer));
}
- return true;
+CATCH:
+ fclose(fp);
+ return res;
}
const char*
AppLog(" <Size>%s</Size>", pCharacters);
- String* pPreviewImage = new (std::nothrow) String();
- TryReturn(pPreviewImage, false, "pPreviewImage is null");
+ std::unique_ptr< String > pPreviewImage(new (std::nothrow) String);
+ TryReturn(pPreviewImage, false, "pPreviewImage is null.");
XmlAttribute* pAttr = pHandler->GetAttribute();
if (pAttr)
}
}
- __pLiveboxData->AddSize(new (std::nothrow) String(pCharacters), pPreviewImage);
+ __pLiveboxData->AddSize(new (std::nothrow) String(pCharacters), pPreviewImage.release());
return true;
}