//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
ret = media_content_disconnect();
r = MapCoreErrorToNativeResult(ret);
SysTryLog(NID_CNT, r == E_SUCCESS, "[%s] Propagating for media_content_disconnect.", GetErrorMessage(r));
+
+ SysLog(NID_CNT, "media_content_disconnect result[%d].", ret);
}
_ContentDirectoryImpl*
r = MapCoreErrorToNativeResult(ret);
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Propagating for media_content_connect.");
+ SysLog(NID_CNT, "media_content_connect result[%d].", ret);
+
__contentType = type;
__isMultiContentType = false;
__multiContentTypeExpr.Clear();
r = MapCoreErrorToNativeResult(ret);
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Propagating for media_content_connect.");
+ SysLog(NID_CNT, "media_content_connect result[%d].", ret);
+
__multiContentTypeExpr.Clear();
std::unique_ptr<IEnumeratorT<ContentType> > pEnum(contentTypeList.GetEnumeratorN());
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Append operation.");
}
- r = folderPath.Insert('"', 0);
- SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation.");
- r = folderPath.Insert('"', folderPath.GetLength());
- SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation.");
+ r = folderPath.Replace("\'", "''");
+ SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Replace operation for nameExpr.");
+
+ r = folderPath.Insert('\'', 0);
+ SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation for nameExpr.");
+
+ r = folderPath.Insert('\'', folderPath.GetLength());
+ SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation for nameExpr.");
r = inputCondition.Append(folderPath);
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Append operation.");
{
//CopyToCharArrayN: utility function, converts a osp string to char*
std::unique_ptr<char[]> pInputCond(_StringConverter::CopyToCharArrayN(inputCondition));
- SysTryReturnResult(NID_CNT, (pInputCond.get())[0] != null, E_SYSTEM, "pInputCond is NULL.");
+ SysTryReturnResult(NID_CNT, pInputCond, E_OUT_OF_MEMORY, "The memory is insufficient.");
SysLog(NID_CNT, "pInputCond is [%s].", pInputCond.get());
- if ((pInputCond.get())[0] != null)
- {
- ret = media_filter_set_condition(*(pFilterHandle.get()), pInputCond.get(), MEDIA_CONTENT_COLLATE_DEFAULT);
- r = MapCoreErrorToNativeResult(ret);
- SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "Failed to perform media_filter_set_condition operation.");
- }
+ ret = media_filter_set_condition(*(pFilterHandle.get()), pInputCond.get(), MEDIA_CONTENT_COLLATE_DEFAULT);
+ r = MapCoreErrorToNativeResult(ret);
+ SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, r, "Failed to perform media_filter_set_condition operation.");
}
__pFilterHandle.reset(pFilterHandle.release());
SysTryReturn(NID_CNT, CheckMediaPath(contentDirectoryPath), directoryItemCount, E_INVALID_ARG,
"[E_INVALID_ARG] Failed to perform CheckMediaPath operation.");
- r = CreateFolderFilter(__isMultiContentType, contentDirectoryPath);
+ String detachedPath = contentDirectoryPath;
+
+ if (contentDirectoryPath.EndsWith(L"/"))
+ {
+ r = detachedPath.Remove(detachedPath.GetLength() - 1, 1);
+ SysTryReturn(NID_CNT, !IsFailed(r), directoryItemCount, E_INVALID_ARG, "[E_INVALID_ARG] Failed to remove the path string.");
+ }
+
+ r = CreateFolderFilter(__isMultiContentType, detachedPath);
SysTryReturn(NID_CNT, !IsFailed(r), directoryItemCount, E_SYSTEM, "[E_SYSTEM] Failed to perform CreateFolderFilter operation.");
ret = media_folder_foreach_folder_from_db(*(__pFilterHandle.get()), MediaFoldersCb, &pItemList);
SysTryReturn(NID_CNT, CheckMediaPath(contentDirectoryPath), null, E_INVALID_ARG,
"[E_INVALID_ARG] Failed to perform CheckMediaPath operation.");
+ String detachedPath = contentDirectoryPath;
+
+ if (contentDirectoryPath.EndsWith(L"/"))
+ {
+ r = detachedPath.Remove(detachedPath.GetLength() - 1, 1);
+ SysTryReturn(NID_CNT, !IsFailed(r), null, E_INVALID_ARG, "[E_INVALID_ARG] Failed to remove the path string.");
+ }
+
__pFinalOutList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
SysTryReturn(NID_CNT, __pFinalOutList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] FinalOutList is null.");
r = __pFinalOutList->Construct();
SysTryReturn(NID_CNT, r == E_SUCCESS, null, r, "[%s] Failed to construct __pFinalOutList ArrayList.", GetErrorMessage(r));
- r = CreateFolderFilter(__isMultiContentType, contentDirectoryPath);
+ r = CreateFolderFilter(__isMultiContentType, detachedPath);
SysTryReturn(NID_CNT, !IsFailed(r), null, E_SYSTEM, "[E_SYSTEM] Failed to perform CreateFolderFilter operation.");
- if ((!column.IsEmpty()) && (sortOrder != SORT_ORDER_NONE))
- {
- //__inputColumnName (osp column name) is replaced with slpColumn (slp column name).
- r = GetSlpColumnName(slpColumn, column);
- SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] Failed to perform GetSlpColumnName operation.", GetErrorMessage(r));
-
- //CopyToCharArrayN: utility function, converts a osp string to char*
- std::unique_ptr<char[]> pSortCol(_StringConverter::CopyToCharArrayN(slpColumn));
- SysTryReturn(NID_CNT, pSortCol.get() != null, null, E_SYSTEM, "[E_SYSTEM] pFolderId is NULL.");
-
- if (sortOrder == SORT_ORDER_ASCENDING)
- {
- ret = media_filter_set_order(*(__pFilterHandle.get()), MEDIA_CONTENT_ORDER_ASC, pSortCol.get(), MEDIA_CONTENT_COLLATE_DEFAULT);
- r = MapCoreErrorToNativeResult(ret);
- SysTryReturn(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, null, r,
- "[%s] Failed to perform media_filter_set_order operation.", GetErrorMessage(r));
- }
- else if (sortOrder == SORT_ORDER_DESCENDING)
- {
- ret = media_filter_set_order(*(__pFilterHandle.get()), MEDIA_CONTENT_ORDER_DESC, pSortCol.get(), MEDIA_CONTENT_COLLATE_DEFAULT);
- r = MapCoreErrorToNativeResult(ret);
- SysTryReturn(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, null, r,
- "[%s] Failed to perform media_filter_set_order operation.", GetErrorMessage(r));
- }
- }
-
pTempList = pItemList.get();
ret = media_folder_foreach_folder_from_db(*(__pFilterHandle.get()), MediaFoldersCb, &pTempList);
r = MapCoreErrorToNativeResult(ret);
SysLog(NID_CNT, "totalCount is [%d].", totalCount);
}
-
+
if (totalCount > 0)
{
if ((totalCount % countPerPage) == 0)
SysLog(NID_CNT, "totalCount [%d] totalPageCount[%d] __countPerPage[%d] __pageNo[%d] offset[%d]",
totalCount, totalPageCount, countPerPage, pageNo, offset);
+ if ((!column.IsEmpty()) && (sortOrder != SORT_ORDER_NONE))
+ {
+ //__inputColumnName (osp column name) is replaced with slpColumn (slp column name).
+ r = GetSlpColumnName(slpColumn, column);
+ SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] Failed to perform GetSlpColumnName operation.", GetErrorMessage(r));
+
+ //CopyToCharArrayN: utility function, converts a osp string to char*
+ std::unique_ptr<char[]> pSortCol(_StringConverter::CopyToCharArrayN(slpColumn));
+ SysTryReturn(NID_CNT, pSortCol, null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+ if (sortOrder == SORT_ORDER_ASCENDING)
+ {
+ ret = media_filter_set_order(*(__pFilterHandle.get()), MEDIA_CONTENT_ORDER_ASC, pSortCol.get(), MEDIA_CONTENT_COLLATE_DEFAULT);
+ r = MapCoreErrorToNativeResult(ret);
+ SysTryReturn(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, null, r,
+ "[%s] Failed to perform media_filter_set_order operation.", GetErrorMessage(r));
+ }
+ else if (sortOrder == SORT_ORDER_DESCENDING)
+ {
+ ret = media_filter_set_order(*(__pFilterHandle.get()), MEDIA_CONTENT_ORDER_DESC, pSortCol.get(), MEDIA_CONTENT_COLLATE_DEFAULT);
+ r = MapCoreErrorToNativeResult(ret);
+ SysTryReturn(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, null, r,
+ "[%s] Failed to perform media_filter_set_order operation.", GetErrorMessage(r));
+ }
+ }
+
ret = media_filter_set_offset(*(__pFilterHandle.get()),offset,countPerPage);
r = MapCoreErrorToNativeResult(ret);
SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] Failed to perform media_filter_set_offset operation.", GetErrorMessage(r));