{
return 0;
}
-
+ SysLog(NID_SYS, "path %s", path);
for (de = readdir(d); de != null; de = readdir(d))
{
char filePath[1024] = {0,};
+ int length = strlen(path) + strlen(de->d_name);
+ SysTryReturn(NID_SYS, length > 0 && length < 1023, 0, E_INVALID_ARG, "The file path is invalid");
sprintf(filePath, "%s%s", path, de->d_name);
if (lstat(filePath, &buf) == 0)
}
}
total_size += buf.st_size;
-
}
else
{
: _ISettingProvider
{
public:
- _SettingFontProvider();
- ~_SettingFontProvider();
+ _SettingFontProvider(void);
+ virtual ~_SettingFontProvider(void);
public:
bool HasKey(const Tizen::Base::String& key);
static const wchar_t* _NETWORK_FLIGHTMODE = L"http://tizen.org/setting/network.flight_mode";
static const wchar_t* _NETWORK_TELEPHONY_PACKETSERVICE = L"http://tizen.org/setting/network.telephony.packet_service";
static const wchar_t* _NETWORK_TELEPHONY_ROAMING = L"http://tizen.org/setting/network.telephony.roaming";
-static const wchar_t* _SYSTEM_TELEPHONY = L"http://tizen.org/feature/network.telephony";
//Network Wi-Fi
static const wchar_t* _NETWORK_WIFI = L"http://tizen.org/setting/network.wifi";
static const wchar_t* _USB_TETHERING = L"http://tizen.org/setting/usb.tethering"; //Especially, USB tethering is covered by this provider.
static const wchar_t* _NETWORK_WIFI_DIRECT = L"http://tizen.org/setting/network.wifi.direct";
-static const wchar_t* _SYSTEM_NETWORK_WIFI_DIRECT = L"http://tizen.org/feature/network.wifi.direct";
-static const wchar_t* _SYSTEM_NETWORK_WIFI = L"http://tizen.org/feature/network.wifi";
-
//Network Bluetooth
static const wchar_t* _NETWORK_BLUETOOTH = L"http://tizen.org/setting/network.bluetooth";
static const wchar_t* _NETWORK_BLUETOOTH_TETHERING = L"http://tizen.org/setting/network.bluetooth.tethering";
static const int _DEVICE_CPU = 1;
static const int _DEVICE_POWER_LEVEL_ON = 1;
static const int _DEVICE_POWER_LEVEL_OFF = 0;
-static const int _APPID_LENGTH = 10;
static const int _DEACTIVATED_BRIGHTNESS_CONTROL = -1;
static const float _BRIGHTNESS_RESOLUTION = 10.0;
static const wchar_t* POWER_MANAGER_SERVICE_ID = L"osp.sys.ipcserver.powermanager";
namespace Tizen { namespace System
{
-static const int _RUNTIME_GET_PARAM_TYPE = 1;
static const wchar_t* _RUNTIME_SERVICE_ID = L"osp.sys.ipcserver.runtimeinfo";
static const wchar_t* _RUNTIME_GET_SIZE = L"osp.system.command.runtime.get.size";
static const wchar_t* _RUNTIME_RESULT_SUCCESS = L"osp.system.result.success";
-static const wchar_t* _RUNTIME_RESULT_SYSTEM = L"osp.system.result.system";
_RuntimeClient* _RuntimeClient::__pRuntimeClient= null;
return 0;
}
- char command[512] = {0,};
- char fileName[512] = {0,};
+ char* pCommand = null;
+ char* pFileName = null;
+ int fileLength = 0;
+ int commandLength = 0;
long long size = 0;
int ret = 0;
+ FILE* pFile = null;
Tizen::App::App* pApp = Tizen::App::App::GetInstance();
if(pApp == null)
String appId(pApp->GetAppId());
unique_ptr <char> appIdPath(_StringConverter::CopyToCharArrayN(appId));
- ret = sprintf(fileName, "/tmp/size_of_directory_%s.tmp", appIdPath.get());
- if(ret < 1)
- {
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to write file path.");
- return 0;
- }
-
- ret = sprintf(command, "rm -rf %s", fileName);
- if(ret < 1)
- {
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
- return 0;
- }
+ fileLength = strlen(appIdPath.get()) + 29;
+ pFileName = (char*)malloc(fileLength);
+ ret = sprintf(pFileName, "/tmp/size_of_directory_%s.tmp", appIdPath.get());
+ SysTryCatch(NID_SYS, ret > 0, E_SYSTEM, E_SYSTEM, "It is failed to write file path.");
- ret = system(command);
+ commandLength = strlen(pFileName) + 8;
+ pCommand = (char*) malloc(commandLength);
+ ret = sprintf(pCommand, "rm -rf %s", pFileName);
+ SysTryCatch(NID_SYS, ret > 0, E_SYSTEM, E_SYSTEM, "It is failed to write remove pCommand.");
+ ret = system(pCommand);
if(ret == -1)
{
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute pCommand[%s].", pCommand);
}
+ free(pCommand);
+ pCommand = null;
- ret = sprintf(command, "du -skb -P %s >> %s", path, fileName);
- if(ret < 1)
- {
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to write du command.");
- return 0;
- }
+ commandLength = strlen(pFileName) + strlen(path) + 16;
+ pCommand = (char*)malloc(commandLength);
+ ret = sprintf(pCommand, "du -skb -P %s >> %s", path, pFileName);
+ SysTryCatch(NID_SYS, ret > 0, E_SYSTEM, E_SYSTEM, "It is failed to write du pCommand.");
- ret = system(command);
- if(ret == -1)
- {
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
- return 0;
- }
+ ret = system(pCommand);
+ SysTryCatch(NID_SYS, ret != -1, E_SYSTEM, E_SYSTEM, "It is failed to execute pCommand[%s].", pCommand);
- FILE* pFile = null;
- pFile = fopen(fileName, "r");
- if(pFile == null)
- {
- return 0;
- }
+ pFile = fopen(pFileName, "r");
+ SysTryCatch(NID_SYS, pFile != null, E_SYSTEM, E_SYSTEM, "It is failed to read file [%s].", pFileName);
ret = fscanf(pFile, "%lld", &size);
- if(ret < 1)
- {
- if(pFile != null)
- {
- fclose(pFile);
- }
+ SysTryCatch(NID_SYS, ret > 0, E_SYSTEM, E_SYSTEM, "It is failed to read file [%s].", pFileName);
- return 0;
- }
+ ret = sprintf(pCommand, "rm -rf %s", pFileName);
+ SysTryCatch(NID_SYS, ret > 0, E_SYSTEM, E_SYSTEM, "It is failed to write remove pCommand.");
+
+ ret = system(pCommand);
+ SysTryCatch(NID_SYS, ret != -1, E_SYSTEM, E_SYSTEM, "It is failed to execute pCommand[%s].", pCommand);
- if(pFile != null)
+CATCH:
+ if (pFileName)
{
- fclose(pFile);
+ free(pFileName);
}
-
- ret = sprintf(command, "rm -rf %s", fileName);
- if(ret < 1)
+ if (pCommand)
{
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
- return 0;
+ free(pFileName);
}
-
- ret = system(command);
- if(ret == -1)
+ if (pFile)
{
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
+ fclose(pFile);
}
-
-
return size;
}
_SettingClient* _SettingClient::__pSettingClient = null;
-int common_service = 1;
-
void
_SettingClient::InitSettingClient(void)
{
namespace Tizen { namespace System
{
-//IDs for IPC
-static const int _SYSTEM_RESPONSE_DATA = 2;
-
//Reserved key
static const wchar_t* _SETTING_SCREEN_WALLPAPER = L"http://tizen.org/setting/screen.wallpaper";
static const wchar_t* _SETTING_SYSTEM_SOUND_VOLUME = L"SystemSoundVolume";
value = *pDuid;
-CATCH:
responseMessage.RemoveAll(true);
}
}
SysTryReturn(NID_SYS, *pResult == _SYSTEM_RESULT_OK, r = E_SYSTEM, r, "It is failed to get IMEI value.");
imei = *pImei;
-
-CATCH:
responseMessage.RemoveAll(true);
return r;
SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " RegistryImpl construct is failed");
r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " Registry GetValue is failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " Registry GetValue is failed, %ls", key.GetPointer());
if(valStr == L"true" || valStr == L"false")
{
SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed");
r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed");
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue is failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed, %ls", key.GetPointer());
r = Integer::Parse(valStr, value);
SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, " Integer::Parse() is failed");
return E_SUCCESS;
SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed");
r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed");
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue is failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed, [%ls]", key.GetPointer());
if(valStr == L"true")
{
value = true;
ArrayList requestMessage;
ArrayList responseMessage;
- char datetime[32] = {0,};
+ char datetime[64] = {0,};
LocaleManager localeManager;
localeManager.Construct();
using namespace Tizen::Base::Collection;
using namespace Tizen::Base::Utility;
-#define EXTRA_ENCODINGS_LENGTH 3
-static String extraEncodings[] = {
-"UCS4", "UCS4BE", "UCS4LE"
-};
-
namespace Tizen { namespace Text
{
using namespace Tizen::Base;
#define UCS2_BOM_SIZE 2
-#define SUPPORTED_ENCODINGS_LENGTH 3
-static String supportedEncodings[] = {
-"UCS2", "UCS2BE", "UCS2LE"
-};
namespace Tizen { namespace Text
{