${CMAKE_SOURCE_DIR}/provider/browser-provider-socket.c
${CMAKE_SOURCE_DIR}/provider/browser-provider-shm.c
${CMAKE_CURRENT_SOURCE_DIR}/bookmark-adaptor-image.c
- ${CMAKE_CURRENT_SOURCE_DIR}/bookmark-adaptor.c )
+ ${CMAKE_CURRENT_SOURCE_DIR}/bookmark-adaptor.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bookmark_adaptor_pkgs_LDFLAGS} ${BOOKMARK_LINK_LIBRARIES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PKG_VERSION})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0)
{
TRACE_DEBUG("pthread:%0x", (int)g_adaptor_event_thread_pid);
return bp_common_adaptor_disconnect(&g_adaptorinfo,
- &g_adaptor_event_thread_pid);
+ &g_adaptor_event_thread_pid);
}
int __browser_adaptor_connect(int callback)
}
g_bp_command.cmd = BP_CMD_NONE;
g_bp_command.id = -1;
- if(g_adaptorinfo != NULL) {
- g_bp_command.cid = g_adaptorinfo->cid;
- } else {
- g_bp_command.cid = 0;
- }
+ if (g_adaptorinfo != NULL)
+ g_bp_command.cid = g_adaptorinfo->cid;
+ else
+ g_bp_command.cid = 0;
+
if (callback == 1 && g_adaptor_event_thread_pid <= 0) {
// create thread here ( getting event_socket )
if (pthread_create(&g_adaptor_event_thread_pid, NULL,
(-1, BP_CMD_COMMON_CLEAR_DELETED_IDS);
}
-int bp_bookmark_adaptor_set_data_changed_cb
- (bp_bookmark_adaptor_data_changed_cb callback, void *user_data)
+int bp_bookmark_adaptor_set_data_changed_cb(
+ bp_bookmark_adaptor_data_changed_cb callback, void *user_data)
{
if (callback == NULL) {
TRACE_ERROR("check callback address:%p", callback);
return __bp_bookmark_adaptor_send_cmd(-1, BP_CMD_SET_NOTI_CB);
}
-int bp_bookmark_adaptor_unset_data_changed_cb
- (bp_bookmark_adaptor_data_changed_cb callback)
+int bp_bookmark_adaptor_unset_data_changed_cb(
+ bp_bookmark_adaptor_data_changed_cb callback)
{
if (callback != NULL && callback == g_adaptor_noti_cb) {
g_adaptor_noti_cb = NULL;
int bp_bookmark_adaptor_get_errorcode(void)
{
- switch(errorcode) {
+ switch (errorcode) {
case BP_ERROR_INVALID_PARAMETER:
return BP_BOOKMARK_ERROR_INVALID_PARAMETER;
case BP_ERROR_OUT_OF_MEMORY:
memset(info, 0x00, sizeof(bp_bookmark_info_fmt));
// fill info
- if (offset & BP_BOOKMARK_O_TYPE) {
+ if (offset & BP_BOOKMARK_O_TYPE)
info->type = bookmark.type;
- }
- if (offset & BP_BOOKMARK_O_PARENT) {
+
+ if (offset & BP_BOOKMARK_O_PARENT)
info->parent = bookmark.parent;
- }
- if (offset & BP_BOOKMARK_O_SEQUENCE) {
+
+ if (offset & BP_BOOKMARK_O_SEQUENCE)
info->sequence = bookmark.sequence;
- }
- if (offset & BP_BOOKMARK_O_IS_EDITABLE) {
+
+ if (offset & BP_BOOKMARK_O_IS_EDITABLE)
info->editable = bookmark.editable;
- }
- if (offset & BP_BOOKMARK_O_IS_OPERATOR) {
+
+ if (offset & BP_BOOKMARK_O_IS_OPERATOR)
info->is_operator = bookmark.is_operator;
- }
- if (offset & BP_BOOKMARK_O_ACCESS_COUNT) {
+
+ if (offset & BP_BOOKMARK_O_ACCESS_COUNT)
info->access_count = bookmark.access_count;
- }
- if (offset & BP_BOOKMARK_O_DATE_CREATED) {
+
+ if (offset & BP_BOOKMARK_O_DATE_CREATED)
info->date_created = bookmark.date_created;
- }
- if (offset & BP_BOOKMARK_O_DATE_MODIFIED) {
+
+ if (offset & BP_BOOKMARK_O_DATE_MODIFIED)
info->date_modified = bookmark.date_modified;
- }
- if (offset & BP_BOOKMARK_O_DATE_VISITED) {
+
+ if (offset & BP_BOOKMARK_O_DATE_VISITED)
info->date_visited = bookmark.date_visited;
- }
+
// get strings . keep the order with provider
if (offset & BP_BOOKMARK_O_URL) {
if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE)
return 0;
}
-static int __bp_bookmark_adaptor_get_cond_ids_p
- (bp_command_defs pcommand, int **ids, int *count,
+static int __bp_bookmark_adaptor_get_cond_ids_p(
+ bp_command_defs pcommand, int **ids, int *count,
bp_bookmark_property_cond_fmt *properties,
bp_bookmark_rows_cond_fmt *conds,
const bp_bookmark_offset check_offset,
if (keyword == NULL)
oflags = 0;
if (bp_ipc_send_custom_type(sock, &t_properties,
- sizeof(bp_bookmark_property_cond_fmt)) < 0 ||
+ sizeof(bp_bookmark_property_cond_fmt)) < 0 ||
bp_ipc_send_custom_type(sock, &t_conds,
- sizeof(bp_bookmark_rows_cond_fmt)) < 0 ||
+ sizeof(bp_bookmark_rows_cond_fmt)) < 0 ||
bp_ipc_send_custom_type(sock, &oflags,
- sizeof(bp_bookmark_offset)) < 0) {
+ sizeof(bp_bookmark_offset)) < 0) {
errorcode = BP_ERROR_IO_ERROR;
BP_PRINT_ERROR(-1, errorcode);
__browser_adaptor_disconnect();
return 0;
}
-int bp_bookmark_adaptor_get_timestamp_ids_p
- (int **ids, int *count,
+int bp_bookmark_adaptor_get_timestamp_ids_p(
+ int **ids, int *count,
const bp_bookmark_property_cond_fmt *properties, //if NULL, ignore
const bp_bookmark_rows_fmt *limits,//if NULL, ignore
const bp_bookmark_timestamp_fmt times[], const int times_count,
}
if (bp_ipc_send_custom_type(sock, &t_properties,
- sizeof(bp_bookmark_property_cond_fmt)) < 0 ||
+ sizeof(bp_bookmark_property_cond_fmt)) < 0 ||
bp_ipc_send_custom_type(sock, &t_limits,
- sizeof(bp_bookmark_rows_fmt)) < 0 ||
+ sizeof(bp_bookmark_rows_fmt)) < 0 ||
bp_adaptor_ipc_send_int(sock, times_count) < 0) {
errorcode = BP_ERROR_IO_ERROR;
BP_PRINT_ERROR(-1, errorcode);
(-1, BP_CMD_BOOKMARK_RESTORE, value);
}
-int bp_bookmark_adaptor_get_ids_p
- (int **ids, int *count, const int limit, const int offset,
+int bp_bookmark_adaptor_get_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const int parent, const int type,
const int is_operator, const int is_editable,
const bp_bookmark_offset order_offset, const int ordering)
}
if (bp_ipc_send_custom_type(sock, &conds,
- sizeof(bp_db_base_conds_fmt)) < 0 ||
+ sizeof(bp_db_base_conds_fmt)) < 0 ||
bp_adaptor_ipc_send_int(sock, parent) < 0 ||
bp_adaptor_ipc_send_int(sock, type) < 0 ||
bp_adaptor_ipc_send_int(sock, is_operator) < 0 ||
return 0;
}
-int bp_bookmark_adaptor_get_cond_ids_p
- (int **ids, int *count,
+int bp_bookmark_adaptor_get_cond_ids_p(
+ int **ids, int *count,
bp_bookmark_property_cond_fmt *properties,
bp_bookmark_rows_cond_fmt *conds,
const bp_bookmark_offset check_offset,
const char *keyword, const int is_like)
{
- return __bp_bookmark_adaptor_get_cond_ids_p
- (BP_CMD_COMMON_GET_CONDS_DATE_IDS, ids, count, properties,
+ return __bp_bookmark_adaptor_get_cond_ids_p(
+ BP_CMD_COMMON_GET_CONDS_DATE_IDS, ids, count, properties,
conds, check_offset, keyword, is_like);
}
-int bp_bookmark_adaptor_get_raw_retrieved_ids_p
- (int **ids, int *count,
+int bp_bookmark_adaptor_get_raw_retrieved_ids_p(
+ int **ids, int *count,
bp_bookmark_property_cond_fmt *properties,
bp_bookmark_rows_cond_fmt *conds,
const bp_bookmark_offset check_offset,
const char *keyword, const int is_like)
{
- return __bp_bookmark_adaptor_get_cond_ids_p
- (BP_CMD_COMMON_GET_CONDS_RAW_IDS, ids, count, properties,
+ return __bp_bookmark_adaptor_get_cond_ids_p(
+ BP_CMD_COMMON_GET_CONDS_RAW_IDS, ids, count, properties,
conds, check_offset, keyword, is_like);
}
//////////////// internet_bookmark_xxx APIs
// removing an item without corresponding sub items. remain this code just for reference.
-/*
+#if 0
int bp_bookmark_adaptor_remove(const int id, const int remove_flag)
{
// workaround API for WEBAPI TC(favorite api)
}
return bp_bookmark_adaptor_delete(id);
}
-*/
+#endif
int bp_bookmark_adaptor_reset(void)
{
* @brief The structure type that includes the variables for all properties.
* @since_tizen 2.3
* @remarks The caller only has to access the variables that are related to the bookmark_offset. \n
- * The caller has to initialize the structure before using it.\n
- * The caller has to free the memory of the structure allocated by bp_bookmark_adaptor_get_info().
+ * The caller has to initialize the structure before using it.\n
+ * The caller has to free the memory of the structure allocated by bp_bookmark_adaptor_get_info().
*/
typedef struct {
int type; /**< Type @c 0: bookmark @c 1: folder */
char *device_name; /**< Device name of cloud sync from which the bookmark originated */
char *device_id; /**< Device ID of cloud sync from which the bookmark originated */
unsigned char *favicon; /**< Raw data of the icon ( favorites icon ) */
- unsigned char *thumbnail; /**< Raw data of the snapshot */
+ unsigned char *thumbnail; /**< Raw data of the snapshot */
unsigned char *webicon; /**< Raw data of the webicon */
int tag_count; /**< Deprecated */
void *tags; /**< Deprecated */
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] callback The function address of the callback function to be called
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] callback The function address of the callback function to be called
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_is_setted_data_changed_cb()
* @see bp_bookmark_adaptor_unset_data_changed_cb()
*/
-EXPORT_API int bp_bookmark_adaptor_set_data_changed_cb
- (bp_bookmark_adaptor_data_changed_cb callback, void *user_data);
+EXPORT_API int bp_bookmark_adaptor_set_data_changed_cb(
+ bp_bookmark_adaptor_data_changed_cb callback, void *user_data);
/**
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] callback The function address of the callback function to be called
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] callback The function address of the callback function to be called
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_is_setted_data_changed_cb()
* @see bp_bookmark_adaptor_set_data_changed_cb()
*/
-EXPORT_API int bp_bookmark_adaptor_unset_data_changed_cb
- (bp_bookmark_adaptor_data_changed_cb callback);
+EXPORT_API int bp_bookmark_adaptor_unset_data_changed_cb(
+ bp_bookmark_adaptor_data_changed_cb callback);
/**
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_set_data_changed_cb()
* @see bp_bookmark_adaptor_unset_data_changed_cb()
*/
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_initialize(void);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_initialize()
*/
EXPORT_API int bp_bookmark_adaptor_deinitialize(void);
/**
* @brief Gets the ID of the root level folder.
* @since_tizen 2.3
- * @param[out] id The integer ID value of the root level folder
- * @return @c 0 on success,
- * otherwise @c -1 is returned if the address of the parameter is @c NULL
+ * @param[out] id The integer ID value of the root level folder
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned if the address of the parameter is @c NULL
*/
EXPORT_API int bp_bookmark_adaptor_get_root(int *id);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[out] id The ID of the item
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[out] id The ID of the item
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_dirty(const int id);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @details The callback function is invoked if already registered.
- * @return @c 0 on success,
- * otherwise @c -1 is returned
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned
* @see bp_bookmark_adaptor_set_data_changed_cb()
*/
EXPORT_API int bp_bookmark_adaptor_publish_notification(void);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value If @c 0 it means bookmark,
- * otherwise @c 1 means folder
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value If @c 0 it means bookmark,
+ * otherwise @c 1 means folder
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_type(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value The integer ID of the parent folder
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The integer ID of the parent folder
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_parent_id(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value The string array
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The string array
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_url(const int id, char **value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
+ * @param[in] id The ID of the item
* @param[out] value The string array
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_title(const int id, char **value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value The integer pointer
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The integer pointer
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_sequence(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value @c 0 means editable,
- * otherwise @c 1 means read only
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value @c 0 means editable,
+ * otherwise @c 1 means read only
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_is_editable(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value @c 0 means it is made by the user,
- * otherwise @c 1 means it is made by the operator
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value @c 0 means it is made by the user,
+ * otherwise @c 1 means it is made by the operator
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_is_operator(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value The integer, frequency of use
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The integer, frequency of use
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_access_count(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value The time stamp, integer
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The time stamp, integer
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_date_created(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[out] value The time stamp, integer
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The time stamp, integer
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_date_modified(const int id, int *value);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @param[in] id The ID of the item
- * @param[out] value The time stamp, integer
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[out] value The time stamp, integer
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_date_visited(const int id, int *value);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated string memory has to be released by the caller.
- * @param[in] id The ID of the item
- * @param[out] value The string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_account_name(const int id, char **value);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated string memory has to be released by the caller.
- * @param[in] id The ID of the item
- * @param[out] value The string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_account_type(const int id, char **value);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated string memory has to be released by the caller.
- * @param[in] id The ID of the item
- * @param[out] value The string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_device_name(const int id, char **value);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated string memory has to be released by the caller.
- * @param[in] id The ID of the item
- * @param[out] value The string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_device_id(const int id, char **value);
* @privilege %http://tizen.org/privilege/bookmark.admin
* @details The color space of the image is ARGB8888.
* @remarks The image data value will be stored in the shared memory allocated by the browser-provider.
- * Therefore, if this API is called multiple times, image contents may be changed, but the pointer will be the same.
- * PLEASE DO NOT free the 'value' parameter directly after it is assigned.
- * If you want to use the image data permanently, allocate memory and make a deep copy of the data.
- * @param[in] id The ID of the item
- * @param[out] width The width of the image
- * @param[out] height The height of the image
+ * Therefore, if this API is called multiple times, image contents may be changed, but the pointer will be the same.
+ * PLEASE DO NOT free the 'value' parameter directly after it is assigned.
+ * If you want to use the image data permanently, allocate memory and make a deep copy of the data.
+ * @param[in] id The ID of the item
+ * @param[out] width The width of the image
+ * @param[out] height The height of the image
* @param[out] value A pointer to the raw image data; this memory will be released automatically when the browser provider is deinitialized
- * @param[out] length The size of the raw data
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[out] length The size of the raw data
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_get_icon_png()
*/
EXPORT_API int bp_bookmark_adaptor_get_icon(const int id, int *width, int *height, unsigned char **value, int *length);
* @privilege %http://tizen.org/privilege/bookmark.admin
* @details The color space of the image is ARGB8888.
* @remarks The image data value will be stored in the shared memory allocated by the browser-provider.
- * Therefore, if this API is called multiple times, image contents may be changed, but the pointer will be the same.
- * PLEASE DO NOT free the 'value' parameter directly after it is assigned.
- * If you want to use the image data permanently, allocate memory and make a deep copy of the data.
- * @param[in] id The ID of the item
- * @param[out] width The width of the image
- * @param[out] height The height of the image
+ * Therefore, if this API is called multiple times, image contents may be changed, but the pointer will be the same.
+ * PLEASE DO NOT free the 'value' parameter directly after it is assigned.
+ * If you want to use the image data permanently, allocate memory and make a deep copy of the data.
+ * @param[in] id The ID of the item
+ * @param[out] width The width of the image
+ * @param[out] height The height of the image
* @param[out] value A pointer to the raw image data; this memory will be released automatically when the browser provider is deinitialized
- * @param[out] length The size of the raw data
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[out] length The size of the raw data
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_snapshot(const int id, int *width, int *height, unsigned char **value, int *length);
* @privilege %http://tizen.org/privilege/bookmark.admin
* @details The color space of the image is ARGB8888.
* @remarks The image data value will be stored in the shared memory allocated by the browser-provider.
- * Therefore, if this API is called multiple times, image contents may be changed, but the pointer will be the same.
- * PLEASE DO NOT free the 'value' parameter directly after it is assigned.
- * If you want to use the image data permanently, allocate memory and make a deep copy of the data.
- * @param[in] id The ID of the item
- * @param[out] width The width of the image
- * @param[out] height The height of the image
+ * Therefore, if this API is called multiple times, image contents may be changed, but the pointer will be the same.
+ * PLEASE DO NOT free the 'value' parameter directly after it is assigned.
+ * If you want to use the image data permanently, allocate memory and make a deep copy of the data.
+ * @param[in] id The ID of the item
+ * @param[out] width The width of the image
+ * @param[out] height The height of the image
* @param[out] value A pointer to the raw image data; this memory will be released automatically when the browser-provider is deinitialized
- * @param[out] length The size of the raw data
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[out] length The size of the raw data
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_webicon(const int id, int *width, int *height, unsigned char **value, int *length);
* @privilege %http://tizen.org/privilege/bookmark.admin
* @details The color space of the image is 32bit RGBA.
* @remarks The allocated memory for rows data has to be released by the caller.
- * @param[in] id The ID of the item
- * @param[out] value The binary of the image
- * @param[out] length The size of the binary
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[out] value The binary of the image
+ * @param[out] length The size of the binary
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_get_icon_png()
*/
EXPORT_API int bp_bookmark_adaptor_get_icon_png(const int id, unsigned char **value, int *length);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value If @c 0 it means bookmark,
- * otherwise @c 1 means folder
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value If @c 0 it means bookmark,
+ * otherwise @c 1 means folder
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_type(const int id, const int value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The integer ID of the parent folder
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The integer ID of the parent folder
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_parent_id(const int id, const int value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The URI address
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The URI address
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_url(const int id, const char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The title string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The title string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_title(const int id, const char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The index of ordering,
- * otherwise if negative, update to max index automatically
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The index of ordering,
+ * otherwise if negative, update to max index automatically
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_sequence(const int id, const int value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The integer, frequency of use
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The integer, frequency of use
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_access_count(const int id, const int value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The time stamp,
- * otherwise if less than or equal to @c 0, update to present time automatically
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The time stamp,
+ * otherwise if less than or equal to @c 0, update to present time automatically
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_date_created(const int id, const int value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The time stamp,
- * otherwise if less than or equal to @c 0, update to present time automatically
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The time stamp,
+ * otherwise if less than or equal to @c 0, update to present time automatically
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_date_modified(const int id, const int value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The time stamp,
- * otherwise if less than or equal to @c 0, update to present time automatically
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The time stamp,
+ * otherwise if less than or equal to @c 0, update to present time automatically
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_date_visited(const int id, const int value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The account name, string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The account name, string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_account_name(const int id, const char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The account type, string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The account type, string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_account_type(const int id, const char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The device name, string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The device name, string
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_device_name(const int id, const char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
+ * @param[in] id The ID of the item
* @param[in] value The device ID, string
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_device_id(const int id, const char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @details The color space of the image is ARGB8888.
- * @param[in] id The ID of the item
- * @param[in] width The width of the image
- * @param[in] height The height of the image
- * @param[in] value The raw data of the image
- * @param[in] length The size of the raw data
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @details The color space of the image is ARGB8888.
+ * @param[in] id The ID of the item
+ * @param[in] width The width of the image
+ * @param[in] height The height of the image
+ * @param[in] value The raw data of the image
+ * @param[in] length The size of the raw data
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_set_icon_png()
*/
EXPORT_API int bp_bookmark_adaptor_set_icon(const int id, const int width, const int height, const unsigned char *value, const int length);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @details The color space of the image is ARGB8888.
- * @param[in] id The ID of the item
- * @param[in] width The width of the image
+ * @details The color space of the image is ARGB8888.
+ * @param[in] id The ID of the item
+ * @param[in] width The width of the image
* @param[in] height The height of the image
- * @param[in] value The raw data of the image
- * @param[in] length The size of the raw data
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] value The raw data of the image
+ * @param[in] length The size of the raw data
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_snapshot(const int id, const int width, const int height, const unsigned char *value, const int length);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @details The color space of the image is ARGB8888.
- * @param[in] id The ID of the item
- * @param[in] width The width of the image
- * @param[in] height The height of the image
- * @param[in] value The raw data of the image
- * @param[in] length The size of the raw data
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @details The color space of the image is ARGB8888.
+ * @param[in] id The ID of the item
+ * @param[in] width The width of the image
+ * @param[in] height The height of the image
+ * @param[in] value The raw data of the image
+ * @param[in] length The size of the raw data
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_set_webicon(const int id, const int width, const int height, const unsigned char *value, const int length);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id The ID of the item
- * @param[in] value The binary of the image
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] value The binary of the image
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_set_icon()
*/
EXPORT_API int bp_bookmark_adaptor_set_icon_png(const int id, const unsigned char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @details The creation time is set to the present time automatically.
- * @param[out] id The ID before calling returns the ID of an item created newly if the ID is initialized to @c -1,
- * otherwise a new item is created with the ID if the ID is a positive unique value
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @details The creation time is set to the present time automatically.
+ * @param[out] id The ID before calling returns the ID of an item created newly if the ID is initialized to @c -1,
+ * otherwise a new item is created with the ID if the ID is a positive unique value
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_easy_create()
*/
EXPORT_API int bp_bookmark_adaptor_create(int *id);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @details If cloud is on, the item is not deleted, but the is_deleted property is set.
- * However, the caller may think it has been deleted because all getting IDs functions will ignore it.
- * It will be deleted from the storage later by calling bp_bookmark_adaptor_clear_deleted_ids() in the cloud module.
+ * However, the caller may think it has been deleted because all getting IDs functions will ignore it.
+ * It will be deleted from the storage later by calling bp_bookmark_adaptor_clear_deleted_ids() in the cloud module.
* @remarks If this item is a folder, all child items are deleted too.
- * @param[in] id The ID of the item
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_clear_deleted_ids()
*/
EXPORT_API int bp_bookmark_adaptor_delete(const int id);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[out] id The ID before calling returns the ID of an item created newly if the ID is initialized to @c -1,
- * otherwise a new item is created with the ID if the ID is a positive unique value
- * @param[in] info The structure includes all the properties to set
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[out] id The ID before calling returns the ID of an item created newly if the ID is initialized to @c -1,
+ * otherwise a new item is created with the ID if the ID is a positive unique value
+ * @param[in] info The structure includes all the properties to set
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_bookmark_info_fmt
* @see bp_bookmark_adaptor_create()
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated memory of strings in the structure has to be released by the caller.
- * @param[in] id The ID of the item
- * @param[in] info The structure including all the properties
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] info The structure including all the properties
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see #bp_bookmark_info_fmt
* @see bp_bookmark_adaptor_get_info()
*/
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated memory of strings in the structure has to be released by the caller.
- * @param[in] id The ID of the item
- * @param[in] offset The value that indicates one or more properties by '|' bit masking
- * @param[in] info The structure that includes all properties
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] id The ID of the item
+ * @param[in] offset The value that indicates one or more properties by '|' bit masking
+ * @param[in] info The structure that includes all properties
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_bookmark_info_fmt
* @see bp_bookmark_adaptor_get_easy_all()
/**
* @brief Clears the allocated memory in the structure.
* @since_tizen 2.3
- * @param[in] info The structure to clear
+ * @param[in] info The structure to clear
* @return @c 0 on success
* @see #bp_bookmark_info_fmt
* @see bp_bookmark_adaptor_get_info()
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] value The absolute path to store
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] value The absolute path to store
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_restore()
*/
EXPORT_API int bp_bookmark_adaptor_backup(char *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] value The absolute path to restore
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] value The absolute path to restore
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_bookmark_adaptor_backup()
*/
EXPORT_API int bp_bookmark_adaptor_restore(char *value);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated memory (IDs) has to be released by the caller.
- * @param[out] ids The ID array
- * @param[out] count The size of the array
- * @param[in] limit The maximum number of rows to get, negative means no limitation
- * @param[in] offset The starting index to get among entire rows
- * @param[in] parent The ID of the parent folder, negative means searching all folders
- * @param[in] type The kind of items to be searched, @c 0 means bookmark, @c 1 means folder, and negative means both
- * @param[in] is_operator @c 0: made by the user @c 1: by the operator, negative means both
- * @param[in] is_editable @c 0 means read only, @c 1 means editable, negative means both
- * @param[in] order_offset A property to be sorted, default is #BP_BOOKMARK_O_DATE_CREATED
- * @param[in] ordering The way of ordering, @c 0: ASC(default) @c 1: DESC
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[out] ids The ID array
+ * @param[out] count The size of the array
+ * @param[in] limit The maximum number of rows to get, negative means no limitation
+ * @param[in] offset The starting index to get among entire rows
+ * @param[in] parent The ID of the parent folder, negative means searching all folders
+ * @param[in] type The kind of items to be searched, @c 0 means bookmark, @c 1 means folder, and negative means both
+ * @param[in] is_operator @c 0: made by the user @c 1: by the operator, negative means both
+ * @param[in] is_editable @c 0 means read only, @c 1 means editable, negative means both
+ * @param[in] order_offset A property to be sorted, default is #BP_BOOKMARK_O_DATE_CREATED
+ * @param[in] ordering The way of ordering, @c 0: ASC(default) @c 1: DESC
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @see #bp_bookmark_offset
* @see bp_bookmark_adaptor_get_cond_ids_p()
*/
-EXPORT_API int bp_bookmark_adaptor_get_ids_p
- (int **ids, int *count, const int limit, const int offset,
+EXPORT_API int bp_bookmark_adaptor_get_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const int parent, const int type,
const int is_operator, const int is_editable,
const bp_bookmark_offset order_offset, const int ordering);
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated memory (IDs) has to be released by the caller.\n
- * If the caller wants to do LIKE searching, the keyword has to have some wild card like _aa, a_a, %aa, aa%, or %aa%.
- * @param[out] ids The ID array
- * @param[out] count The size of the array
- * @param[in] properties The structure including basic conditions of the bookmark
+ * If the caller wants to do LIKE searching, the keyword has to have some wild card like _aa, a_a, %aa, aa%, or %aa%.
+ * @param[out] ids The ID array
+ * @param[out] count The size of the array
+ * @param[in] properties The structure including basic conditions of the bookmark
* @param[in] conds The structure including some conditions that are related to the period, the ordering, and the number of searched rows
- * @param[in] check_offset A property to be searched by keywords, #BP_BOOKMARK_O_TITLE, #BP_BOOKMARK_O_URL, or (#BP_BOOKMARK_O_TITLE | #BP_BOOKMARK_O_URL)
- * @param[in] keyword The string to search,
- * otherwise @c NULL to ignore searching by keyword
- * @param[in] is_like The way of searching, @c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * @param[in] check_offset A property to be searched by keywords, #BP_BOOKMARK_O_TITLE, #BP_BOOKMARK_O_URL, or (#BP_BOOKMARK_O_TITLE | #BP_BOOKMARK_O_URL)
+ * @param[in] keyword The string to search,
+ * otherwise @c NULL to ignore searching by keyword
+ * @param[in] is_like The way of searching, @c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_bookmark_property_cond_fmt
* @see #bp_bookmark_rows_cond_fmt
* @see bp_bookmark_adaptor_get_ids_p()
* @see bp_bookmark_adaptor_get_timestamp_ids_p()
*/
-EXPORT_API int bp_bookmark_adaptor_get_cond_ids_p
- (int **ids, int *count,
+EXPORT_API int bp_bookmark_adaptor_get_cond_ids_p(
+ int **ids, int *count,
bp_bookmark_property_cond_fmt *properties,
bp_bookmark_rows_cond_fmt *conds,
const bp_bookmark_offset check_offset,
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated memory (IDs) has to be released by the caller.\n
- * If the caller wants to do LIKE searching, the keyword has to have some wild card like _aa, a_a, %aa, aa%, or %aa%.
- * @param[out] ids The ID array
- * @param[out] count The size of the array
- * @param[in] properties The structure including basic conditions of the bookmark
- * @param[in] limits The structure including some conditions that are related to the period, the ordering, and the number of searched rows
- * @param[in] times The structure including some conditions for searching by time stamp
- * @param[in] times_count The size of the times array
- * @param[in] check_offset A property to be searched by keywords, #BP_BOOKMARK_O_TITLE, #BP_BOOKMARK_O_URL or (#BP_BOOKMARK_O_TITLE | #BP_BOOKMARK_O_URL)
- * @param[in] keyword The string to search,
- * otherwise @c NULL to ignore searching by keyword
- * @param[in] is_like The way of searching, @c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * If the caller wants to do LIKE searching, the keyword has to have some wild card like _aa, a_a, %aa, aa%, or %aa%.
+ * @param[out] ids The ID array
+ * @param[out] count The size of the array
+ * @param[in] properties The structure including basic conditions of the bookmark
+ * @param[in] limits The structure including some conditions that are related to the period, the ordering, and the number of searched rows
+ * @param[in] times The structure including some conditions for searching by time stamp
+ * @param[in] times_count The size of the times array
+ * @param[in] check_offset A property to be searched by keywords, #BP_BOOKMARK_O_TITLE, #BP_BOOKMARK_O_URL or (#BP_BOOKMARK_O_TITLE | #BP_BOOKMARK_O_URL)
+ * @param[in] keyword The string to search,
+ * otherwise @c NULL to ignore searching by keyword
+ * @param[in] is_like The way of searching, @c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_bookmark_property_cond_fmt
* @see #bp_bookmark_rows_cond_fmt
* @see bp_bookmark_adaptor_get_ids_p()
* @see bp_bookmark_adaptor_get_cond_ids_p()
*/
-EXPORT_API int bp_bookmark_adaptor_get_timestamp_ids_p
- (int **ids, int *count,
+EXPORT_API int bp_bookmark_adaptor_get_timestamp_ids_p(
+ int **ids, int *count,
const bp_bookmark_property_cond_fmt *properties,
const bp_bookmark_rows_fmt *limits,
const bp_bookmark_timestamp_fmt times[], const int times_count,
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks The allocated memory (IDs) has to be released by the caller.\n
- * If the caller wants to do LIKE searching, the keyword has to have some wild card like _aa, a_a, %aa, aa%, or %aa%.\n
- * Although URI addresses have a protocol or the www prefix, search engines does not exclude it.
- * @param[out] ids The ID array
- * @param[out] count The size of the array
- * @param[in] properties The structure including basic conditions of the bookmark
- * @param[in] conds The structure including some conditions that are related to the period, the ordering, and the number of searched rows
- * @param[in] check_offset A property to be searched by keywords, #BP_BOOKMARK_O_TITLE, #BP_BOOKMARK_O_URL or (#BP_BOOKMARK_O_TITLE | #BP_BOOKMARK_O_URL)
- * @param[in] keyword The string to search,
- * otherwise @c NULL to ignore searching by keyword
- * @param[in] is_like The way of searching, @c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
+ * If the caller wants to do LIKE searching, the keyword has to have some wild card like _aa, a_a, %aa, aa%, or %aa%.\n
+ * Although URI addresses have a protocol or the www prefix, search engines does not exclude it.
+ * @param[out] ids The ID array
+ * @param[out] count The size of the array
+ * @param[in] properties The structure including basic conditions of the bookmark
+ * @param[in] conds The structure including some conditions that are related to the period, the ordering, and the number of searched rows
+ * @param[in] check_offset A property to be searched by keywords, #BP_BOOKMARK_O_TITLE, #BP_BOOKMARK_O_URL or (#BP_BOOKMARK_O_TITLE | #BP_BOOKMARK_O_URL)
+ * @param[in] keyword The string to search,
+ * otherwise @c NULL to ignore searching by keyword
+ * @param[in] is_like The way of searching, @c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_bookmark_property_cond_fmt
* @see #bp_bookmark_rows_cond_fmt
* @see #bp_bookmark_offset
*/
-EXPORT_API int bp_bookmark_adaptor_get_raw_retrieved_ids_p
- (int **ids, int *count,
+EXPORT_API int bp_bookmark_adaptor_get_raw_retrieved_ids_p(
+ int **ids, int *count,
bp_bookmark_property_cond_fmt *properties,
bp_bookmark_rows_cond_fmt *conds,
const bp_bookmark_offset check_offset,
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @return @c 0 on success,
- * otherwise @c -1 is returned and the error code is set to indicate the error
-*/
+ * @return @c 0 on success,
+ * otherwise @c -1 is returned and the error code is set to indicate the error
+ */
EXPORT_API int bp_bookmark_adaptor_reset(void);
/**
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks Allocated memory (ids) has to be released by caller.
- * @param[out] ids Id array
- * @param[out] count The size of array
+ * @param[out] ids Id array
+ * @param[out] count The size of array
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
* @exception BP_BOOKMARK_ERROR_PERMISSION_DENY Permission denied by insufficient privilege
*/
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks Allocated memory (ids) has to be released by caller.
- * @param[out] ids Id array
- * @param[out] count The size of array
+ * @param[out] ids Id array
+ * @param[out] count The size of array
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
* @exception BP_BOOKMARK_ERROR_PERMISSION_DENY Permission denied by insufficient privilege
*/
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks Allocated memory (ids) has to be released by caller.
- * @param[out] ids Id array
- * @param[out] count The size of array
+ * @param[out] ids Id array
+ * @param[out] count The size of array
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
* @exception BP_BOOKMARK_ERROR_PERMISSION_DENY Permission denied by insufficient privilege
*/
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @details If cloud is on, "is_dirty" property is off by calling delete function \n
- * if cloud is off, a bookmark is deleted really from storage whenever calling delete function.
+ * if cloud is off, a bookmark is deleted really from storage whenever calling delete function.
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
* @exception BP_BOOKMARK_ERROR_PERMISSION_DENY Permission denied by insufficient privilege
*/
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks Allocated string memory has to be released by caller.
- * @param[in] id Id of an item
- * @param[out] value String
+ * @param[in] id Id of an item
+ * @param[out] value String
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
* @exception BP_BOOKMARK_ERROR_PERMISSION_DENY Permission denied by insufficient privilege
* @see bp_bookmark_adaptor_set_sync()
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
- * @param[in] id Id of an item
- * @param[in] value String
+ * @param[in] id Id of an item
+ * @param[in] value String
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
* @exception BP_BOOKMARK_ERROR_PERMISSION_DENY Permission denied by insufficient privilege
* @see bp_bookmark_adaptor_get_sync()
* @privlevel platform
* @privilege %http://tizen.org/privilege/bookmark.admin
* @remarks Allocated memory (ids) have to be released by caller.
- * @param[out] ids Id array
- * @param[out] count The size of array
+ * @param[out] ids Id array
+ * @param[out] count The size of array
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
*/
EXPORT_API int bp_bookmark_adaptor_get_full_ids_p(int **ids, int *count);
${CMAKE_SOURCE_DIR}/common-adaptor/common-adaptor.c
${CMAKE_SOURCE_DIR}/provider/browser-provider-shm.c
${CMAKE_SOURCE_DIR}/provider/browser-provider-socket.c
- ${CMAKE_CURRENT_SOURCE_DIR}/bookmark-csc-adaptor.c )
+ ${CMAKE_CURRENT_SOURCE_DIR}/bookmark-csc-adaptor.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bookmark_csc_adaptor_pkgs_LDFLAGS} ${BOOKMARK_LINK_LIBRARIES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PKG_VERSION})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0)
if (bookmark_csc_initialize() < 0) {\
TRACE_ERROR("[CHECK connection]");\
return -1;\
- }\
-} while(0)
+ } \
+} while (0)
static bp_adaptor_defs *g_adaptorinfo = NULL;
static pthread_mutex_t g_adaptor_mutex = PTHREAD_MUTEX_INITIALIZER;
return ret;
}
-static int __bp_bookmark_csc_get_ids_p
- (int **ids, int *count, const int limit, const int offset,
+static int __bp_bookmark_csc_get_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const int parent, const int type,
const int is_operator, const int is_editable,
const bp_bookmark_offset order_offset, const int ordering)
}
if (bp_ipc_send_custom_type(sock, &conds,
- sizeof(bp_db_base_conds_fmt)) < 0 ||
+ sizeof(bp_db_base_conds_fmt)) < 0 ||
bp_adaptor_ipc_send_int(sock, parent) < 0 ||
bp_adaptor_ipc_send_int(sock, type) < 0 ||
bp_adaptor_ipc_send_int(sock, is_operator) < 0 ||
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if(ids_count >= BP_MAX_IDS_COUNT || ids_count <= 0) {
- pthread_mutex_unlock(&g_adaptor_mutex);
- return -1;
+ if (ids_count >= BP_MAX_IDS_COUNT || ids_count <= 0) {
+ pthread_mutex_unlock(&g_adaptor_mutex);
+ return -1;
} else {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
return 0;
}
-int __bp_bookmark_csc_get_retrieved_ids_p
- (int **ids, int *count, const int limit, const int offset,
+int __bp_bookmark_csc_get_retrieved_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const int parent, const int type,
const int is_operator, const int is_editable,
const bp_bookmark_offset order_column_offset, const int ordering,
bp_bookmark_offset oflags = check_column_offset;
if (bp_ipc_send_custom_type(sock, &conds,
- sizeof(bp_db_base_conds_fmt)) < 0 ||
+ sizeof(bp_db_base_conds_fmt)) < 0 ||
bp_adaptor_ipc_send_int(sock, parent) < 0 ||
bp_adaptor_ipc_send_int(sock, type) < 0 ||
bp_adaptor_ipc_send_int(sock, is_operator) < 0 ||
}
g_bp_command.cmd = BP_CMD_NONE;
g_bp_command.id = -1;
- if(g_adaptorinfo != NULL) {
- g_bp_command.cid = g_adaptorinfo->cid;
- } else {
- g_bp_command.cid = 0;
- }
+ if (g_adaptorinfo != NULL)
+ g_bp_command.cid = g_adaptorinfo->cid;
+ else
+ g_bp_command.cid = 0;
}
pthread_mutex_unlock(&g_adaptor_mutex);
return 0;
int bookmark_csc_get_errorcode(void)
{
- switch(errorcode) {
+ switch (errorcode) {
case BP_ERROR_INVALID_PARAMETER:
return BOOKMARK_CSC_ERROR_INVALID_PARAMETER;
case BP_ERROR_OUT_OF_MEMORY:
pthread_mutex_unlock(&g_adaptor_mutex);
__bookmark_csc_get_string(id, BP_CMD_COMMON_GET_TITLE,
&info->title);
- if(info->type == BOOKMARK_CSC_TYPE_BOOKMARK)
- __bookmark_csc_get_string(id, BP_CMD_COMMON_GET_URL,
- &info->url);
+ if (info->type == BOOKMARK_CSC_TYPE_BOOKMARK)
+ __bookmark_csc_get_string(id, BP_CMD_COMMON_GET_URL, &info->url);
+
return 0;
}
int bookmark_csc_get_full_ids_p(bookmark_csc_type_defs type, int **ids, int *count)
{
- return __bp_bookmark_csc_get_ids_p
- (ids, count, -1, 0, -1, type, 1, -1,
+ return __bp_bookmark_csc_get_ids_p(
+ ids, count, -1, 0, -1, type, 1, -1,
BP_BOOKMARK_O_DATE_CREATED, 0);
}
{
if (parent < 0)
return -1;
- return __bp_bookmark_csc_get_ids_p
- (ids, count, -1, 0, parent, -1, 1, -1,
+ return __bp_bookmark_csc_get_ids_p(
+ ids, count, -1, 0, parent, -1, 1, -1,
BP_BOOKMARK_O_DATE_CREATED, 0);
}
return 0;
}
-int bookmark_csc_get_duplicated_title_ids_p
- (int **ids, int *count, const int limit, const int offset,
+int bookmark_csc_get_duplicated_title_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const int parent, const int type,
const int is_operator, const int is_editable,
const int ordering,
const char *title, const int is_like)
{
- return __bp_bookmark_csc_get_retrieved_ids_p
- (ids, count, limit, offset, parent, type, -1, -1,
+ return __bp_bookmark_csc_get_retrieved_ids_p(
+ ids, count, limit, offset, parent, type, -1, -1,
BP_BOOKMARK_O_DATE_CREATED, ordering,
BP_BOOKMARK_O_TITLE,
title, is_like);
* @brief Enumeration for the kinds of item.
*/
typedef enum {
- BOOKMARK_CSC_TYPE_BOOKMARK = 0, /**< Bookmark type data for embedded */
+ BOOKMARK_CSC_TYPE_BOOKMARK = 0, /**< Bookmark type data for embedded */
BOOKMARK_CSC_TYPE_FOLDER = 1 /**< Folder type data */
} bookmark_csc_type_defs;
/**
* @brief The structure including the variables for all properties.
* @remarks Caller has to initialize the structure before using it.\n
- * Caller has to free the memory allocated for the structure by bookmark_csc_get_info().
+ * Caller has to free the memory allocated for the structure by bookmark_csc_get_info().
*/
typedef struct {
bookmark_csc_type_defs type; /**< Type 0:bookmark, 1:folder */
* @brief Creates or updates item using the structure.
* @remarks If type in the info structure is 1 (folder), ignore URL.
* @param[out] id before calling, returned id of an item created newly if id is initialized to -1
- * otherwise, new item is created with id if id is positive unique value
+ * otherwise, new item is created with id if id is positive unique value
* @param[in] info The structure that includes all properties that caller want to set
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
* @pre The structure have to be initialized to 0, then use the variables that caller want to change.
/**
* @brief Gets an id array and the number of rows of items searched by title from the storage.
* @remarks Allocated memory (ids) have to be released by caller.
- * If caller want to do LIKE searching, keyword have to have some wild card like _aa, a_a, %aa, aa% or %aa%.
+ * If caller want to do LIKE searching, keyword have to have some wild card like _aa, a_a, %aa, aa% or %aa%.
* @param[out] ids Id array
* @param[out] count The size of array
* @param[in] limit The maximum number of rows wanted to be returned, negative means no limitation
* @param[in] is_like Ordering the way of searching, 1 means LIKE, 0 means EQUAL and negative means NOT EQUAL
* @return 0 on success, otherwise, -1 is returned and error code is set to indicate the error
*/
-EXPORT_API int bookmark_csc_get_duplicated_title_ids_p
- (int **ids, int *count, const int limit, const int offset,
+EXPORT_API int bookmark_csc_get_duplicated_title_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const int parent, const int type,
const int is_operator, const int is_editable,
const int ordering,
} bp_image_fmt;
static void __read_png_data_callback(png_structp png_ptr,
- png_byte *raw_data, png_size_t read_length) {
+ png_byte *raw_data, png_size_t read_length)
+{
bp_image_fmt *handle = png_get_io_ptr(png_ptr);
const png_byte *ptr = handle->data + handle->size;
memcpy(raw_data, ptr, read_length);
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_set_bgr(png_ptr);
png_bytep *row_pointers = malloc((size_t)(height * sizeof(png_bytep)));
- if (row_pointers == NULL){
+ if (row_pointers == NULL) {
TRACE_ERROR("malloc failed");
png_destroy_write_struct(&png_ptr, &info_ptr);
free(png_buffer);
return -1;
}
int j = 0;
- for (j = 0;j < height; j++)
+ for (j = 0; j < height; j++)
row_pointers[j] = (png_bytep)(raw_data + (j * width * 4));
png_set_rows(png_ptr, info_ptr, (png_bytepp)row_pointers);
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
// Add alpha channel, if there is none.
- // Rationale: GL_RGBA is faster than GL_RGB on many GPUs)
- if (color_type == PNG_COLOR_TYPE_PALETTE ||
+ // Rationale: GL_RGBA is faster than GL_RGB on many GPUs)
+ if (color_type == PNG_COLOR_TYPE_PALETTE ||
color_type == PNG_COLOR_TYPE_RGB) {
png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
ret = 0;
}
}
- png_destroy_read_struct(&png_ptr, &info_ptr,(png_infopp)0);
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)0);
return ret;
}
struct timeval tv_timeo = { 3, 500000 }; //3.5 second
if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv_timeo,
- sizeof( tv_timeo ) ) < 0) {
+ sizeof(tv_timeo)) < 0) {
TRACE_ERROR("[CRITICAL] setsockopt SO_RCVTIMEO");
close(sockfd);
return -1;
bzero(&clientaddr, sizeof(clientaddr));
clientaddr.sun_family = AF_UNIX;
- memset(clientaddr.sun_path, 0x00, sizeof(clientaddr.sun_path));
- strncpy(clientaddr.sun_path, IPC_SOCKET, strlen(IPC_SOCKET));
+ strncpy(clientaddr.sun_path, IPC_SOCKET, sizeof(clientaddr.sun_path));
clientaddr.sun_path[strlen(IPC_SOCKET)] = '\0';
- if (connect(sockfd,
- (struct sockaddr *)&clientaddr, sizeof(clientaddr)) < 0) {
+ if (connect(sockfd, (struct sockaddr*)&clientaddr,
+ sizeof(clientaddr)) < 0) {
close(sockfd);
return -1;
}
int length = strlen(str);
if (length < 1)
TRACE_ERROR("not null, but length is 0");
- else if(length > BP_MAX_STR_LEN)
+ else if (length > BP_MAX_STR_LEN)
TRACE_ERROR("length is more long than %d", BP_MAX_STR_LEN);
else
return length;
{
if (adaptorinfo != NULL) {
close(adaptorinfo->cmd_socket);
- adaptorinfo->cmd_socket= -1;
+ adaptorinfo->cmd_socket = -1;
if (adaptorinfo->notify > 0) {
close(adaptorinfo->notify);
- adaptorinfo->notify= -1;
+ adaptorinfo->notify = -1;
}
}
bp_shm_free(&adaptorinfo->shm);
if (ipcinfo != NULL) {
int connect_retry = 10;
ipcinfo->cmd_socket = -1;
- while(ipcinfo->cmd_socket < 0 && connect_retry-- > 0) {
+ while (ipcinfo->cmd_socket < 0 && connect_retry-- > 0)
ipcinfo->cmd_socket = __adaptor_create_socket();
- }
+
if (ipcinfo->cmd_socket < 0) {
TRACE_ERROR("[CRITICAL] connect system error");
free(ipcinfo);
bp_error_defs errorcode = BP_ERROR_NONE;
bp_command_defs cmd = BP_CMD_INITIALIZE;
if (bp_ipc_send_custom_type(ipcinfo->cmd_socket, &cmd,
- sizeof(bp_command_defs)) < 0 ||
+ sizeof(bp_command_defs)) < 0 ||
bp_ipc_send_custom_type(ipcinfo->cmd_socket, &client_type,
- sizeof(bp_client_type_defs)) < 0) {
+ sizeof(bp_client_type_defs)) < 0) {
TRACE_ERROR("[CRITICAL] failed to send data to provider");
close(ipcinfo->cmd_socket);
free(ipcinfo);
}
errorcode = bp_ipc_read_errorcode(ipcinfo->cmd_socket);
int retry_count = BP_MAX_RETRY_COUNT;
- while((errorcode == BP_ERROR_IO_ERROR) && (errno == EINTR || errno == EAGAIN || errno == EINPROGRESS) && retry_count > 0) {
+ while ((errorcode == BP_ERROR_IO_ERROR) && (errno == EINTR || errno == EAGAIN || errno == EINPROGRESS) && retry_count > 0) {
TRACE_ERROR("provider not alive, retry count [%d]", retry_count);
retry_count--;
struct timespec ts;
}
if (fd >= 0 && write(fd, &value, sizeof(int)) < 0) {
- if (errno == EPIPE) {
+ if (errno == EPIPE)
TRACE_ERROR("[EPIPE] Broken Pipe errno [%d]", errno);
- } else if (errno == EAGAIN) {
+ else if (errno == EAGAIN)
TRACE_ERROR("[EAGAIN] Resource temporarily unavailable errno [%d]", errno);
- } else {
+ else
TRACE_ERROR("errno [%d]", errno);
- }
+
return -1;
}
return 0;
return -1;
}
*ids = idlist;
- return ids_count;
+ return ids_count;
+ } else if (ids_count >= BP_MAX_IDS_COUNT) {
+ TRACE_DEBUG("Count exceeded [%d]", ids_count);
+ return -1;
}
- else if (ids_count >= BP_MAX_IDS_COUNT) {
- TRACE_DEBUG("Count exceeded [%d]", ids_count);
- return -1;
- }
- return -1;
+ return -1;
}
int bp_common_adaptor_get_string(const int sock, bp_command_fmt *cmd,
{
int length = 0;
if ((bp_ipc_read_custom_type(sock, &length,
- sizeof(int)) == 0) && (length > 0) &&(length < BP_MAX_INT_COUNT)) {
+ sizeof(int)) == 0) && (length > 0) && (length < BP_MAX_INT_COUNT)) {
int trans_way = 0; // 0:socket 1:shm
if (bp_ipc_read_custom_type(sock, &trans_way,
}
*value = buffer;
} else {
- if (bp_shm_read_copy(shm, value, length) < 0) {
+ if (bp_shm_read_copy(shm, value, length) < 0)
return -1;
- }
}
}
return length;
*value = shm->mem;
}
}
- blob_width = bp_adaptor_ipc_read_int(sock);
- blob_height = bp_adaptor_ipc_read_int(sock);
- if (blob_width < 0 || blob_width > BP_MAX_INT_COUNT
- || blob_height < 0 || blob_height > BP_MAX_INT_COUNT ) {
- *errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR);
- BP_PRINT_ERROR(cmd->id, *errorcode);
- return -1;
+ blob_width = bp_adaptor_ipc_read_int(sock);
+ blob_height = bp_adaptor_ipc_read_int(sock);
+ if (blob_width < 0 || blob_width > BP_MAX_INT_COUNT
+ || blob_height < 0 || blob_height > BP_MAX_INT_COUNT) {
+ *errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR);
+ BP_PRINT_ERROR(cmd->id, *errorcode);
+ return -1;
}
*length = blob_length;
*width = blob_width;
unsigned char *buffer =
(unsigned char *)calloc(byte_length, sizeof(unsigned char));
- if (buffer == NULL){
+ if (buffer == NULL) {
*errorcode = BP_ERROR_INVALID_PARAMETER;
return -1;
}
int bp_common_adaptor_disconnect(bp_adaptor_defs **info, pthread_t *tid)
{
if (tid != NULL && (*tid > 0 && pthread_kill(*tid, 0) != ESRCH)) {
- if (pthread_cancel(*tid) != 0) {
+ if (pthread_cancel(*tid) != 0)
TRACE_ERROR("pthread:%0x", (int)*tid);
- }
+
pthread_join(*tid, NULL);
*tid = 0;
}
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
TRACE_DEBUG("Noti Listening [%d]", sock);
- while(adaptorinfo != NULL && adaptorinfo->notify >= 0) {
+ while (adaptorinfo != NULL && adaptorinfo->notify >= 0) {
// blocking fifo.
bp_command_defs provider_cmd = BP_CMD_NONE;
(*notify_cb)(*data);
}
// end protect callback sections
- pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
} // while
int bp_common_adaptor_clear_read_buffer(int sock, size_t length);
// Statement Macro
-#define BP_CHECK_PROVIDER_STATUS do {\
- pthread_mutex_lock(&g_adaptor_mutex);\
- if (__browser_adaptor_connect(1) < 0) {\
- TRACE_ERROR("[CHECK connection]");\
- pthread_mutex_unlock(&g_adaptor_mutex);\
- return -1;\
- }\
-} while(0)
+#define BP_CHECK_PROVIDER_STATUS do { \
+ pthread_mutex_lock(&g_adaptor_mutex); \
+ if (__browser_adaptor_connect(1) < 0) { \
+ TRACE_ERROR("[CHECK connection]"); \
+ pthread_mutex_unlock(&g_adaptor_mutex); \
+ return -1; \
+ } \
+} while (0)
#define BP_MAX_IDS_COUNT 512
#define BP_MAX_INT_COUNT 2147483646
* @ingroup CAPI_BROWSER_PROVIDER_MODULE
* @internal
* @defgroup CAPI_WEB_BOOKMARK_MODULE Bookmark
- * @brief The Bookmark API provides access to the storage for bookmarks managed by the browser-provider process.
+ * @brief The Bookmark API provides access to the storage for bookmarks managed by the browser-provider process.
*
* @section CAPI_WEB_BOOKMARK_MODULE_HEADER Required Header
- * \#include <web_bookmark.h>
+ * \#include <web_bookmark.h>
*
* @section CAPI_WEB_BOOKMARK_MODULE_OVERVIEW Overview
* The Bookmark API provides access to the storage for bookmarks managed by the browser-provider process.
* @brief The Bookmark_CSC API provides functions to create and manage one or more bookmarks.
*
* @section CAPI_WEB_BOOKMARK_CSC_MODULE_HEADER Required Header
- * \#include <web_bookmark_csc.h>
+ * \#include <web_bookmark_csc.h>
*
* @section CAPI_WEB_BOOKMARK_CSC_MODULE_OVERVIEW Overview
* The Bookmark_CSC API provides functions to create and manage one or more bookmarks.
${CMAKE_SOURCE_DIR}/common-adaptor/common-adaptor.c
${CMAKE_SOURCE_DIR}/provider/browser-provider-socket.c
${CMAKE_SOURCE_DIR}/provider/browser-provider-shm.c
- ${CMAKE_CURRENT_SOURCE_DIR}/history-adaptor.c )
+ ${CMAKE_CURRENT_SOURCE_DIR}/history-adaptor.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${history_adaptor_pkgs_LDFLAGS} ${BOOKMARK_LINK_LIBRARIES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PKG_VERSION})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0)
}
g_bp_command.cmd = BP_CMD_NONE;
g_bp_command.id = -1;
- if(g_adaptorinfo != NULL) {
- g_bp_command.cid = g_adaptorinfo->cid;
- } else {
- g_bp_command.cid = 0;
- }
+ if (g_adaptorinfo != NULL)
+ g_bp_command.cid = g_adaptorinfo->cid;
+ else
+ g_bp_command.cid = 0;
+
if (callback == 1 && g_adaptor_event_thread_pid <= 0) {
// create thread here ( getting event_socket )
if (pthread_create(&g_adaptor_event_thread_pid, NULL,
int bp_history_adaptor_get_errorcode(void)
{
- switch(errorcode) {
+ switch (errorcode) {
case BP_ERROR_INVALID_PARAMETER:
return BP_HISTORY_ERROR_INVALID_PARAMETER;
case BP_ERROR_OUT_OF_MEMORY:
return __bp_history_adaptor_send_cmd(id, BP_CMD_HISTORY_SET_VISIT);
}
-int bp_history_adaptor_limit_size
- (const int size, const bp_history_offset order_column_offset, const int ordering)
+int bp_history_adaptor_limit_size(
+ const int size, const bp_history_offset order_column_offset, const int ordering)
{
if (size < 0)
return -1;
return -1;
}
if (bp_ipc_send_custom_type(sock, &conds,
- sizeof(bp_db_base_conds_fmt)) < 0 ||
+ sizeof(bp_db_base_conds_fmt)) < 0 ||
bp_adaptor_ipc_send_int(sock, size) < 0) {
errorcode = BP_ERROR_IO_ERROR;
BP_PRINT_ERROR(-1, errorcode);
memset(info, 0x00, sizeof(bp_history_info_fmt));
// fill info
- if (offset & BP_HISTORY_O_FREQUENCY) {
+ if (offset & BP_HISTORY_O_FREQUENCY)
info->frequency = history.frequency;
- }
- if (offset & BP_HISTORY_O_DATE_CREATED) {
+
+ if (offset & BP_HISTORY_O_DATE_CREATED)
info->date_created = history.date_created;
- }
- if (offset & BP_HISTORY_O_DATE_MODIFIED) {
+
+ if (offset & BP_HISTORY_O_DATE_MODIFIED)
info->date_modified = history.date_modified;
- }
- if (offset & BP_HISTORY_O_DATE_VISITED) {
+
+ if (offset & BP_HISTORY_O_DATE_VISITED)
info->date_visited = history.date_visited;
- }
+
// get strings . keep the order with provider
if (offset & BP_HISTORY_O_URL) {
if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE)
- info->url = bp_ipc_read_string(sock);
+ info->url = bp_ipc_read_string(sock);
}
if (offset & BP_HISTORY_O_TITLE) {
if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE)
- info->title = bp_ipc_read_string(sock);
+ info->title = bp_ipc_read_string(sock);
}
if (offset & BP_HISTORY_O_ICON) {
info->favicon_length = 0;
return 0;
}
-int bp_history_adaptor_get_date_count
- (int *count, const bp_history_offset date_column_offset,
+int bp_history_adaptor_get_date_count(
+ int *count, const bp_history_offset date_column_offset,
const bp_history_date_defs date_type)
{
if (count == NULL)
}
bp_history_offset oflags = date_column_offset;
if (bp_ipc_send_custom_type(sock, &oflags,
- sizeof(bp_history_offset)) < 0 ||
+ sizeof(bp_history_offset)) < 0 ||
bp_adaptor_ipc_send_int(sock, date_type) < 0) {
errorcode = BP_ERROR_IO_ERROR;
BP_PRINT_ERROR(-1, errorcode);
return 0;
}
-static int __bp_history_adaptor_get_cond_ids_p
- (bp_command_defs pcommand, int **ids, int *count,
+static int __bp_history_adaptor_get_cond_ids_p(
+ bp_command_defs pcommand, int **ids, int *count,
bp_history_rows_cond_fmt *conds,
const bp_history_offset check_offset,
const char *keyword, const int is_like)
if (keyword == NULL)
oflags = 0;
if (bp_ipc_send_custom_type(sock, &t_conds,
- sizeof(bp_history_rows_cond_fmt)) < 0 ||
+ sizeof(bp_history_rows_cond_fmt)) < 0 ||
bp_ipc_send_custom_type(sock, &oflags,
- sizeof(bp_history_offset)) < 0) {
+ sizeof(bp_history_offset)) < 0) {
errorcode = BP_ERROR_IO_ERROR;
BP_PRINT_ERROR(-1, errorcode);
__browser_adaptor_disconnect();
return 0;
}
-int bp_history_adaptor_get_timestamp_ids_p
- (int **ids, int *count,
+int bp_history_adaptor_get_timestamp_ids_p(
+ int **ids, int *count,
const bp_history_rows_fmt *limits,//if NULL, ignore
const bp_history_timestamp_fmt times[], const int times_count,
const bp_history_offset check_offset, //if zero, ignore keyword search
}
if (bp_ipc_send_custom_type(sock, &t_limits,
- sizeof(bp_history_rows_fmt)) < 0 ||
+ sizeof(bp_history_rows_fmt)) < 0 ||
bp_adaptor_ipc_send_int(sock, times_count) < 0) {
errorcode = BP_ERROR_IO_ERROR;
BP_PRINT_ERROR(-1, errorcode);
return 0;
}
-int bp_history_adaptor_get_cond_ids_p
- (int **ids, int *count,
+int bp_history_adaptor_get_cond_ids_p(
+ int **ids, int *count,
bp_history_rows_cond_fmt *conds,
const bp_history_offset check_offset,
const char *keyword, const int is_like)
check_offset, keyword, is_like);
}
-int bp_history_adaptor_get_raw_retrieved_ids_p
- (int **ids, int *count,
+int bp_history_adaptor_get_raw_retrieved_ids_p(
+ int **ids, int *count,
bp_history_rows_cond_fmt *conds,
const bp_history_offset check_offset,
const char *keyword,
return __bp_history_adaptor_send_cmd(-1, BP_CMD_COMMON_RESET);
}
-int bp_history_adaptor_set_data_changed_cb
- (bp_history_adaptor_data_changed_cb callback, void *user_data)
+int bp_history_adaptor_set_data_changed_cb(
+ bp_history_adaptor_data_changed_cb callback, void *user_data)
{
if (callback == NULL) {
TRACE_ERROR("check callback address:%p", callback);
return __bp_history_adaptor_send_cmd(-1, BP_CMD_SET_NOTI_CB);
}
-int bp_history_adaptor_unset_data_changed_cb
- (bp_history_adaptor_data_changed_cb callback)
+int bp_history_adaptor_unset_data_changed_cb(
+ bp_history_adaptor_data_changed_cb callback)
{
if (callback != NULL && callback == g_adaptor_noti_cb) {
g_adaptor_noti_cb = NULL;
* @brief The structure type containing variables for all properties.
* @since_tizen 2.3
* @remarks The caller only has access to the variables which are associated with #bp_history_offset. \n
- * The caller has to initialize the structure before using it.\n
- * The caller has to free the memory of the structure allocated by bp_history_adaptor_get_info().
+ * The caller has to initialize the structure before using it.\n
+ * The caller has to free the memory of the structure allocated by bp_history_adaptor_get_info().
*/
typedef struct {
int frequency; /**< Frequency of use */
char *url; /**< Address of the visited site */
char *title; /**< Title of the visited site */
unsigned char *favicon; /**< Row data of the icon ( favorites icon ) */
- unsigned char *thumbnail; /**< Row data of the snapshot */
+ unsigned char *thumbnail; /**< Row data of the snapshot */
unsigned char *webicon; /**< Row data of the webicon */
char *sync; /**< Extra property to sync */
} bp_history_info_fmt;
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_initialize(void);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @see bp_history_adaptor_initialize()
*/
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[out] value The array containing the URI string value
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_url(const int id, char **value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The id of the item
* @param[out] value The array containing the title string value
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_title(const int id, char **value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[out] value The frequency of use
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_frequency(const int id, int *value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[out] value The timestamp value
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_date_created(const int id, int *value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[out] value The timestamp value
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_date_modified(const int id, int *value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[out] value The timestamp value
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_date_visited(const int id, int *value);
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
-* @remarks The image data value will be stored in the shared memory allocated by the browser-provider.
+ * @remarks The image data value will be stored in the shared memory allocated by the browser-provider.
* Therefore, if this API is called multiple times, image contents may be changed, but the pointer will be the same.
* PLEASE DO NOT free the 'value' parameter directly after it is assigned.
* If you want to use the image data permanently, allocate memory and make a deep copy of the data.
* @param[out] height The height of the image
* @param[out] value A pointer to the raw image data; this memory will be released automatically when the browser-provider is deinitialized
* @param[out] length The size of the raw data
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_icon(const int id, int *width, int *height, unsigned char **value, int *length);
* @param[out] height The height of the image
* @param[out] value A pointer to the raw image data; this memory will be released automatically when the browser provider is deinitialized
* @param[out] length The size of the raw data
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_snapshot(const int id, int *width, int *height, unsigned char **value, int *length);
* @param[out] height The height of the image
* @param[out] value A pointer to the raw image data; this memory will be released automatically when the browser-provider is deinitialized
* @param[out] length The size of the raw data
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_get_webicon(const int id, int *width, int *height, unsigned char **value, int *length);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[in] value The URI value
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_url(const int id, const char *value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[in] value The title value
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_title(const int id, const char *value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[in] value The frequency of use
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_frequency(const int id, const int value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[in] value The timestamp (if less than or equal to @c 0, update to current time automatically)
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_date_created(const int id, const int value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[in] value The timestamp (if less than or equal to @c 0, update to current time automatically)
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_date_modified(const int id, const int value);
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
* @param[in] value The timestamp (if less than or equal to @c 0, update to current time automatically)
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_date_visited(const int id, const int value);
* @param[in] height The height of the image
* @param[in] value The raw data of the image
* @param[in] length The size of the raw data
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_icon(const int id, const int width, const int height, const unsigned char *value, const int length);
* @param[in] height The height of the image
* @param[in] value The raw data of the image
* @param[in] length The size of the raw data
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_snapshot(const int id, const int width, const int height, const unsigned char *value, const int length);
* @param[in] height The height of the image
* @param[in] value The raw data of the image
* @param[in] length The size of the raw data
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
*/
EXPORT_API int bp_history_adaptor_set_webicon(const int id, const int width, const int height, const unsigned char *value, const int length);
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[out] id The ID of the new item (should be a positive unique value)
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @see bp_history_adaptor_delete()
*/
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[in] id The ID of the item
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @see bp_history_adaptor_set_frequency()
* @see bp_history_adaptor_set_date_visited()
* @param [in] size The size
* @param [in] order_offset A property to be sorted, default is #BP_HISTORY_O_DATE_CREATED
* @param [in] ordering The way of ordering, @c 0: ASC(default) @c 1: DESC
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1 is returned and the error code is set to indicate the error
* @see #bp_history_offset
*/
* @privilege %http://tizen.org/privilege/web-history.admin
* @param[out] id The ID of the new item (should be a positive unique value)
* @param[in] info The structure contains all properties to set
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_history_info_fmt
* @param[in] id The ID of the item
* @param[in] offset The value that indicates one or more properties by '|' bit masking
* @param[in] info The structure containing all properties
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_history_offset
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
-*/
+ */
EXPORT_API int bp_history_adaptor_reset(void);
* @see #bp_history_date_defs
*/
EXPORT_API int bp_history_adaptor_get_date_count
- (int *count, const bp_history_offset date_column_offset, const bp_history_date_defs date_type);
+(int *count, const bp_history_offset date_column_offset, const bp_history_date_defs date_type);
/**
* @brief Gets an ID array and the number of rows of items searched by the given keyword and structure.
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
* @remarks The allocated memory (IDs) has to be released by the caller.\n
- * If a caller would like to do LIKE searching, the keyword has to have a wild card like _aa, a_a, %aa, aa%, or %aa%.
+ * If a caller would like to do LIKE searching, the keyword has to have a wild card like _aa, a_a, %aa, aa%, or %aa%.
* @param[out] ids The ID array
* @param[out] count The size of the array
* @param[in] conds The structure containing conditions bound with the period, the ordering, and the number of searched rows
* @param[in] check_offset The property to search by keyword (#BP_HISTORY_O_TITLE, #BP_HISTORY_O_URL, or (#BP_HISTORY_O_TITLE | #BP_HISTORY_O_URL))
* @param[in] keyword The string to search (@c NULL value ignores searching by the keyword)
* @param[in] is_like The way of searching (@c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL)
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_history_offset
* @see #bp_history_rows_cond_fmt
* @see bp_history_adaptor_get_timestamp_ids_p()
*/
-EXPORT_API int bp_history_adaptor_get_cond_ids_p
- (int **ids, int *count,
+EXPORT_API int bp_history_adaptor_get_cond_ids_p(
+ int **ids, int *count,
bp_history_rows_cond_fmt *conds,
const bp_history_offset check_offset,
const char *keyword,
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
* @remarks The allocated memory (IDs) has to be released by the caller.
- * If a caller would like to do LIKE searching, the keyword has to have a wild card like _aa, a_a, %aa, aa%, or %aa%.
+ * If a caller would like to do LIKE searching, the keyword has to have a wild card like _aa, a_a, %aa, aa%, or %aa%.
* @param[out] ids The ID array
* @param[out] count The size of the array
* @param[in] limits The structure containing conditions bound with the period, the ordering, and the number of searched rows
* @param[in] check_offset The property to search by the given keyword (#BP_HISTORY_O_TITLE, #BP_HISTORY_O_URL, or (#BP_HISTORY_O_TITLE | #BP_HISTORY_O_URL))
* @param[in] keyword The string to search (@c NULL value ignores searching by the keyword)
* @param[in] is_like The way of searching (@c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL)
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_history_offset
* @see #bp_history_timestamp_fmt
* @see bp_history_adaptor_get_cond_ids_p()
*/
-EXPORT_API int bp_history_adaptor_get_timestamp_ids_p
- (int **ids, int *count,
+EXPORT_API int bp_history_adaptor_get_timestamp_ids_p(
+ int **ids, int *count,
const bp_history_rows_fmt *limits,
const bp_history_timestamp_fmt times[], const int times_count,
const bp_history_offset check_offset,
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
* @remarks The allocated memory (IDs) has to be released by the caller.\n
- * If a caller would like to do LIKE searching, the keyword has to have a wild card like _aa, a_a, %aa, aa%, or %aa%.
+ * If a caller would like to do LIKE searching, the keyword has to have a wild card like _aa, a_a, %aa, aa%, or %aa%.
* @param[out] ids The ID array
* @param[out] count The size of the array
* @param[in] conds The structure containing conditions bound with the period, the ordering, and the number of searched rows
* @param[in] check_offset The property to search by the given keyword (#BP_BOOKMARK_O_TITLE, #BP_BOOKMARK_O_URL or (#BP_BOOKMARK_O_TITLE | #BP_BOOKMARK_O_URL))
* @param[in] keyword The string to search (@c NULL value ignores searching by the keyword)
* @param[in] is_like The way of searching (@c 1 means LIKE, @c 0 means EQUAL, and negative means NOT EQUAL)
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise @c -1
* @pre First the structure has to be initialized to @c 0, then set the variables to change.
* @see #bp_history_offset
* @see #bp_history_rows_cond_fmt
*/
-EXPORT_API int bp_history_adaptor_get_raw_retrieved_ids_p
- (int **ids, int *count,
+EXPORT_API int bp_history_adaptor_get_raw_retrieved_ids_p(
+ int **ids, int *count,
bp_history_rows_cond_fmt *conds,
const bp_history_offset check_offset,
const char *keyword,
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
- * @param[in] callback The function address of the callback function to be called
- * @param[in] user_data The user data to be passed to the callback function
+ * @param[in] callback The function address of the callback function to be called
+ * @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
* otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_history_adaptor_is_setted_data_changed_cb()
* @see bp_history_adaptor_unset_data_changed_cb()
*/
-EXPORT_API int bp_history_adaptor_set_data_changed_cb
- (bp_history_adaptor_data_changed_cb callback, void *user_data);
+EXPORT_API int bp_history_adaptor_set_data_changed_cb(
+ bp_history_adaptor_data_changed_cb callback, void *user_data);
/**
* @since_tizen 2.3
* @privlevel platform
* @privilege %http://tizen.org/privilege/web-history.admin
- * @param[in] callback The function address of the callback function to be called
+ * @param[in] callback The function address of the callback function to be called
* @return @c 0 on success,
* otherwise @c -1 is returned and the error code is set to indicate the error
* @see bp_history_adaptor_is_setted_data_changed_cb()
* @see bp_history_adaptor_set_data_changed_cb()
*/
-EXPORT_API int bp_history_adaptor_unset_data_changed_cb
- (bp_history_adaptor_data_changed_cb callback);
+EXPORT_API int bp_history_adaptor_unset_data_changed_cb(
+ bp_history_adaptor_data_changed_cb callback);
/**
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-bookmarks.c
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-history.c
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-requests-manager.c
- ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-main.c )
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-main.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${browser_provider_pkgs_LDFLAGS} ${browser_provider_booting_done_pkgs_LDFLAGS} ${BP_LINK_LIBRARIES})
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BIN_INSTALL_DIR})
char *date_cond = NULL;
char *delete_cond = NULL;
if (is_deleted >= 0)
- delete_cond = sqlite3_mprintf("%s IS %d", BP_DB_COMMON_COL_IS_DELETED,
- is_deleted);
+ delete_cond = sqlite3_mprintf("%s IS %d", BP_DB_COMMON_COL_IS_DELETED, is_deleted);
if (date_type == BP_BOOKMARK_DATE_TODAY) {
date_cond =
sqlite3_mprintf("DATE(%s) = DATE('now')", checkcolumn);
checkcolumn, checkcolumn);
} else if (date_type == BP_BOOKMARK_DATE_OLDER) {
date_cond =
- sqlite3_mprintf("DATE(%s) <= DATE('now', '-2 months')",
- checkcolumn);
+ sqlite3_mprintf("DATE(%s) <= DATE('now', '-2 months')", checkcolumn);
}
if (delete_cond != NULL && date_cond != NULL)
static char *__get_operator(bp_bookmark_timestamp_op_defs op)
{
- switch(op) {
+ switch (op) {
case BP_BOOKMARK_OP_NOT_EQUAL: // !=
return "IS NOT";
case BP_BOOKMARK_OP_GREATER: // >
} else {
if (raw_search == 0 && (check_offset & BP_BOOKMARK_O_URL)) {
errorcode = bp_common_get_duplicated_url_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
- conds.limit, conds.offset,
- order_column, conds.ordering, is_like, keyword, conditions);
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
+ conds.limit, conds.offset,
+ order_column, conds.ordering, is_like, keyword, conditions);
} else {
char *checkcolumn = NULL;
- if (check_offset & BP_BOOKMARK_O_TITLE) {
+ if (check_offset & BP_BOOKMARK_O_TITLE)
checkcolumn = BP_DB_COMMON_COL_TITLE;
- } else if (check_offset & BP_BOOKMARK_O_URL) {
+ else if (check_offset & BP_BOOKMARK_O_URL)
checkcolumn = BP_DB_COMMON_COL_URL;
- } else {
+ else
errorcode = BP_ERROR_INVALID_PARAMETER;
- }
+
if (checkcolumn != NULL) {
errorcode = bp_common_get_duplicated_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
- conds.limit, conds.offset, checkcolumn,
- order_column, conds.ordering, is_like, keyword, conditions);
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
+ conds.limit, conds.offset, checkcolumn,
+ order_column, conds.ordering, is_like, keyword, conditions);
}
}
}
} else {
errorcode = bp_common_get_ids(g_db_handle, &g_db_mutex,
- BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
- conds.limit, conds.offset,
- order_column, conds.ordering, conditions);
+ BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
+ conds.limit, conds.offset,
+ order_column, conds.ordering, conditions);
}
bp_ipc_send_errorcode(sock, errorcode);
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
free(keyword);
if (conditions != NULL)
sqlite3_free(conditions);
int i = 0;
for (; i < timestamp_count; i++) {
if (bp_ipc_read_custom_type(sock, &t_timestamps[i],
- sizeof(bp_bookmark_timestamp_fmt)) < 0) {
+ sizeof(bp_bookmark_timestamp_fmt)) < 0) {
TRACE_ERROR("[ERROR] TIMESTAMPs [BP_ERROR_IO_ERROR]");
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
if (i == 0) {
conditions = sqlite3_mprintf("%s %s datetime(%ld, 'unixepoch')",
- __get_column_by_offset(t_timestamps[i].offset),
- __get_operator(t_timestamps[i].cmp_operator),
- t_timestamps[i].timestamp);
- } else {
- char *tmp_cond = sqlite3_mprintf
- (" %s (%s %s datetime(%ld, 'unixepoch'))",
- (t_timestamps[i].conds_operator == 0 ? "AND":"OR"),
__get_column_by_offset(t_timestamps[i].offset),
__get_operator(t_timestamps[i].cmp_operator),
t_timestamps[i].timestamp);
+ } else {
+ char *tmp_cond = sqlite3_mprintf
+ (" %s (%s %s datetime(%ld, 'unixepoch'))",
+ (t_timestamps[i].conds_operator == 0 ? "AND" : "OR"),
+ __get_column_by_offset(t_timestamps[i].offset),
+ __get_operator(t_timestamps[i].cmp_operator),
+ t_timestamps[i].timestamp);
if (tmp_cond != NULL) {
conditions = bp_merge_strings(conditions, tmp_cond);
sqlite3_free(tmp_cond);
(check_offset & BP_BOOKMARK_O_URL)) {
// inquired
errorcode = bp_common_get_inquired_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids,
- &ids_count, limits.limit, limits.offset, order_column,
- limits.ordering, is_like, keyword, conditions, 0);
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids,
+ &ids_count, limits.limit, limits.offset, order_column,
+ limits.ordering, is_like, keyword, conditions, 0);
} else {
if (check_offset & BP_BOOKMARK_O_URL) {
errorcode =
} else {
errorcode = bp_common_get_ids(g_db_handle, &g_db_mutex,
- BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
- limits.limit, limits.offset,
- order_column, limits.ordering, conditions);
+ BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
+ limits.limit, limits.offset,
+ order_column, limits.ordering, conditions);
}
bp_ipc_send_errorcode(sock, errorcode);
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
free(keyword);
if (conditions != NULL)
sqlite3_free(conditions);
bp_ipc_send_errorcode(sock, BP_ERROR_NONE);
memset(&conds, 0x00, sizeof(bp_db_base_conds_fmt));
- if (bp_ipc_read_custom_type
- (sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
+ if (bp_ipc_read_custom_type(sock,
+ &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
TRACE_ERROR("[ERROR] CONDs [BP_ERROR_IO_ERROR]");
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
if ((offset & BP_BOOKMARK_O_TITLE) && (offset & BP_BOOKMARK_O_URL)) {
// inquired
errorcode = bp_common_get_inquired_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids,
- &ids_count, conds.limit, conds.offset, ordercolumn,
- conds.ordering, is_like, keyword, conditions, 0);
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids,
+ &ids_count, conds.limit, conds.offset, ordercolumn,
+ conds.ordering, is_like, keyword, conditions, 0);
} else {
if (offset & BP_BOOKMARK_O_URL) {
errorcode = bp_common_get_duplicated_url_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
- conds.limit, conds.offset,
- ordercolumn, conds.ordering, is_like, keyword, conditions);
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
+ conds.limit, conds.offset,
+ ordercolumn, conds.ordering, is_like, keyword, conditions);
} else {
if (offset & BP_BOOKMARK_O_TITLE)
checkcolumn = BP_DB_COMMON_COL_TITLE;
- else if(offset & BP_BOOKMARK_O_SYNC)
+ else if (offset & BP_BOOKMARK_O_SYNC)
checkcolumn = BP_DB_COMMON_COL_SYNC;
else
errorcode = BP_ERROR_INVALID_PARAMETER;
if (checkcolumn != NULL) {
errorcode = bp_common_get_duplicated_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
- conds.limit, conds.offset, checkcolumn, ordercolumn,
- conds.ordering, is_like, keyword, conditions);
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count,
+ conds.limit, conds.offset, checkcolumn, ordercolumn,
+ conds.ordering, is_like, keyword, conditions);
}
}
bp_ipc_send_errorcode(sock, BP_ERROR_NONE);
memset(&conds, 0x00, sizeof(bp_db_base_conds_fmt));
if (bp_ipc_read_custom_type
- (sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
+ (sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
TRACE_ERROR("[ERROR] CONDs [BP_ERROR_IO_ERROR]");
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
type, is_operator, is_editable);
char *is_deleted = NULL;
- if (conditions == NULL) {
+ if (conditions == NULL)
is_deleted = sqlite3_mprintf("(%s IS 0)", BP_DB_COMMON_COL_IS_DELETED);
- } else {
+ else
is_deleted = sqlite3_mprintf(" AND (%s IS 0)", BP_DB_COMMON_COL_IS_DELETED);
- }
+
if (is_deleted != NULL) {
conditions = bp_merge_strings(conditions, is_deleted);
sqlite3_free(is_deleted);
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
if (conditions != NULL)
sqlite3_free(conditions);
return errorcode;
BP_PRE_CHECK;
char *conditions =
- sqlite3_mprintf("(%s IS 0)", BP_DB_BOOKMARK_COL_IS_OPERATOR);
+ sqlite3_mprintf("(%s IS 0)", BP_DB_BOOKMARK_COL_IS_OPERATOR);
bp_error_defs errorcode = bp_common_get_ids(g_db_handle,
&g_db_mutex, BP_DB_TABLE_BOOKMARK, &ids, &ids_count, -1, 0,
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
if (conditions != NULL)
sqlite3_free(conditions);
return errorcode;
static bp_error_defs __check_write_permission(int id, int ctype)
{
- if (id == WEB_BOOKMARK_ROOT_ID) {
+ if (id == WEB_BOOKMARK_ROOT_ID)
return BP_ERROR_PERMISSION_DENY;
- }
bp_error_defs errorcode = BP_ERROR_NONE;
if (ctype == BP_CLIENT_BOOKMARK_SYNC) { // check is_operator
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
if (conditions != NULL)
sqlite3_free(conditions);
return errorcode;
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
if (conditions != NULL)
sqlite3_free(conditions);
return errorcode;
columns_count = 1; // default dirty
// check the number of the columns to update
- if (info.type >= 0) // if negative, ignore
+ if (info.type >= 0) // if negative, ignore
columns_count++;
if (info.parent >= 0)
columns_count++;
}
if (offset & BP_BOOKMARK_O_ICON) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_FAVICONS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.favicon_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_FAVICONS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.favicon_height = recvint;
}
if (offset & BP_BOOKMARK_O_SNAPSHOT) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.thumbnail_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.thumbnail_height = recvint;
}
if (offset & BP_BOOKMARK_O_WEBICON) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_WEBICONS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_WEBICONS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.webicon_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_WEBICONS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_WEBICONS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.webicon_height = recvint;
if (sqlite3_column_bytes(g_db_basic_get_info_stmt, 6) <= 0) {
bp_ipc_send_errorcode(sock, BP_ERROR_NO_DATA);
} else {
- char *recvstr = (char *)sqlite3_column_text
- (g_db_basic_get_info_stmt, 6);
+ char *recvstr = (char*)sqlite3_column_text(g_db_basic_get_info_stmt, 6);
bp_ipc_send_errorcode(sock, BP_ERROR_NONE);
bp_ipc_send_string(sock, recvstr);
}
TRACE_ERROR("[ERROR][SQL][%d] SET_DATE_MODIFIED", id);
}
int max_sequence = bp_db_get_cond2_int_column(g_db_handle,
- BP_DB_TABLE_BOOKMARK, BP_DB_BOOKMARK_COL_SEQUENCE_MAX,
- BP_DB_BOOKMARK_COL_PARENT, BP_DB_COL_TYPE_INT, &info.parent,
- NULL, BP_DB_COL_TYPE_NONE, NULL, &errorcode);
+ BP_DB_TABLE_BOOKMARK, BP_DB_BOOKMARK_COL_SEQUENCE_MAX,
+ BP_DB_BOOKMARK_COL_PARENT, BP_DB_COL_TYPE_INT, &info.parent,
+ NULL, BP_DB_COL_TYPE_NONE, NULL, &errorcode);
if (max_sequence > 0) {
if (bp_db_set_column(g_db_handle, id, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_SEQUENCE,
return BP_ERROR_OUT_OF_MEMORY;
}
ids_count = bp_db_get_custom_conds_ids(g_db_handle,
- BP_DB_TABLE_BOOKMARK, ids, BP_DB_COMMON_COL_ID,
- check_ids_count, 0, NULL, "ASC", conditions, &errorcode);
+ BP_DB_TABLE_BOOKMARK, ids, BP_DB_COMMON_COL_ID,
+ check_ids_count, 0, NULL, "ASC", conditions, &errorcode);
}
pthread_mutex_unlock(&g_db_mutex);
if (conditions != NULL)
type = bp_db_get_int_column(g_db_handle, id,
BP_DB_TABLE_BOOKMARK, BP_DB_BOOKMARK_COL_TYPE, &errorcode);
pthread_mutex_unlock(&g_db_mutex);
- if (type == 1) { // set deleted flag of all child
+ if (type == 1) // set deleted flag of all child
errorcode = __bp_bookmark_delete_all_childs(id, 0);
- }
+
if (errorcode == BP_ERROR_NONE) {
if (id != WEB_BOOKMARK_ROOT_ID) {
pthread_mutex_lock(&g_db_mutex);
int type = bp_db_get_int_column(g_db_handle, id,
BP_DB_TABLE_BOOKMARK, BP_DB_BOOKMARK_COL_TYPE, &errorcode);
pthread_mutex_unlock(&g_db_mutex);
- if (type == 1) { // delete all child
+ if (type == 1) // delete all child
errorcode = __bp_bookmark_delete_all_childs(id, 1);
- }
+
if (errorcode == BP_ERROR_NONE) {
pthread_mutex_lock(&g_db_mutex);
if (bp_db_remove_cond(g_db_handle, BP_DB_TABLE_BOOKMARK,
errorcode = __bp_bookmark_get_cond_ids(sock, 1);
break;
case BP_CMD_COMMON_GET_FULL_IDS:
- errorcode = bp_common_get_full_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
+ errorcode = bp_common_get_full_ids(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
break;
case BP_CMD_COMMON_GET_FULL_WITH_DELETED_IDS:
if (client->type != BP_CLIENT_BOOKMARK_SYNC) {
- errorcode = bp_common_get_full_with_deleted_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
+ errorcode = bp_common_get_full_with_deleted_ids(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
break;
}
errorcode = __bp_sync_bookmark_get_full_with_deleted_ids(sock);
case BP_CMD_COMMON_GET_DIRTY_IDS:
if (client->type != BP_CLIENT_BOOKMARK_SYNC) {
// include operator's bookmarks
- errorcode = bp_common_get_dirty_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
+ errorcode = bp_common_get_dirty_ids(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
break;
}
errorcode = __bp_sync_bookmark_get_dirty_ids(sock);
break;
case BP_CMD_COMMON_GET_DELETED_IDS:
if (client->type != BP_CLIENT_BOOKMARK_SYNC) {
- errorcode = bp_common_get_deleted_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
+ errorcode = bp_common_get_deleted_ids(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
break;
}
errorcode = __bp_sync_bookmark_get_deleted_ids(sock);
errorcode = __bp_bookmark_get_ids(sock);
break;
case BP_CMD_COMMON_CLEAR_DIRTY_IDS:
- errorcode = bp_common_clear_dirty_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
+ errorcode = bp_common_clear_dirty_ids(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock);
break;
case BP_CMD_COMMON_CLEAR_DELETED_IDS:
if (client->type != BP_CLIENT_BOOKMARK_SYNC) {
bp_ipc_send_errorcode(sock, errorcode);
break;
case BP_CMD_BOOKMARK_GET_TYPE:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_TYPE, sock, id);
break;
case BP_CMD_BOOKMARK_GET_PARENT:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_PARENT, sock, id);
break;
case BP_CMD_COMMON_GET_URL:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_URL, sock, id);
break;
case BP_CMD_COMMON_GET_TITLE:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_TITLE, sock, id);
break;
case BP_CMD_BOOKMARK_GET_SEQUENCE:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_SEQUENCE, sock, id);
break;
case BP_CMD_BOOKMARK_GET_IS_EDITABLE:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_IS_EDITABLE, sock, id);
break;
case BP_CMD_BOOKMARK_GET_IS_OPERATOR:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_IS_OPERATOR, sock, id);
break;
case BP_CMD_BOOKMARK_GET_ACCESS_COUNT:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_ACCESS_COUNT, sock, id);
break;
case BP_CMD_COMMON_GET_FAVICON:
- errorcode = bp_common_get_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_get_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_GET_FAVICON_WIDTH:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_WIDTH, sock, id);
break;
case BP_CMD_COMMON_GET_FAVICON_HEIGHT:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_GET_THUMBNAIL:
- errorcode = bp_common_get_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_get_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_GET_THUMBNAIL_WIDTH:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_WIDTH, sock, id);
break;
case BP_CMD_COMMON_GET_THUMBNAIL_HEIGHT:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_GET_ICON:
&g_db_mutex, BP_DB_TABLE_WEBICONS, sock, id, &client->shm);
break;
case BP_CMD_COMMON_GET_DATE_CREATED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DATETIME_CREATED, sock, id);
break;
case BP_CMD_COMMON_GET_DATE_MODIFIED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DATETIME_MODIFIED, sock, id);
break;
case BP_CMD_COMMON_GET_DATE_VISITED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DATETIME_VISITED, sock, id);
break;
case BP_CMD_COMMON_GET_ACCOUNT_NAME:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_ACCOUNT_NAME, sock, id);
break;
case BP_CMD_COMMON_GET_ACCOUNT_TYPE:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_ACCOUNT_TYPE, sock, id);
break;
case BP_CMD_COMMON_GET_DEVICE_NAME:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DEVICE_NAME, sock, id);
break;
case BP_CMD_COMMON_GET_DEVICE_ID:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DEVICE_ID, sock, id);
break;
case BP_CMD_COMMON_GET_SYNC:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_SYNC, sock, id);
break;
case BP_CMD_COMMON_GET_TAG:
- errorcode = bp_common_get_tag
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
+ errorcode = bp_common_get_tag(g_db_handle, &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
break;
case BP_CMD_COMMON_GET_TAG_IDS:
- errorcode = bp_common_get_tag_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
+ errorcode = bp_common_get_tag_ids(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
break;
case BP_CMD_COMMON_GET_INFO_OFFSET:
errorcode = __bp_bookmark_get_info_offset(sock, id, &client->shm);
bp_ipc_send_errorcode(sock, errorcode);
break;
}
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_TYPE, sock, id);
break;
case BP_CMD_BOOKMARK_SET_PARENT:
bp_ipc_send_errorcode(sock, errorcode);
break;
}
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_PARENT, sock, id);
break;
case BP_CMD_COMMON_SET_URL:
bp_ipc_send_errorcode(sock, errorcode);
break;
}
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_URL, sock, id);
break;
case BP_CMD_COMMON_SET_TITLE:
bp_ipc_send_errorcode(sock, errorcode);
break;
}
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_TITLE, sock, id);
break;
case BP_CMD_BOOKMARK_SET_SEQUENCE:
errorcode = __bp_bookmark_set_sequence(sock, id);
break;
case BP_CMD_BOOKMARK_SET_ACCESS_COUNT:
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_BOOKMARK_COL_ACCESS_COUNT, sock, id);
break;
case BP_CMD_COMMON_SET_FAVICON:
- errorcode = bp_common_set_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_set_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_SET_FAVICON_WIDTH:
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_SET_THUMBNAIL:
- errorcode = bp_common_set_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_set_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_SET_THUMBNAIL_WIDTH:
- errorcode = bp_common_replace_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_replace_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_WIDTH, sock, id);
break;
case BP_CMD_COMMON_SET_THUMBNAIL_HEIGHT:
- errorcode = bp_common_replace_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_replace_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_SET_ICON:
bp_ipc_send_errorcode(sock, errorcode);
break;
}
- errorcode = bp_common_set_is_deleted
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock, id);
+ errorcode = bp_common_set_is_deleted(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock, id);
break;
case BP_CMD_COMMON_SET_DATE_CREATED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DATE_CREATED, sock, id);
break;
case BP_CMD_COMMON_SET_DATE_MODIFIED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DATE_MODIFIED, sock, id);
break;
case BP_CMD_COMMON_SET_DATE_VISITED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DATE_VISITED, sock, id);
break;
case BP_CMD_COMMON_SET_ACCOUNT_NAME:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_ACCOUNT_NAME, sock, id);
break;
case BP_CMD_COMMON_SET_ACCOUNT_TYPE:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_ACCOUNT_TYPE, sock, id);
break;
case BP_CMD_COMMON_SET_DEVICE_NAME:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DEVICE_NAME, sock, id);
break;
case BP_CMD_COMMON_SET_DEVICE_ID:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_DEVICE_ID, sock, id);
break;
case BP_CMD_COMMON_SET_SYNC:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK,
BP_DB_COMMON_COL_SYNC, sock, id);
break;
case BP_CMD_COMMON_SET_TAG:
- errorcode = bp_common_set_tag
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
+ errorcode = bp_common_set_tag(g_db_handle, &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
break;
case BP_CMD_COMMON_UNSET_TAG:
- errorcode = bp_common_unset_tag
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
+ errorcode = bp_common_unset_tag(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_TAGS, sock, id);
break;
case BP_CMD_COMMON_CREATE:
- errorcode = bp_common_create
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock, id);
- if (errorcode == BP_ERROR_NONE &&
- client->type == BP_CLIENT_BOOKMARK_SYNC) {
+ errorcode = bp_common_create(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, sock, id);
+ if (errorcode == BP_ERROR_NONE && client->type == BP_CLIENT_BOOKMARK_SYNC)
__bp_bookmark_set_max_sequence(id);
- }
break;
case BP_CMD_BOOKMARK_DELETE_NO_CARE_CHILD:
// workaround API for WEBAPI TC(favorite api)
}
#ifdef SUPPORT_CLOUD_SYSTEM
if (client->type == BP_CLIENT_BOOKMARK &&
- bp_common_is_connected_my_sync_adaptor(slots,
- client->type) == 0) {
+ bp_common_is_connected_my_sync_adaptor(slots, client->type) == 0) {
errorcode = __bp_bookmark_set_is_deleted_no_care_child(sock, id);
break;
}
bp_ipc_send_errorcode(sock, errorcode);
break;
}
- errorcode = bp_common_set_dirty
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_BOOKMARK, id);
+ errorcode = bp_common_set_dirty(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_BOOKMARK, id);
break;
case BP_CMD_BOOKMARK_BACKUP:
errorcode = __bp_bookmark_backup(sock);
if (client->type == BP_CLIENT_BOOKMARK &&
bp_common_is_connected_my_sync_adaptor(slots,
client->type) == 0) { // set is_deleted
- errorcode = __bp_bookmark_delete_all_childs
- (WEB_BOOKMARK_ROOT_ID, 0);
+ errorcode = __bp_bookmark_delete_all_childs(WEB_BOOKMARK_ROOT_ID, 0);
bp_ipc_send_errorcode(sock, errorcode);
break;
}
if (handle == 0) {\
TRACE_ERROR("[HANDLE] null");\
return -1;\
- }\
+ } \
if (table == NULL) {\
TRACE_ERROR("[TABLE] null");\
return -1;\
- }\
-} while(0)
+ } \
+} while (0)
#define BP_DB_BASIC_PREPARE do {\
errorcode = sqlite3_prepare_v2(handle, query, -1, &stmt, NULL);\
*error = __get_sql_errorcode(errorcode);\
if (*error == BP_ERROR_NONE)\
*error = BP_ERROR_INVALID_PARAMETER;\
- TRACE_ERROR("[PREPARE] %d:%s", errorcode,\
- sqlite3_errmsg(handle));\
+ TRACE_ERROR("[PREPARE] %d:%s", errorcode, sqlite3_errmsg(handle));\
__bp_finalize(stmt);\
return -1;\
- }\
-} while(0)
+ } \
+} while (0)
#define BP_DB_BASIC_BIND_EXCEPTION do {\
if (errorcode != SQLITE_OK) {\
*error = __get_sql_errorcode(errorcode);\
if (*error == BP_ERROR_NONE)\
*error = BP_ERROR_INVALID_PARAMETER;\
- TRACE_ERROR("[BIND] %d:%s", errorcode,\
- sqlite3_errmsg(handle));\
+ TRACE_ERROR("[BIND] %d:%s", errorcode, sqlite3_errmsg(handle));\
__bp_finalize(stmt);\
return -1;\
- }\
-} while(0)
+ } \
+} while (0)
static bp_error_defs __get_sql_errorcode(int errorcode)
{
if (stmt != 0) {
if (sqlite3_finalize(stmt) != SQLITE_OK) {
sqlite3 *handle = sqlite3_db_handle(stmt);
- TRACE_ERROR("failed sqlite3_finalize [%s]",
- sqlite3_errmsg(handle));
+ TRACE_ERROR("failed sqlite3_finalize [%s]", sqlite3_errmsg(handle));
}
}
}
if (adaptor_type == BP_CLIENT_BOOKMARK) {
if (__check_table(handle, BP_DB_TABLE_BOOKMARK) < 0) {
ret = sqlite3_exec(handle, BP_SCHEMA_BOOKMARKS, 0, 0, 0);
- if (ret == SQLITE_OK) {
+ if (ret == SQLITE_OK)
ret = sqlite3_exec(handle, BP_SCHEMA_BOOKMARKS_INDEX, 0, 0, 0);
- }
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_FAVICONS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_FAVICONS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_FAVICONS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_THUMBNAILS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_THUMBNAILS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_THUMBNAILS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_WEBICONS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_WEBICONS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_WEBICONS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_TAGS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_TAGS(BP_DB_TABLE_TAGS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_TAGS(BP_DB_TABLE_TAGS, BP_DB_TABLE_BOOKMARK), 0, 0, 0);
}
} else if (adaptor_type == BP_CLIENT_HISTORY) {
if (__check_table(handle, BP_DB_TABLE_HISTORY) < 0) {
ret = sqlite3_exec(handle, BP_SCHEMA_HISTORY, 0, 0, 0);
- if (ret == SQLITE_OK) {
+ if (ret == SQLITE_OK)
ret = sqlite3_exec(handle, BP_SCHEMA_HISTORY_INDEX, 0, 0, 0);
- }
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_FAVICONS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_FAVICONS, BP_DB_TABLE_HISTORY), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_FAVICONS, BP_DB_TABLE_HISTORY), 0, 0, 0);
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_THUMBNAILS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_THUMBNAILS, BP_DB_TABLE_HISTORY), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_THUMBNAILS, BP_DB_TABLE_HISTORY), 0, 0, 0);
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_WEBICONS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_WEBICONS, BP_DB_TABLE_HISTORY), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_WEBICONS, BP_DB_TABLE_HISTORY), 0, 0, 0);
}
} else if (adaptor_type == BP_CLIENT_TABS) {
- if (__check_table(handle, BP_DB_TABLE_TABS) < 0) {
+ if (__check_table(handle, BP_DB_TABLE_TABS) < 0)
ret = sqlite3_exec(handle, BP_SCHEMA_TABS, 0, 0, 0);
- }
+
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_FAVICONS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_FAVICONS, BP_DB_TABLE_TABS), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_FAVICONS, BP_DB_TABLE_TABS), 0, 0, 0);
}
if (ret == SQLITE_OK && __check_table(handle, BP_DB_TABLE_THUMBNAILS) < 0) {
- ret = sqlite3_exec(handle, BP_SCHEMA_IMAGE(BP_DB_TABLE_THUMBNAILS, BP_DB_TABLE_TABS), 0, 0, 0);
+ ret = sqlite3_exec(handle,
+ BP_SCHEMA_IMAGE(BP_DB_TABLE_THUMBNAILS, BP_DB_TABLE_TABS), 0, 0, 0);
}
}
if (sqlite3_open_v2(database, handle, SQLITE_OPEN_READWRITE,
NULL) != SQLITE_OK) {
- TRACE_ERROR
- ("[ERROR][%s][%s]", database, sqlite3_errmsg(*handle));
+ TRACE_ERROR("[ERROR][%s][%s]", database, sqlite3_errmsg(*handle));
int errorcode = sqlite3_errcode(*handle);
*handle = 0;
if (errorcode == SQLITE_CORRUPT) { // remove & re-create
}
if (errorcode == SQLITE_CANTOPEN) {
// create empty database
- if (sqlite3_open(database, handle) != SQLITE_OK ) {
+ if (sqlite3_open(database, handle) != SQLITE_OK) {
TRACE_SECURE_INFO("failed to connect:%s", database);
unlink(database);
return -1;
sqlite3_clear_bindings(stmt);
if (sqlite3_reset(stmt) != SQLITE_OK) {
sqlite3 *handle = sqlite3_db_handle(stmt);
- TRACE_ERROR("[ERROR] reset:%s",
- sqlite3_errmsg(handle));
+ TRACE_ERROR("[ERROR] reset:%s", sqlite3_errmsg(handle));
}
}
}
}
static int __bp_sql_bind_value(sqlite3_stmt *stmt,
- bp_column_data_defs condtype, void *value, int index)
+ bp_column_data_defs condtype, void *value, int index)
{
int errorcode = SQLITE_ERROR;
int *cast_value = 0;
#endif
break;
case BP_DB_COL_TYPE_TEXT:
- errorcode = sqlite3_bind_text(stmt, index, (char *)value, -1,
- SQLITE_STATIC);
+ errorcode = sqlite3_bind_text(stmt, index, (char *)value, -1, SQLITE_STATIC);
break;
case BP_DB_COL_TYPE_DATETIME:
cast_value = value;
}
int bp_db_bind_value(sqlite3_stmt *stmt,
- bp_column_data_defs condtype, void *value, int index)
+ bp_column_data_defs condtype, void *value, int index)
{
return __bp_sql_bind_value(stmt, condtype, value, index);
}
if (timestamp <= 0) {
query = sqlite3_mprintf(
- "UPDATE %s SET %s = DATETIME('NOW') WHERE id = ?",
- table, column);
+ "UPDATE %s SET %s = DATETIME('NOW') WHERE id = ?",
+ table, column);
} else {
query = sqlite3_mprintf(
- "UPDATE %s SET %s = DATETIME(%d, 'unixepoch') WHERE id = ?",
- table, column, timestamp);
+ "UPDATE %s SET %s = DATETIME(%d, 'unixepoch') WHERE id = ?",
+ table, column, timestamp);
}
if (query == NULL) {
TRACE_ERROR("[CHECK COMBINE]");
if (ordering == NULL)
ordering = "ASC";
- char *query = sqlite3_mprintf
- ("DELETE FROM %s WHERE %s NOT IN (SELECT %s FROM %s ORDER BY %s %s LIMIT %d)",
- table, BP_DB_COMMON_COL_ID, BP_DB_COMMON_COL_ID,
- table, ordercolumn, ordering, limit_size);
+ char *query = sqlite3_mprintf(
+ "DELETE FROM %s WHERE %s NOT IN (SELECT %s FROM %s ORDER BY %s %s LIMIT %d)",
+ table, BP_DB_COMMON_COL_ID, BP_DB_COMMON_COL_ID,
+ table, ordercolumn, ordering, limit_size);
BP_DB_BASIC_PREPARE;
getcolumn = BP_DB_COMMON_COL_ID;
if (condition == NULL) {
query = sqlite3_mprintf("SELECT %s FROM %s", getcolumn, table);
- } else {
+ } else {
query = sqlite3_mprintf("SELECT %s FROM %s WHERE %s", getcolumn,
table, condition);
}
} else {
BP_DB_BASIC_PREPARE;
int i = 0;
- for (;i < bind_count; i++) {
+ for (; i < bind_count; i++) {
if (sqlite3_bind_text(stmt, (i+1), keyword, -1,
SQLITE_STATIC) != SQLITE_OK) {
TRACE_ERROR("[BIND] %s", sqlite3_errmsg(handle));
} else {
BP_DB_BASIC_PREPARE;
int i = 0;
- for (;i < bind_count; i++) {
+ for (; i < bind_count; i++) {
if (sqlite3_bind_text(stmt, (i+1), keyword, -1,
SQLITE_STATIC) != SQLITE_OK) {
TRACE_ERROR("[BIND] %s", sqlite3_errmsg(handle));
getcolumn = BP_DB_COMMON_COL_ID;
if (condition == NULL) {
query = sqlite3_mprintf("SELECT %s FROM %s", getcolumn, table);
- } else {
+ } else {
query = sqlite3_mprintf("SELECT %s FROM %s WHERE %s", getcolumn,
table, condition);
}
return -1;
}
- query = sqlite3_mprintf
- ("INSERT INTO %s (id, %s) VALUES (?, DATETIME('NOW'))",
+ query = sqlite3_mprintf("INSERT INTO %s (id, %s) VALUES (?, DATETIME('NOW'))",
table, date_column);
if (query == NULL) {
TRACE_ERROR("[CHECK COMBINE]");
}
if (column2 == NULL) {
- query = sqlite3_mprintf
- ("INSERT INTO %s (%s) VALUES (?)", table, column);
+ query = sqlite3_mprintf("INSERT INTO %s (%s) VALUES (?)", table, column);
} else {
if (column3 == NULL) {
query = sqlite3_mprintf
*error = __get_sql_errorcode(errorcode);
if (*error == BP_ERROR_NONE)
*error = BP_ERROR_INVALID_PARAMETER;
- TRACE_ERROR("[PREPARE] %d:%s", errorcode,
- sqlite3_errmsg(handle));
+ TRACE_ERROR("[PREPARE] %d:%s", errorcode, sqlite3_errmsg(handle));
__bp_finalize(stmt);
return NULL;
}
*error = __get_sql_errorcode(errorcode);
if (*error == BP_ERROR_NONE)
*error = BP_ERROR_INVALID_PARAMETER;
- TRACE_ERROR("[BIND] %d:%s", errorcode,
- sqlite3_errmsg(handle));
+ TRACE_ERROR("[BIND] %d:%s", errorcode, sqlite3_errmsg(handle));
__bp_finalize(stmt);
return NULL;
}
if (getbytes > 0) {
getstr = (char *)calloc(getbytes + 1, sizeof(char));
if (getstr != NULL) {
- memcpy(getstr, sqlite3_column_text(stmt, 0),
- getbytes * sizeof(char));
+ memcpy(getstr, sqlite3_column_text(stmt, 0), getbytes * sizeof(char));
getstr[getbytes] = '\0';
} else {
TRACE_ERROR("[MEM] allocating");
query = sqlite3_mprintf("SELECT %s FROM %s WHERE %s is ?",
column, table, condcolumn);
} else {
- query = sqlite3_mprintf
- ("SELECT %s FROM %s WHERE %s is ? AND %s is ?",
+ query = sqlite3_mprintf("SELECT %s FROM %s WHERE %s is ? AND %s is ?",
column, table, condcolumn, condcolumn2);
}
if (query == NULL) {
*error = __get_sql_errorcode(errorcode);
if (*error == BP_ERROR_NONE)
*error = BP_ERROR_INVALID_PARAMETER;
- TRACE_ERROR("[PREPARE] %d:%s", errorcode,
- sqlite3_errmsg(handle));
+ TRACE_ERROR("[PREPARE] %d:%s", errorcode, sqlite3_errmsg(handle));
__bp_finalize(stmt);
return NULL;
}
*error = __get_sql_errorcode(errorcode);
if (*error == BP_ERROR_NONE)
*error = BP_ERROR_INVALID_PARAMETER;
- TRACE_ERROR("[BIND] %d:%s", errorcode,
- sqlite3_errmsg(handle));
+ TRACE_ERROR("[BIND] %d:%s", errorcode, sqlite3_errmsg(handle));
__bp_finalize(stmt);
return NULL;
}
if (getbytes > 0) {
getstr = (char *)calloc(getbytes + 1, sizeof(char));
if (getstr != NULL) {
- memcpy(getstr, sqlite3_column_text(stmt, 0),
- getbytes * sizeof(char));
+ memcpy(getstr, sqlite3_column_text(stmt, 0), getbytes * sizeof(char));
getstr[getbytes] = '\0';
} else {
TRACE_ERROR("[MEM] allocating");
query = sqlite3_mprintf("UPDATE %s SET %s = ?", table, column);
} else {
query =
- sqlite3_mprintf
- ("UPDATE %s SET %s = ? WHERE id = ?", table, column);
+ sqlite3_mprintf("UPDATE %s SET %s = ? WHERE id = ?", table, column);
}
if (query == NULL) {
TRACE_ERROR("[CHECK COMBINE]");
*error = __get_sql_errorcode(errorcode);
if (*error == BP_ERROR_NONE)
*error = BP_ERROR_INVALID_PARAMETER;
- TRACE_ERROR("[PREPARE] %d:%s", errorcode,
- sqlite3_errmsg(handle));
+ TRACE_ERROR("[PREPARE] %d:%s", errorcode, sqlite3_errmsg(handle));
__bp_finalize(stmt);
return NULL;
}
if (errorcode == SQLITE_ROW) {
blob_length = sqlite3_column_bytes(stmt, 0);
if (blob_length > 0) {
- *data = (unsigned char *)calloc
- (blob_length, sizeof(unsigned char));
+ *data = calloc(blob_length, sizeof(unsigned char));
if (*data != NULL) {
memcpy(*data, sqlite3_column_blob(stmt, 0),
- sizeof(unsigned char) * blob_length);
+ sizeof(unsigned char) * blob_length);
} else {
TRACE_ERROR("[MEM] allocating");
*error = BP_ERROR_OUT_OF_MEMORY;
query = sqlite3_mprintf("SELECT %s FROM %s WHERE %s is ?",
column, table, condcolumn);
} else {
- query = sqlite3_mprintf
- ("SELECT %s FROM %s WHERE %s is ? AND %s is ?",
+ query = sqlite3_mprintf("SELECT %s FROM %s WHERE %s is ? AND %s is ?",
column, table, condcolumn, condcolumn2);
}
if (query == NULL) {
*getint_p = sqlite3_column_int(stmt, i);
columns[i].value = getint_p;
}
- } else if (sqlite3_column_type(stmt, i) == SQLITE_TEXT){
+ } else if (sqlite3_column_type(stmt, i) == SQLITE_TEXT) {
int getbytes = sqlite3_column_bytes(stmt, i);
columns[i].length = 0;
if (getbytes > 0) {
columns[i].length = getbytes;
}
}
- } else if (sqlite3_column_type(stmt, i) == SQLITE_BLOB){
+ } else if (sqlite3_column_type(stmt, i) == SQLITE_BLOB) {
int getbytes = sqlite3_column_bytes(stmt, i);
columns[i].length = 0;
if (getbytes > 0) {
- columns[i].value = (unsigned char *)calloc
- (getbytes, sizeof(unsigned char));
+ columns[i].value = calloc(getbytes, sizeof(unsigned char));
if (columns[i].value != NULL) {
memcpy(columns[i].value,
sqlite3_column_blob(stmt, i),
query = sqlite3_mprintf("DELETE FROM %s", table);
} else {
if (condcolumn2 == NULL) {
- query = sqlite3_mprintf
- ("DELETE FROM %s WHERE %s is ?", table, condcolumn);
+ query = sqlite3_mprintf("DELETE FROM %s WHERE %s is ?", table, condcolumn);
} else {
- query = sqlite3_mprintf
- ("DELETE FROM %s WHERE %s is ? AND %s is ?",
+ query = sqlite3_mprintf("DELETE FROM %s WHERE %s is ? AND %s is ?",
table, condcolumn, condcolumn2);
}
}
}
errorcode = sqlite3_open(path, &backup_handle);
- if(backup_handle) {
- if (errorcode == SQLITE_OK) {
- pbackup =
- sqlite3_backup_init(backup_handle, "main", handle, "main");
- if (pbackup == NULL) {
- sqlite3_close(backup_handle);
- TRACE_ERROR("[INIT]");
- return -1;
- }
- do {
- errorcode = sqlite3_backup_step(pbackup, -1);
- TRACE_SECURE_INFO("progress (%d)",
- (100 * (sqlite3_backup_pagecount(pbackup) -
- sqlite3_backup_remaining(pbackup)) /
- sqlite3_backup_pagecount(pbackup)));
- } while (errorcode == SQLITE_OK); // more pages to be copied
- sqlite3_backup_finish(pbackup);
- if (errorcode == SQLITE_DONE) { // finished
- sqlite3_close(backup_handle);
- return 0;
+ if (backup_handle) {
+ if (errorcode == SQLITE_OK) {
+ pbackup =
+ sqlite3_backup_init(backup_handle, "main", handle, "main");
+ if (pbackup == NULL) {
+ sqlite3_close(backup_handle);
+ TRACE_ERROR("[INIT]");
+ return -1;
+ }
+ do {
+ errorcode = sqlite3_backup_step(pbackup, -1);
+ TRACE_SECURE_INFO("progress (%d)",
+ (100 * (sqlite3_backup_pagecount(pbackup) -
+ sqlite3_backup_remaining(pbackup)) /
+ sqlite3_backup_pagecount(pbackup)));
+ } while (errorcode == SQLITE_OK); // more pages to be copied
+ sqlite3_backup_finish(pbackup);
+ if (errorcode == SQLITE_DONE) { // finished
+ sqlite3_close(backup_handle);
+ return 0;
+ }
}
- }
- TRACE_ERROR("[ERROR] [%s]", sqlite3_errmsg(backup_handle));
- (void)sqlite3_close(backup_handle);
- }
- else {
- TRACE_ERROR("bp_db_backup() backup_handle is NULL");
+ TRACE_ERROR("[ERROR] [%s]", sqlite3_errmsg(backup_handle));
+ (void)sqlite3_close(backup_handle);
+ } else {
+ TRACE_ERROR("bp_db_backup() backup_handle is NULL");
}
return -1;
}
}
errorcode = sqlite3_open(path, &backup_handle);
- if(backup_handle) {
- if (errorcode == SQLITE_OK) {
- pbackup =
- sqlite3_backup_init(handle, "main", backup_handle, "main");
- if (pbackup == NULL) {
- sqlite3_close(backup_handle);
- TRACE_ERROR("[INIT]");
- return -1;
- }
- do {
- errorcode = sqlite3_backup_step(pbackup, -1);
- TRACE_SECURE_INFO("progress (%d)",
- (100 * (sqlite3_backup_pagecount(pbackup) -
- sqlite3_backup_remaining(pbackup)) /
- sqlite3_backup_pagecount(pbackup)));
- } while (errorcode == SQLITE_OK); // more pages to be copied
- sqlite3_backup_finish(pbackup);
- if (errorcode == SQLITE_DONE) { // finished
- sqlite3_close(backup_handle);
- return 0;
+ if (backup_handle) {
+ if (errorcode == SQLITE_OK) {
+ pbackup =
+ sqlite3_backup_init(handle, "main", backup_handle, "main");
+ if (pbackup == NULL) {
+ sqlite3_close(backup_handle);
+ TRACE_ERROR("[INIT]");
+ return -1;
+ }
+ do {
+ errorcode = sqlite3_backup_step(pbackup, -1);
+ TRACE_SECURE_INFO("progress (%d)",
+ (100 * (sqlite3_backup_pagecount(pbackup) -
+ sqlite3_backup_remaining(pbackup)) /
+ sqlite3_backup_pagecount(pbackup)));
+ } while (errorcode == SQLITE_OK); // more pages to be copied
+ sqlite3_backup_finish(pbackup);
+ if (errorcode == SQLITE_DONE) { // finished
+ sqlite3_close(backup_handle);
+ return 0;
+ }
}
- }
- TRACE_ERROR("[ERROR] [%s]", sqlite3_errmsg(backup_handle));
- (void)sqlite3_close(backup_handle);
- }
- else {
- TRACE_ERROR("bp_db_restore() backup_handle is NULL");
- }
- return -1;
+ TRACE_ERROR("[ERROR] [%s]", sqlite3_errmsg(backup_handle));
+ (void)sqlite3_close(backup_handle);
+ } else {
+ TRACE_ERROR("bp_db_restore() backup_handle is NULL");
+ }
+ return -1;
}
char *bp_db_get_text_stmt(sqlite3_stmt* stmt, int index)
if (getstr != NULL) {
char *gettext = NULL;
gettext = sqlite3_column_text(stmt, index);
- if (gettext != NULL){
+ if (gettext != NULL) {
memcpy(getstr, gettext,
getbytes * sizeof(char));
getstr[getbytes] = '\0';
static char *__get_operator(bp_history_timestamp_op_defs op)
{
- switch(op) {
+ switch (op) {
case BP_HISTORY_OP_NOT_EQUAL: // !=
return "IS NOT";
case BP_HISTORY_OP_GREATER: // >
if (raw_search == 0 && check_offset & BP_HISTORY_O_URL) {
errorcode = bp_common_get_duplicated_url_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
- conds.limit, conds.offset,
- order_column, conds.ordering, is_like, keyword, conditions);
+ &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
+ conds.limit, conds.offset,
+ order_column, conds.ordering, is_like, keyword, conditions);
} else if (check_offset & BP_HISTORY_O_TITLE) {
char *checkcolumn = NULL;
- if (check_offset & BP_HISTORY_O_TITLE) {
+ if (check_offset & BP_HISTORY_O_TITLE)
checkcolumn = BP_DB_COMMON_COL_TITLE;
- } else if (check_offset & BP_HISTORY_O_URL) {
+ else if (check_offset & BP_HISTORY_O_URL)
checkcolumn = BP_DB_COMMON_COL_URL;
- } else {
+ else
errorcode = BP_ERROR_INVALID_PARAMETER;
- }
+
if (checkcolumn != NULL) {
errorcode = bp_common_get_duplicated_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
- conds.limit, conds.offset, BP_DB_COMMON_COL_TITLE,
- order_column, conds.ordering, is_like, keyword, conditions);
+ &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
+ conds.limit, conds.offset, BP_DB_COMMON_COL_TITLE,
+ order_column, conds.ordering, is_like, keyword, conditions);
}
}
}
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
free(keyword);
if (conditions != NULL)
sqlite3_free(conditions);
int i = 0;
for (; i < timestamp_count; i++) {
if (bp_ipc_read_custom_type(sock, &t_timestamps[i],
- sizeof(bp_history_timestamp_fmt)) < 0) {
+ sizeof(bp_history_timestamp_fmt)) < 0) {
TRACE_ERROR("[ERROR] TIMESTAMPs [BP_ERROR_IO_ERROR]");
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
if (i == 0) {
conditions = sqlite3_mprintf("%s %s datetime(%ld, 'unixepoch')",
- __get_column_by_offset(t_timestamps[i].offset),
- __get_operator(t_timestamps[i].cmp_operator),
- t_timestamps[i].timestamp);
- } else {
- char *tmp_cond = sqlite3_mprintf
- (" %s (%s %s datetime(%ld, 'unixepoch'))",
- (t_timestamps[i].conds_operator == 0 ? "AND":"OR"),
__get_column_by_offset(t_timestamps[i].offset),
__get_operator(t_timestamps[i].cmp_operator),
t_timestamps[i].timestamp);
+ } else {
+ char *tmp_cond = sqlite3_mprintf
+ (" %s (%s %s datetime(%ld, 'unixepoch'))",
+ (t_timestamps[i].conds_operator == 0 ? "AND" : "OR"),
+ __get_column_by_offset(t_timestamps[i].offset),
+ __get_operator(t_timestamps[i].cmp_operator),
+ t_timestamps[i].timestamp);
if (tmp_cond != NULL) {
conditions = bp_merge_strings(conditions, tmp_cond);
sqlite3_free(tmp_cond);
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
free(keyword);
if (conditions != NULL)
sqlite3_free(conditions);
bp_ipc_send_errorcode(sock, BP_ERROR_NONE);
memset(&conds, 0x00, sizeof(bp_db_base_conds_fmt));
- if (bp_ipc_read_custom_type
- (sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
+ if (bp_ipc_read_custom_type(sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
TRACE_ERROR("[ERROR] CONDs [BP_ERROR_IO_ERROR]");
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
if (offset & BP_HISTORY_O_URL) {
errorcode = bp_common_get_duplicated_url_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
- conds.limit, conds.offset,
- ordercolumn, conds.ordering, is_like, keyword, NULL);
+ &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
+ conds.limit, conds.offset,
+ ordercolumn, conds.ordering, is_like, keyword, NULL);
} else if (offset & BP_HISTORY_O_TITLE) {
errorcode = bp_common_get_duplicated_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
- conds.limit, conds.offset, BP_DB_COMMON_COL_TITLE,
- ordercolumn, conds.ordering, is_like, keyword, NULL);
+ &g_db_mutex, BP_DB_TABLE_HISTORY, &ids, &ids_count,
+ conds.limit, conds.offset, BP_DB_COMMON_COL_TITLE,
+ ordercolumn, conds.ordering, is_like, keyword, NULL);
} else {
errorcode = BP_ERROR_INVALID_PARAMETER;
}
bp_ipc_send_errorcode(sock, BP_ERROR_NONE);
memset(&conds, 0x00, sizeof(bp_db_base_conds_fmt));
- if (bp_ipc_read_custom_type
- (sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
+ if (bp_ipc_read_custom_type(sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
TRACE_ERROR("[ERROR] CONDs [BP_ERROR_IO_ERROR]");
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
// bob
if (offset & BP_HISTORY_O_ICON) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_FAVICONS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.favicon_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_FAVICONS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.favicon_height = recvint;
}
if (offset & BP_HISTORY_O_SNAPSHOT) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.thumbnail_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.thumbnail_height = recvint;
}
if (offset & BP_HISTORY_O_WEBICON) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_WEBICONS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_WEBICONS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.webicon_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_WEBICONS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_WEBICONS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.webicon_height = recvint;
pthread_mutex_unlock(&g_db_mutex);
return BP_ERROR_NONE;
}
-/*
+#if 0
static bp_error_defs __bp_history_delete_all_childs(int sock, int remove)
{
int is_deleted = 1;
bp_ipc_send_errorcode(sock, errorcode);
return errorcode;
}
-*/
+#endif
static bp_error_defs __bp_history_reset(int sock)
{
return errorcode;
}
-/*
+#if 0
static bp_error_defs __bp_history_set_is_deleted(int sock, int id)
{
BP_PRE_CHECK;
bp_ipc_send_errorcode(sock, errorcode);
return errorcode;
}
-*/
+#endif
static bp_error_defs __bp_history_delete(int sock, int id)
{
errorcode = __bp_history_get_duplicated_ids(sock);
break;
case BP_CMD_COMMON_GET_URL:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_URL, sock, id);
break;
case BP_CMD_COMMON_GET_TITLE:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_TITLE, sock, id);
break;
case BP_CMD_COMMON_GET_FAVICON:
- errorcode = bp_common_get_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_get_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_GET_FAVICON_WIDTH:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_WIDTH, sock, id);
break;
case BP_CMD_COMMON_GET_FAVICON_HEIGHT:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_GET_THUMBNAIL:
- errorcode = bp_common_get_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_get_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_GET_THUMBNAIL_WIDTH:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_WIDTH, sock, id);
break;
case BP_CMD_COMMON_GET_THUMBNAIL_HEIGHT:
- errorcode = bp_common_get_blob_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_get_blob_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_GET_ICON:
&g_db_mutex, BP_DB_TABLE_WEBICONS, sock, id, &client->shm);
break;
case BP_CMD_HISTORY_GET_FREQUENCY:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_HISTORY_COL_FREQUENCY, sock, id);
break;
case BP_CMD_COMMON_GET_DATE_CREATED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_DATETIME_CREATED, sock, id);
break;
case BP_CMD_COMMON_GET_DATE_MODIFIED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_DATETIME_MODIFIED, sock, id);
break;
case BP_CMD_COMMON_GET_DATE_VISITED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_DATETIME_VISITED, sock, id);
break;
case BP_CMD_COMMON_GET_INFO_OFFSET:
errorcode = __bp_history_get_info_offset(sock, id, &client->shm);
break;
case BP_CMD_HISTORY_SET_FREQUENCY:
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_HISTORY_COL_FREQUENCY, sock, id);
break;
case BP_CMD_COMMON_SET_URL:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_URL, sock, id);
break;
case BP_CMD_COMMON_SET_TITLE:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_TITLE, sock, id);
break;
case BP_CMD_COMMON_SET_FAVICON:
- errorcode = bp_common_set_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
+ errorcode = bp_common_set_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_SET_FAVICON_WIDTH:
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_SET_THUMBNAIL:
- errorcode = bp_common_set_blob
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_set_blob(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB, sock, id);
break;
case BP_CMD_COMMON_SET_THUMBNAIL_WIDTH:
- errorcode = bp_common_replace_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_replace_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_WIDTH, sock, id);
break;
case BP_CMD_COMMON_SET_THUMBNAIL_HEIGHT:
- errorcode = bp_common_replace_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
+ errorcode = bp_common_replace_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_HEIGHT, sock, id);
break;
case BP_CMD_COMMON_SET_ICON:
&g_db_mutex, BP_DB_TABLE_WEBICONS, sock, id, &client->shm);
break;
case BP_CMD_COMMON_SET_DATE_CREATED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_DATE_CREATED, sock, id);
break;
case BP_CMD_COMMON_SET_DATE_MODIFIED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_DATE_MODIFIED, sock, id);
break;
case BP_CMD_COMMON_SET_DATE_VISITED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY,
BP_DB_COMMON_COL_DATE_VISITED, sock, id);
break;
case BP_CMD_HISTORY_SET_VISIT:
errorcode = __bp_history_set_limit_size(sock);
break;
case BP_CMD_COMMON_CREATE:
- errorcode = bp_common_create
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_HISTORY, sock, id);
+ errorcode = bp_common_create(g_db_handle,
+ &g_db_mutex, BP_DB_TABLE_HISTORY, sock, id);
break;
case BP_CMD_COMMON_DELETE:
__unregister_dbus_booting_done_service();
- if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
+ if (signal(SIGCHLD, SIG_IGN) == SIG_ERR)
TRACE_ERROR("failed to register signal callback");
- }
+
pid_t child_pid = 0;
- if((child_pid = fork()) < 0 ) {
+ if ((child_pid = fork()) < 0) {
TRACE_ERROR("[ERROR] fock");
} else {
- if(child_pid == 0) {
+ if (child_pid == 0) {
execl(tzplatform_mkpath(TZ_SYS_RO_APPS, "org.tizen.browser/bin/browser"),
tzplatform_mkpath(TZ_SYS_RO_APPS, "org.tizen.browser/bin/browser"),
"precaching", NULL);
g_e_dbus_handler =
e_dbus_signal_handler_add(g_e_dbus_conn, NULL, DEVICED_PATH_CORE,
- DEVICED_INTERFACE_CORE, SIGNAL_BOOTING_DONE,
- on_changed_receive, NULL);
+ DEVICED_INTERFACE_CORE, SIGNAL_BOOTING_DONE,
+ on_changed_receive, NULL);
if (g_e_dbus_handler == NULL) {
TRACE_ERROR("e_dbus_signal_handler_add error");
return -1;
TRACE_ERROR("failed to alocalte fifo path pid:%d", (int)pid);
return NULL;
}
- if (snprintf(notify_fifo, path_size,"%s/%d", NOTIFY_DIR, pid) < 0) {
+ if (snprintf(notify_fifo, path_size, "%s/%d", NOTIFY_DIR, pid) < 0) {
TRACE_ERROR("failed to make fifo path pid:%d", (int)pid);
free(notify_fifo);
return NULL;
struct stat fifo_state;
if (stat(notify_fifo, &fifo_state) == 0) // found
unlink(notify_fifo);
- if (mkfifo(notify_fifo, 0644/*-rwrr*/) < 0) {
+
+ if (mkfifo(notify_fifo, 0644/*-rwrr*/) < 0)
TRACE_ERROR("failed to make fifo %s", notify_fifo);
- } else {
+ else
notify_fd = open(notify_fifo, O_RDWR | O_NONBLOCK, 0600);
- }
+
free(notify_fifo);
return notify_fd;
}
static void __update_client_permission(bp_client_defs *client)
{
pthread_mutex_lock(&mutex_for_cynara_check);
- if (client->cynara_clientSmack != NULL && client->cynara_session != NULL &&
- client->cynara_uid != NULL && client->privilege_label != NULL) {
- if(cynara_check(p_cynara, client->cynara_clientSmack, client->cynara_session,
- client->cynara_uid, client->privilege_label) == CYNARA_API_ACCESS_ALLOWED) {
- client->permission.read = 1;
- client->permission.write = 1;
- TRACE_ERROR("client has %s privilege.", client->privilege_label);
- } else {
- client->permission.read = 0;
- client->permission.write = 0;
- TRACE_ERROR("client does not have %s privilege.", client->privilege_label);
- }
+ if (client->cynara_clientSmack != NULL && client->cynara_session != NULL
+ && client->cynara_uid != NULL && client->privilege_label != NULL) {
+ if (cynara_check(p_cynara, client->cynara_clientSmack, client->cynara_session,
+ client->cynara_uid, client->privilege_label) == CYNARA_API_ACCESS_ALLOWED) {
+ client->permission.read = 1;
+ client->permission.write = 1;
+ TRACE_ERROR("client has %s privilege.", client->privilege_label);
+ } else {
+ client->permission.read = 0;
+ client->permission.write = 0;
+ TRACE_ERROR("client does not have %s privilege.", client->privilege_label);
+ }
} else {
- client->permission.read = 0;
- client->permission.write = 0;
- TRACE_ERROR("client value is NULL.");
+ client->permission.read = 0;
+ client->permission.write = 0;
+ TRACE_ERROR("client value is NULL.");
}
- pthread_mutex_unlock(&mutex_for_cynara_check);
+ pthread_mutex_unlock(&mutex_for_cynara_check);
}
static int __check_smack_privilege(bp_privilege_defs *permission,
if (__check_smack_privilege(&client->permission,
client_cmd.cmd) < 0) {
#ifdef SUPPORT_SERVER_PRIVILEGE
- TRACE_SECURE_ERROR
- ("[PERMISSION] [%d] Deny by Server Privilege",
- client_cmd.cmd);
+ TRACE_SECURE_ERROR("[PERMISSION] [%d] Deny by Server Privilege", client_cmd.cmd);
errorcode = BP_ERROR_PERMISSION_DENY;
bp_ipc_send_errorcode(client->cmd_socket, errorcode);
return errorcode;
#endif
}
- switch(client->type) {
+ switch (client->type) {
case BP_CLIENT_TABS:
case BP_CLIENT_TABS_SYNC:
- errorcode = bp_tabs_handle_requests
- (g_bp_slots, client, &client_cmd);
+ errorcode = bp_tabs_handle_requests(g_bp_slots, client, &client_cmd);
break;
case BP_CLIENT_BOOKMARK:
case BP_CLIENT_BOOKMARK_SYNC:
case BP_CLIENT_BOOKMARK_CSC:
- errorcode = bp_bookmark_handle_requests
- (g_bp_slots, client, &client_cmd);
+ errorcode = bp_bookmark_handle_requests(g_bp_slots, client, &client_cmd);
break;
case BP_CLIENT_HISTORY:
- errorcode = bp_history_handle_requests
- (g_bp_slots, client, &client_cmd);
+ errorcode = bp_history_handle_requests(g_bp_slots, client, &client_cmd);
break;
case BP_CLIENT_HISTORY_SYNC:
TRACE_ERROR("No Support Yet");
bp_client_defs *client = slot->client;
bp_error_defs errorcode = BP_ERROR_NONE;
if (client != NULL) {
- switch(client->type) {
+ switch (client->type) {
case BP_CLIENT_TABS:
case BP_CLIENT_TABS_SYNC:
errorcode = bp_tabs_ready_resource();
while (client != NULL && client->cmd_socket >= 0) {
- FD_ZERO(&imask );
- FD_ZERO(&emask );
+ FD_ZERO(&imask);
+ FD_ZERO(&emask);
FD_SET(client->cmd_socket, &imask);
FD_SET(client->cmd_socket, &emask);
- if (select(client->cmd_socket + 1, &imask, 0, &emask, 0) < 0 ) {
+ if (select(client->cmd_socket + 1, &imask, 0, &emask, 0) < 0) {
TRACE_ERROR("select");
break;
}
if (slot->client == NULL) {
pthread_mutex_unlock(&slot->mutex);
TRACE_ERROR("[CHECK] closed by other thread");
- pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
return 0;
}
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
client->access_time = (int)time(NULL);
errorcode = BP_ERROR_NONE;
errorcode = __handle_client_request(client);
- pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_mutex_unlock(&slot->mutex);
if (errorcode == BP_ERROR_IO_ERROR ||
}
privates->slots = bp_client_slots_new(BP_MAX_CLIENT);
if (privates->slots == NULL) {
- TRACE_ERROR("[CRITICAL] failed to alloc for slots");
+ TRACE_ERROR("[CRITICAL] failed to alloc for slots");
return ;
}
// Anyway accept client.
clientlen = sizeof(clientaddr);
int clientfd = accept(listenfd, (struct sockaddr *)&clientaddr,
- &clientlen);
+ &clientlen);
if (clientfd < 0) {
TRACE_ERROR("[CRITICAL] accept provider was crashed ?");
// provider need the time of refresh.
tv_timeo.tv_sec = 2;
tv_timeo.tv_usec = 500000;
if (setsockopt(clientfd, SOL_SOCKET, SO_RCVTIMEO, &tv_timeo,
- sizeof( tv_timeo ) ) < 0) {
+ sizeof(tv_timeo)) < 0) {
TRACE_ERROR("[CRITICAL] setsockopt SO_SNDTIMEO");
close(clientfd);
continue;
privates->slots[iter].client;
if (client != NULL) {
if (client->access_time > 0 &&
- client->access_time < oldest_time) {
+ client->access_time < oldest_time) {
oldest_time = client->access_time;
oldest_index = iter;
}
}
if (oldest_index >= 0) {
- bp_client_defs *client =
+ bp_client_defs *client =
privates->slots[oldest_index].client;
if (client != NULL) {
- TRACE_WARN
- ("clear client[%s:%d] slot:%d sock:%d",
- __print_client_type(client->type),
- client->cid, oldest_index,
- client->cmd_socket);
- if (client->cmd_socket >= 0)
- FD_CLR(client->cmd_socket, &listen_fdset);
+ TRACE_WARN("clear client[%s:%d] slot:%d sock:%d",
+ __print_client_type(client->type),
+ client->cid, oldest_index,
+ client->cmd_socket);
+ if (client->cmd_socket >= 0)
+ FD_CLR(client->cmd_socket, &listen_fdset);
}
bp_remove_client_from_slot(&privates->slots[oldest_index]);
i = oldest_index;
}
// allocation
int cid = __get_client_id(privates->slots);
- privates->slots[i].client =
- (bp_client_defs *)calloc(1,
- sizeof(bp_client_defs));
+ privates->slots[i].client = calloc(1, sizeof(bp_client_defs));
if (privates->slots[i].client == NULL) {
TRACE_ERROR("calloc, ignore this client");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_OUT_OF_MEMORY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_OUT_OF_MEMORY);
close(clientfd);
continue;
}
privates->slots[i].client->privilege_label = NULL;
// user-space-smack
- switch(client_type) {
+ switch (client_type) {
case BP_CLIENT_TABS:
case BP_CLIENT_TABS_SYNC:
privates->slots[i].client->privilege_label = SECURITY_PRIVILEGE_TAB;
}
if (privates->slots[i].client->privilege_label == NULL) {
TRACE_ERROR("client type");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_PERMISSION_DENY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_PERMISSION_DENY);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
} else if (!strcmp(privates->slots[i].client->privilege_label, "inhouse")) {
privates->slots[i].client->permission.read = 1;
privates->slots[i].client->permission.write = 1;
} else {
- if(cynara_creds_socket_get_client(clientfd, CLIENT_METHOD_SMACK,
- &(privates->slots[i].client->cynara_clientSmack)) != CYNARA_API_SUCCESS) {
+ if (cynara_creds_socket_get_client(clientfd, CLIENT_METHOD_SMACK,
+ &(privates->slots[i].client->cynara_clientSmack)) != CYNARA_API_SUCCESS) {
TRACE_ERROR("failed to create cynara client identification string");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_PERMISSION_DENY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_PERMISSION_DENY);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
- if(cynara_creds_socket_get_user(clientfd, USER_METHOD_UID,
- &(privates->slots[i].client->cynara_uid)) != CYNARA_API_SUCCESS) {
+ if (cynara_creds_socket_get_user(clientfd, USER_METHOD_UID,
+ &(privates->slots[i].client->cynara_uid)) != CYNARA_API_SUCCESS) {
TRACE_ERROR("failed to create cynara user identification string");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_PERMISSION_DENY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_PERMISSION_DENY);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
pid_t cynara_pid;
- if(cynara_creds_socket_get_pid(clientfd, &cynara_pid) != CYNARA_API_SUCCESS) {
+ if (cynara_creds_socket_get_pid(clientfd, &cynara_pid) != CYNARA_API_SUCCESS) {
TRACE_ERROR("failed to create PID string for client session");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_PERMISSION_DENY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_PERMISSION_DENY);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
- if((privates->slots[i].client->cynara_session = cynara_session_from_pid(cynara_pid)) == NULL) {
+ if ((privates->slots[i].client->cynara_session = cynara_session_from_pid(cynara_pid)) == NULL) {
TRACE_ERROR("failed to create client session");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_PERMISSION_DENY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_PERMISSION_DENY);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
__update_client_permission(privates->slots[i].client);
}
-/*
+#if 0
TRACE_INFO("[Permission] sock:%d read:%d write:%d",
clientfd,
privates->slots[i].client->permission.read,
privates->slots[i].client->permission.write);
-*/
+#endif
#ifdef SUPPORT_SERVER_PRIVILEGE
if (privates->slots[i].client->permission.read == 0 &&
- privates->slots[i].client->permission.write == 0) {
+ privates->slots[i].client->permission.write == 0) {
TRACE_ERROR("client have no privilege permission");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_PERMISSION_DENY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_PERMISSION_DENY);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
}
#ifndef SUPPORT_CLIENT_THREAD
- FD_SET(privates->slots[i].client->cmd_socket,
- &listen_fdset);
+ FD_SET(privates->slots[i].client->cmd_socket, &listen_fdset);
if (privates->slots[i].client->cmd_socket > maxfd)
maxfd = privates->slots[i].client->cmd_socket;
#endif
(void *)&privates->slots[i]) != 0) {
// check zombie client. disconnect it
TRACE_ERROR("[ERROR][main_thread] create\n");
- bp_ipc_send_errorcode(clientfd,
- BP_ERROR_OUT_OF_MEMORY);
+ bp_ipc_send_errorcode(clientfd, BP_ERROR_OUT_OF_MEMORY);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
// ok. ready to accept API of this client
bp_ipc_send_errorcode(clientfd, BP_ERROR_NONE);
- bp_ipc_send_custom_type(clientfd,
- &privates->slots[i].client->cid, sizeof(int));
+ bp_ipc_send_custom_type(clientfd, &privates->slots[i].client->cid, sizeof(int));
} else {
//Unknown case
for (i = 0; i < BP_MAX_CLIENT; i++) {
if (privates->slots[i].client == NULL)
continue;
- if (privates->slots[i].client->cmd_socket < 0){
+ if (privates->slots[i].client->cmd_socket < 0) {
TRACE_ERROR("[CRITICAL] [i] Found Bad socket", i);
bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
- if (FD_ISSET(privates->slots[i].client->cmd_socket, &rset)
- > 0) {
+ if (FD_ISSET(privates->slots[i].client->cmd_socket, &rset) > 0) {
is_timeout = 0;
privates->slots[i].client->access_time = (int)time(NULL);
- if (__handle_client_request
- (privates->slots[i].client) == BP_ERROR_IO_ERROR) {
+ if (__handle_client_request(privates->slots[i].client) == BP_ERROR_IO_ERROR) {
TRACE_ERROR("disconnect client slot:%d sock:%d", i,
privates->slots[i].client->cmd_socket);
FD_CLR(privates->slots[i].client->cmd_socket, &listen_fdset);
if (prev_timeout == 0) {
prev_timeout = now_timeout;
} else if (now_timeout < prev_timeout ||
- (now_timeout - prev_timeout) >
- (flexible_timeout + BP_CARE_CLIENT_MIN_INTERVAL)) {
+ (now_timeout - prev_timeout) >
+ (flexible_timeout + BP_CARE_CLIENT_MIN_INTERVAL)) {
TRACE_WARN("[WARN] check system date prev[%ld]now[%ld]",
prev_timeout, now_timeout);
} else {
- if ((now_timeout - prev_timeout) <
- BP_CARE_CLIENT_MIN_INTERVAL) {
+ if ((now_timeout - prev_timeout) < BP_CARE_CLIENT_MIN_INTERVAL) {
// this is error.
// terminate Process
- TRACE_ERROR
- ("[CRITICAL] Sock exception prev[%ld]now[%ld][%ld]",
- prev_timeout, now_timeout, flexible_timeout);
+ TRACE_ERROR("[CRITICAL] Sock exception prev[%ld]now[%ld][%ld]",
+ prev_timeout, now_timeout, flexible_timeout);
break;
}
}
bp_command_defs cmd = BP_CMD_COMMON_NOTI;
for (i = 0; i < BP_MAX_CLIENT; i++) {
if (slots[i].client != NULL &&
- __is_same_noti_client(slots[i].client->type, ctype) == 0 &&
- slots[i].client->notify > 0 &&
- slots[i].client->noti_enable == 1 &&
- slots[i].client->cid != except_cid) {
+ __is_same_noti_client(slots[i].client->type, ctype) == 0 &&
+ slots[i].client->notify > 0 &&
+ slots[i].client->noti_enable == 1 &&
+ slots[i].client->cid != except_cid) {
// send noti
bp_ipc_send_custom_type(slots[i].client->notify,
&cmd, sizeof(bp_command_defs));
if (type == BP_CLIENT_TABS)
search_type = BP_CLIENT_TABS_SYNC;
- else if (type == BP_CLIENT_BOOKMARK )
+ else if (type == BP_CLIENT_BOOKMARK)
search_type = BP_CLIENT_BOOKMARK_SYNC;
else if (type == BP_CLIENT_SCRAP)
search_type = BP_CLIENT_SCRAP_SYNC;
TRACE_DEBUG("SQL LOCK, try again %d", check_count);
continue;
}
- } while(id == check_id); // means duplicated id
+ } while (id == check_id); // means duplicated id
return id;
}
BP_PRE_CHECK;
- char *conditions =
- sqlite3_mprintf("(%s IS 0)", BP_DB_COMMON_COL_IS_DELETED);
+ char *conditions = sqlite3_mprintf("(%s IS 0)", BP_DB_COMMON_COL_IS_DELETED);
bp_error_defs errorcode =
bp_common_get_ids(handle, mutex, table, &ids, &ids_count, -1, 0,
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
if (conditions != NULL)
sqlite3_free(conditions);
return errorcode;
}
-bp_error_defs bp_common_get_full_with_deleted_ids
- (sqlite3 *handle, pthread_mutex_t *mutex, char *table, int sock)
+bp_error_defs bp_common_get_full_with_deleted_ids(sqlite3 *handle,
+ pthread_mutex_t *mutex, char *table, int sock)
{
BP_PRE_CHECK;
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
return errorcode;
}
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
if (conditions != NULL)
sqlite3_free(conditions);
return errorcode;
}
-bp_error_defs bp_common_get_deleted_ids
- (sqlite3 *handle, pthread_mutex_t *mutex, char *table, int sock)
+bp_error_defs bp_common_get_deleted_ids(sqlite3 *handle,
+ pthread_mutex_t *mutex, char *table, int sock)
{
BP_PRE_CHECK;
bp_ipc_send_custom_type(sock, ids, (sizeof(int) * ids_count));
}
if (ids != NULL)
- free(ids);
+ free(ids);
if (conditions != NULL)
sqlite3_free(conditions);
return errorcode;
bp_error_defs errorcode = BP_ERROR_NONE;
char *recv_str = NULL;
pthread_mutex_lock(mutex);
- recv_str = bp_db_get_cond2_text_column
- (handle, table, BP_DB_COMMON_TAGS_COL_TAG,
+ recv_str = bp_db_get_cond2_text_column(handle, table, BP_DB_COMMON_TAGS_COL_TAG,
BP_DB_COMMON_COL_ID, BP_DB_COL_TYPE_INT, &id,
BP_DB_COMMON_TAGS_COL_TAG_ID, BP_DB_COL_TYPE_INT,
&recv_int, &errorcode);
bp_shm_defs *shm)
{
bp_error_defs errorcode = BP_ERROR_NONE;
- int blob_length = bp_common_shm_get_bytes(handle, table, sock, id,
- shm, &errorcode);
+ int blob_length = bp_common_shm_get_bytes(handle, table, sock, id, shm, &errorcode);
if (blob_length <= 0) {
bp_ipc_send_errorcode(sock, BP_ERROR_NO_DATA);
} else {
// send .. the way of IPC
bp_ipc_send_custom_type(sock, &trans_way, sizeof(int));
if (trans_way == 0) {
- bp_ipc_send_custom_type(sock, shm->local,
- sizeof(unsigned char) * blob_length);
+ bp_ipc_send_custom_type(sock, shm->local, sizeof(unsigned char) * blob_length);
free(shm->local);
shm->local = NULL;
}
bp_ipc_send_custom_type(sock, &trans_way, sizeof(int));
if (trans_way == 0) {
- bp_ipc_send_custom_type(sock, shm->local,
- sizeof(unsigned char) * blob_length);
+ bp_ipc_send_custom_type(sock, shm->local, sizeof(unsigned char) * blob_length);
free(shm->local);
shm->local = NULL;
}
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
- if ( blob_length < BP_MAX_INT_COUNT && blob_length > 0) {
+ if (blob_length < BP_MAX_INT_COUNT && blob_length > 0) {
unsigned char *blob_buffer = NULL;
unsigned char *blob_data = NULL;
// read here what IPC should be used below from provider.
bp_ipc_send_custom_type(sock, &blob_length, sizeof(int));
bp_ipc_send_custom_type(sock, &width, sizeof(int));
bp_ipc_send_custom_type(sock, &height, sizeof(int));
- bp_ipc_send_custom_type(sock, blob_data,
- sizeof(unsigned char) * blob_length);
+ bp_ipc_send_custom_type(sock, blob_data, sizeof(unsigned char) * blob_length);
}
free(blob_data);
return errorcode;
return BP_ERROR_IO_ERROR;
}
pthread_mutex_lock(mutex);
- if (bp_db_get_int_column(handle, id, table, BP_DB_COMMON_COL_ID,
- &errorcode) >= 0) {
+ if (bp_db_get_int_column(handle, id, table, BP_DB_COMMON_COL_ID, &errorcode) >= 0) {
if (bp_db_set_column(handle, id, table, column,
BP_DB_COL_TYPE_INT, &recv_int, &errorcode) < 0) {
TRACE_ERROR("[ERROR][SQL][%d] %s", id, column);
}
pthread_mutex_lock(mutex);
- if (bp_db_get_int_column(handle, id, table, BP_DB_COMMON_COL_ID,
- &errorcode) >= 0) {
+ if (bp_db_get_int_column(handle, id, table, BP_DB_COMMON_COL_ID, &errorcode) >= 0) {
if (bp_db_set_column(handle, id, table, column,
BP_DB_COL_TYPE_TEXT, recv_str, &errorcode) < 0) {
TRACE_ERROR("[ERROR][SQL][%d] SET_STRING", id);
return BP_ERROR_IO_ERROR;
}
pthread_mutex_lock(mutex);
- if (bp_db_set_datetime(handle, id, table, column, recv_int,
- &errorcode) < 0) {
+ if (bp_db_set_datetime(handle, id, table, column, recv_int, &errorcode) < 0)
TRACE_ERROR("[ERROR][SQL][%d] SET_DATE", id);
- }
+
pthread_mutex_unlock(mutex);
bp_ipc_send_errorcode(sock, errorcode);
return errorcode;
int i = 0;
if (src == NULL)
return ;
- for (;i < strlen(src); i++) {
+ for (; i < strlen(src); i++) {
char c = *(src + i);
if (c >= 'A' && c <= 'Z')
*(src + i) = c - 'A' + 'a';
target = keyword;
int is_w_keyword = 0;
int keyword_length = strlen(target);
- if (keyword_length <= 5) { // www. + % in tail
+ if (keyword_length <= 5) { // www. + % in tail
int i = 0;
int w_count = 0;
is_w_keyword = 1;
// make condition.
if (cond2 == NULL) {
- basic_cond = sqlite3_mprintf("%s IS 0",
- BP_DB_COMMON_COL_IS_DELETED);
+ basic_cond = sqlite3_mprintf("%s IS 0", BP_DB_COMMON_COL_IS_DELETED);
} else {
basic_cond = sqlite3_mprintf("%s IS 0 AND %s",
BP_DB_COMMON_COL_IS_DELETED, cond2);
"%s AND (%s LIKE ? OR %s LIKE ?)",
basic_cond, BP_DB_COMMON_COL_LOWER_TITLE,
BP_DB_COMMON_COL_LOWER_URL);
- bind_count = 2;
+ bind_count = 2;
}
} else {
char *is_like_str = NULL;
return BP_ERROR_INVALID_PARAMETER;
}
- if (cond2 == NULL) {
- basic_cond = sqlite3_mprintf("%s IS 0",
- BP_DB_COMMON_COL_IS_DELETED);
- } else {
- basic_cond = sqlite3_mprintf("%s IS 0 AND %s",
- BP_DB_COMMON_COL_IS_DELETED, cond2);
- }
+ if (cond2 == NULL)
+ basic_cond = sqlite3_mprintf("%s IS 0", BP_DB_COMMON_COL_IS_DELETED);
+ else
+ basic_cond = sqlite3_mprintf("%s IS 0 AND %s", BP_DB_COMMON_COL_IS_DELETED, cond2);
+
if (basic_cond == NULL) {
TRACE_ERROR("[ERROR] make query");
return BP_ERROR_OUT_OF_MEMORY;
return BP_ERROR_INVALID_PARAMETER;
}
- if (cond2 == NULL) {
- basic_cond = sqlite3_mprintf("%s IS 0",
- BP_DB_COMMON_COL_IS_DELETED);
- } else {
- basic_cond = sqlite3_mprintf("%s IS 0 AND %s",
- BP_DB_COMMON_COL_IS_DELETED, cond2);
- }
+ if (cond2 == NULL)
+ basic_cond = sqlite3_mprintf("%s IS 0", BP_DB_COMMON_COL_IS_DELETED);
+ else
+ basic_cond = sqlite3_mprintf("%s IS 0 AND %s", BP_DB_COMMON_COL_IS_DELETED, cond2);
+
if (basic_cond == NULL) {
TRACE_ERROR("[ERROR] make query");
return BP_ERROR_OUT_OF_MEMORY;
}
if (is_like > 0) {
bp_common_convert_to_lowercase(keyword);
- conditions = sqlite3_mprintf("%s AND LOWER(%s) LIKE ?",
- basic_cond, checkcolumn);
+ conditions = sqlite3_mprintf("%s AND LOWER(%s) LIKE ?", basic_cond, checkcolumn);
} else {
conditions = sqlite3_mprintf("%s AND %s %s ?",
basic_cond, checkcolumn, (is_like == 0 ? "IS" : "IS NOT"));
pthread_mutex_lock(mutex);
int inquired_ids_count = bp_db_get_custom_conds_ids(handle, table,
- inquired_ids, BP_DB_COMMON_COL_ID, limit, offset, ordercolumn,
+ inquired_ids, BP_DB_COMMON_COL_ID, limit, offset, ordercolumn,
(ordering <= 0 ? "ASC" : "DESC"), conditions, &errorcode);
pthread_mutex_unlock(mutex);
return -1;
}
stat_ret = stat(dirpath, &dir_state);
- if (stat_ret == 0 && S_ISDIR(dir_state.st_mode)) {
+ if (stat_ret == 0 && S_ISDIR(dir_state.st_mode))
return 0;
- }
+
return -1;
}
void bp_rebuild_dir(const char *dirpath)
{
if (__bp_is_valid_dir(dirpath) < 0) {
- if (mkdir(dirpath, S_IRWXU | S_IRWXG | S_IRWXO) == 0) {
+ if (mkdir(dirpath, 0755) == 0) {
TRACE_INFO("check directory:%s", dirpath);
- if (smack_setlabel(dirpath, "_", SMACK_LABEL_ACCESS) != 0) {
+ if (smack_setlabel(dirpath, "_", SMACK_LABEL_ACCESS) != 0)
TRACE_SECURE_ERROR("failed to set smack label:%s", dirpath);
- }
} else {
TRACE_ERROR("failed to create directory:%s", dirpath);
}
errorcode = BP_ERROR_IO_ERROR;
}
} while (sock >= 0 && (errorcode == BP_ERROR_IO_EAGAIN ||
- errorcode == BP_ERROR_IO_EINTR) && (--tryagain > 0));
+ errorcode == BP_ERROR_IO_EINTR) && (--tryagain > 0));
return recv_bytes;
}
bp_error_defs bp_ipc_read_errorcode(int fd)
{
bp_error_defs errorcode = BP_ERROR_NONE;
- if (bp_ipc_recv(fd, &errorcode, sizeof(bp_error_defs),
- __FUNCTION__) <= 0)
+ if (bp_ipc_recv(fd, &errorcode, sizeof(bp_error_defs), __FUNCTION__) <= 0)
errorcode = BP_ERROR_IO_ERROR;
return errorcode;
}
bp_ipc_send_errorcode(sock, BP_ERROR_NONE);
memset(&conds, 0x00, sizeof(bp_db_base_conds_fmt));
- if (bp_ipc_read_custom_type
- (sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
+ if (bp_ipc_read_custom_type(sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0) {
TRACE_ERROR("[ERROR] CONDs [BP_ERROR_IO_ERROR]");
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
if (offset & BP_TAB_O_URL) {
errorcode = bp_common_get_duplicated_url_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_TABS, &ids, &ids_count,
- conds.limit, conds.offset,
- ordercolumn, conds.ordering, is_like, keyword, NULL);
+ &g_db_mutex, BP_DB_TABLE_TABS, &ids, &ids_count,
+ conds.limit, conds.offset,
+ ordercolumn, conds.ordering, is_like, keyword, NULL);
} else {
- if (offset & BP_TAB_O_TITLE) {
+ if (offset & BP_TAB_O_TITLE)
checkcolumn = BP_DB_COMMON_COL_TITLE;
- } else if (offset & BP_TAB_O_DEVICE_NAME) {
+ else if (offset & BP_TAB_O_DEVICE_NAME)
checkcolumn = BP_DB_COMMON_COL_DEVICE_NAME;
- } else if (offset & BP_TAB_O_DEVICE_ID) {
+ else if (offset & BP_TAB_O_DEVICE_ID)
checkcolumn = BP_DB_COMMON_COL_DEVICE_ID;
- } else {
+ else
errorcode = BP_ERROR_INVALID_PARAMETER;
- }
+
if (checkcolumn != NULL) {
errorcode = bp_common_get_duplicated_ids(g_db_handle,
- &g_db_mutex, BP_DB_TABLE_TABS, &ids, &ids_count,
- conds.limit, conds.offset, checkcolumn,
- ordercolumn, conds.ordering, is_like, keyword, NULL);
+ &g_db_mutex, BP_DB_TABLE_TABS, &ids, &ids_count,
+ conds.limit, conds.offset, checkcolumn,
+ ordercolumn, conds.ordering, is_like, keyword, NULL);
}
}
}
if (offset & BP_TAB_O_ICON) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_FAVICONS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.favicon_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_FAVICONS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_FAVICONS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.favicon_height = recvint;
}
if (offset & BP_TAB_O_SNAPSHOT) {
- int recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
+ int recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_WIDTH, &errorcode);
if (recvint > 0)
info.thumbnail_width = recvint;
- recvint = bp_db_get_int_column
- (g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
+ recvint = bp_db_get_int_column(g_db_handle, id, BP_DB_TABLE_THUMBNAILS,
BP_DB_COMMON_COL_BLOB_HEIGHT, &errorcode);
if (recvint > 0)
info.thumbnail_height = recvint;
errorcode = BP_ERROR_IO_ERROR;
}
}
- if (errorcode != BP_ERROR_NONE) {
+ if (errorcode != BP_ERROR_NONE)
goto TAB_SET_ALL_ERROR;
- }
+
// check the number of extra columns to update
if (tabinfo.is_activated >= 0)
check_id = bp_db_get_int_column(g_db_handle, id,
BP_DB_TABLE_TABS, BP_DB_COMMON_COL_ID, &errorcode);
pthread_mutex_unlock(&g_db_mutex);
- if (check_id < 0 && errorcode != BP_ERROR_ID_NOT_FOUND) {
+ if (check_id < 0 && errorcode != BP_ERROR_ID_NOT_FOUND)
goto TAB_SET_ALL_ERROR;
- }
}
errorcode = BP_ERROR_NONE;
bp_db_bind_value(g_db_basic_insert_stmt, BP_DB_COL_TYPE_TEXT, device_name, 7);
if (offset & BP_TAB_O_DEVICE_ID)
bp_db_bind_value(g_db_basic_insert_stmt, BP_DB_COL_TYPE_TEXT, device_id, 8);
+
int ret = bp_db_exec_stmt(g_db_basic_insert_stmt);
- if (ret != SQLITE_OK && ret != SQLITE_DONE) {
+ if (ret != SQLITE_OK && ret != SQLITE_DONE)
errorcode = bp_common_sql_errorcode(ret);
- }
+
bp_db_reset(g_db_basic_insert_stmt);
pthread_mutex_unlock(&g_db_mutex);
} else { // update
columns_count++;
if (tabinfo.date_modified >= 0)
columns_count++;
- if (tabinfo.index >= 0) // if negative, ignore
+ if (tabinfo.index >= 0) // if negative, ignore
columns_count++;
if (tabinfo.is_incognito >= 0)
columns_count++;
}
if (client_cmd == NULL) {
TRACE_ERROR("[ERROR] NULL Command");
- if (bp_ipc_send_errorcode(client->cmd_socket,
- BP_ERROR_INVALID_PARAMETER) < 0)
+ if (bp_ipc_send_errorcode(client->cmd_socket, BP_ERROR_INVALID_PARAMETER) < 0)
return BP_ERROR_IO_ERROR;
return BP_ERROR_INVALID_PARAMETER;
}
switch (cmd) {
case BP_CMD_COMMON_CREATE:
- errorcode = bp_common_create
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock, id);
+ errorcode = bp_common_create(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock, id);
break;
case BP_CMD_COMMON_DELETE:
break;
}
#endif
- errorcode = bp_common_delete
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock, id);
+ errorcode = bp_common_delete(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock, id);
break;
case BP_CMD_DEINITIALIZE:
if (client->type == BP_CLIENT_TABS_SYNC) {
bp_ipc_send_errorcode(sock, errorcode);
break;
case BP_CMD_COMMON_SET_IS_DELETED:
- errorcode = bp_common_set_is_deleted
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock, id);
+ errorcode = bp_common_set_is_deleted(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock, id);
break;
case BP_CMD_COMMON_GET_CONDS_ORDER_IDS: // duplicated
errorcode = __bp_tab_get_duplicated_ids(sock);
break;
case BP_CMD_COMMON_GET_FULL_IDS: // without deleted
- errorcode = bp_common_get_full_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
+ errorcode = bp_common_get_full_ids(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
break;
case BP_CMD_COMMON_GET_FULL_WITH_DELETED_IDS:
- errorcode = bp_common_get_full_with_deleted_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
+ errorcode = bp_common_get_full_with_deleted_ids(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
break;
case BP_CMD_COMMON_GET_DIRTY_IDS: // only dirty
errorcode = bp_common_get_dirty_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
+ (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
break;
case BP_CMD_COMMON_GET_DELETED_IDS:
- errorcode = bp_common_get_deleted_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
+ errorcode = bp_common_get_deleted_ids(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
break;
case BP_CMD_COMMON_CLEAR_DIRTY_IDS:
- errorcode = bp_common_clear_dirty_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
+ errorcode = bp_common_clear_dirty_ids(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
break;
case BP_CMD_COMMON_CLEAR_DELETED_IDS:
- errorcode = bp_common_clear_deleted_ids
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
+ errorcode = bp_common_clear_deleted_ids(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, sock);
break;
case BP_CMD_TABS_GET_INDEX:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
- BP_DB_TABS_COL_INDEX, sock, id);
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ BP_DB_TABS_COL_INDEX, sock, id);
break;
case BP_CMD_COMMON_GET_URL:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
- BP_DB_COMMON_COL_URL, sock, id);
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ BP_DB_COMMON_COL_URL, sock, id);
break;
case BP_CMD_COMMON_GET_TITLE:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
- BP_DB_COMMON_COL_TITLE, sock, id);
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ BP_DB_COMMON_COL_TITLE, sock, id);
break;
case BP_CMD_COMMON_GET_ICON:
errorcode = bp_common_get_blob_shm(g_db_handle,
&g_db_mutex, BP_DB_TABLE_THUMBNAILS, sock, id, &client->shm);
break;
case BP_CMD_TABS_GET_ACTIVATED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_ACTIVATED, sock, id);
break;
case BP_CMD_TABS_GET_INCOGNITO:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_IS_INCOGNITO, sock, id);
break;
case BP_CMD_TABS_GET_BROWSER_INSTANCE:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_BROWSER_INSTANCE, sock, id);
break;
case BP_CMD_COMMON_GET_DATE_CREATED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DATETIME_CREATED, sock, id);
break;
case BP_CMD_COMMON_GET_DATE_MODIFIED:
- errorcode = bp_common_get_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DATETIME_MODIFIED, sock, id);
break;
case BP_CMD_COMMON_GET_ACCOUNT_NAME:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_ACCOUNT_NAME, sock, id);
break;
case BP_CMD_COMMON_GET_ACCOUNT_TYPE:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_ACCOUNT_TYPE, sock, id);
break;
case BP_CMD_COMMON_GET_DEVICE_NAME:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DEVICE_NAME, sock, id);
break;
case BP_CMD_COMMON_GET_DEVICE_ID:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DEVICE_ID, sock, id);
break;
case BP_CMD_TABS_GET_USAGE:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_USAGE, sock, id);
break;
case BP_CMD_COMMON_GET_SYNC:
- errorcode = bp_common_get_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_get_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_SYNC, sock, id);
break;
case BP_CMD_TABS_SET_INDEX:
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_INDEX, sock, id);
break;
case BP_CMD_COMMON_SET_URL:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_URL, sock, id);
break;
case BP_CMD_COMMON_SET_TITLE:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_TITLE, sock, id);
break;
case BP_CMD_COMMON_SET_ICON:
&g_db_mutex, BP_DB_TABLE_THUMBNAILS, sock, id, &client->shm);
break;
case BP_CMD_TABS_SET_ACTIVATED:
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_ACTIVATED, sock, id);
break;
case BP_CMD_TABS_SET_INCOGNITO:
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_IS_INCOGNITO, sock, id);
break;
case BP_CMD_TABS_SET_BROWSER_INSTANCE:
- errorcode = bp_common_set_int
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_int(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_BROWSER_INSTANCE, sock, id);
break;
case BP_CMD_COMMON_SET_DATE_CREATED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DATE_CREATED, sock, id);
break;
case BP_CMD_COMMON_SET_DATE_MODIFIED:
- errorcode = bp_common_set_date
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_date(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DATE_MODIFIED, sock, id);
break;
case BP_CMD_COMMON_SET_ACCOUNT_NAME:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_ACCOUNT_NAME, sock, id);
break;
case BP_CMD_COMMON_SET_ACCOUNT_TYPE:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_ACCOUNT_TYPE, sock, id);
break;
case BP_CMD_COMMON_SET_DEVICE_NAME:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DEVICE_NAME, sock, id);
break;
case BP_CMD_COMMON_SET_DEVICE_ID:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_DEVICE_ID, sock, id);
break;
case BP_CMD_TABS_SET_USAGE:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_TABS_COL_USAGE, sock, id);
break;
case BP_CMD_COMMON_SET_SYNC:
- errorcode = bp_common_set_string
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
+ errorcode = bp_common_set_string(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS,
BP_DB_COMMON_COL_SYNC, sock, id);
break;
case BP_CMD_COMMON_NOTI:
errorcode = __bp_tab_get_info_offset(sock, id, &client->shm);
break;
case BP_CMD_COMMON_SET_DIRTY:
- errorcode = bp_common_set_dirty
- (g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, id);
+ errorcode = bp_common_set_dirty(g_db_handle, &g_db_mutex, BP_DB_TABLE_TABS, id);
break;
case BP_CMD_TABS_ACTIVATE:
errorcode = __bp_tab_activate(sock, id);
static inline void bp_ftrace(char *fmt, ...)
{
static FILE *logd = NULL;
- if(logd == NULL )
+ if (logd == NULL)
logd = fopen("/var/log/browser-provider.log", "a+");
va_list args;
va_start(args, fmt);
- if(logd != NULL) {
+ if (logd != NULL) {
vfprintf(logd, fmt, args);
fflush(logd);
}
#if defined(LOGD) && defined(TIZEN_DEBUG_ENABLE)
#define TRACE_DEBUG(format, ARG...) LOGD(format, ##ARG)
#else
-#define TRACE_DEBUG(...) do { } while(0)
+#define TRACE_DEBUG(...) do { } while (0)
#endif
#define TRACE_ERROR(format, ARG...) LOGE(format, ##ARG)
#define TRACE_INFO(format, ARG...) LOGI(format, ##ARG)
#if defined(SECURE_LOGD) && defined(TIZEN_DEBUG_ENABLE)
#define TRACE_SECURE_DEBUG(format, ARG...) SECURE_LOGD(format, ##ARG)
#else
-#define TRACE_SECURE_DEBUG(...) do { } while(0)
+#define TRACE_SECURE_DEBUG(...) do { } while (0)
#endif
#if defined(SECURE_LOGI) && defined(TIZEN_DEBUG_ENABLE)
#define TRACE_SECURE_INFO(format, ARG...) SECURE_LOGI(format, ##ARG)
#else
-#define TRACE_SECURE_INFO(...) do { } while(0)
+#define TRACE_SECURE_INFO(...) do { } while (0)
#endif
#if defined(SECURE_LOGE) && defined(TIZEN_DEBUG_ENABLE)
#define TRACE_SECURE_ERROR(format, ARG...) SECURE_LOGE(format, ##ARG)
#else
-#define TRACE_SECURE_ERROR(...) do { } while(0)
+#define TRACE_SECURE_ERROR(...) do { } while (0)
#endif
#endif
#else // No Logging
-#define TRACE_DEBUG(...) do { } while(0)
-#define TRACE_ERROR(...) do { } while(0)
-#define TRACE_INFO(...) do { } while(0)
-#define TRACE_WARN(...) do { } while(0)
-#define TRACE_SECURE_DEBUG(...) do { } while(0)
-#define TRACE_SECURE_INFO(...) do { } while(0)
-#define TRACE_SECURE_ERROR(...) do { } while(0)
+#define TRACE_DEBUG(...) do { } while (0)
+#define TRACE_ERROR(...) do { } while (0)
+#define TRACE_INFO(...) do { } while (0)
+#define TRACE_WARN(...) do { } while (0)
+#define TRACE_SECURE_DEBUG(...) do { } while (0)
+#define TRACE_SECURE_INFO(...) do { } while (0)
+#define TRACE_SECURE_ERROR(...) do { } while (0)
#endif
if (sock < 0) {\
TRACE_ERROR("[ERROR] sock establish");\
return BP_ERROR_IO_ERROR;\
- }\
-} while(0)
+ } \
+} while (0)
ssize_t bp_ipc_recv(int sock, void *value, size_t type_size,
const char *func);
${CMAKE_SOURCE_DIR}/common-adaptor/common-adaptor-png.c
${CMAKE_SOURCE_DIR}/provider/browser-provider-socket.c
${CMAKE_SOURCE_DIR}/provider/browser-provider-shm.c
- ${CMAKE_CURRENT_SOURCE_DIR}/tab-adaptor.c )
+ ${CMAKE_CURRENT_SOURCE_DIR}/tab-adaptor.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${tab_adaptor_pkgs_LDFLAGS} ${TAB_LINK_LIBRARIES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PKG_VERSION})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0)
/**
* @brief The structure containing the variables for all properties
* @remarks The caller has access only to variables which are related to the bp_history_offset. \n
- * The caller has to initialize the structure before using it.\n
- * The caller has to free the memory of the structure allocated by bp_tab_adaptor_get_info().
+ * The caller has to initialize the structure before using it.\n
+ * The caller has to free the memory of the structure allocated by bp_tab_adaptor_get_info().
*/
typedef struct {
int index; /**< The index of the tab, otherwise ignore this variable by setting to negative */
/**
* @brief Ddeletes all tabs having set 'is_deleted' property from the storage
* @details If cloud is on, "is_dirty" property is off by calling delete function,\n
- * if cloud is off, a scrap is deleted really from storage whenever delete function is called.
+ * if cloud is off, a scrap is deleted really from storage whenever delete function is called.
* @return 0 on success, otherwise -1 is returned and error code is set to indicate the error.
*/
EXPORT_API int bp_tab_adaptor_clear_deleted_ids(void);
* @brief Creates a new item
* @details The creation time is set to the present time automatically
* @param [out] id The id of created item. The caller can handle the way to generate id value with initializing this param before calling.
- * If caller pass negative value such as -1, provider will generate id value automatically, otherwise it will try to use passed value as an id of new item.
+ * If caller pass negative value such as -1, provider will generate id value automatically, otherwise it will try to use passed value as an id of new item.
* @return 0 on success, otherwise -1 is returned and error code is set to indicate the error.
* @see bp_tab_adaptor_delete()
*/
/**
* @brief Creates a new item or update it using the structure
* @param [out] id The id of created item. The caller can handle the way to generate id value with initializing this param before calling.
- * If caller pass negative value such as -1, provider will generate id value automatically, otherwise it will try to use passed value as an id of new item.
+ * If caller pass negative value such as -1, provider will generate id value automatically, otherwise it will try to use passed value as an id of new item.
* @param[in] info The structure contains all properties that caller want to set
* @return 0 on success, otherwise -1 is returned and error code is set to indicate the error.
* @pre The structure has to be initialized to 0, then use the variables call to change them,\n
/**
* @brief Gets the array of ids and the number of rows of items searched by keyword and some structure from the storage
* @remarks Allocated memory (ids) has to released by the caller.\n
- * If the caller wants to do LIKE searching, keyword has to have some wild card like _aa, a_a, %aa, aa% or %aa%.
+ * If the caller wants to do LIKE searching, keyword has to have some wild card like _aa, a_a, %aa, aa% or %aa%.
* @param[out] ids The array of ids
* @param[out] count The array size
* @param[in] limit The maximum number of rows to get, negative value means no limit
* @return 0 on success, otherwise -1 is returned and error code is set to indicate the error.
* @see bp_tab_offset
*/
-EXPORT_API int bp_tab_adaptor_get_duplicated_ids_p
- (int **ids, int *count, const int limit, const int offset,
+EXPORT_API int bp_tab_adaptor_get_duplicated_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const bp_tab_offset order_column_offset, const int ordering,
const bp_tab_offset check_column_offset,
const char *keyword, const int is_like);
static void *__tab_adaptor_event_manager(void *arg)
{
int status = bp_common_adaptor_event_manager(arg,
- &g_adaptor_noti_cb, &g_adaptor_noti_user_data);
+ &g_adaptor_noti_cb, &g_adaptor_noti_user_data);
pthread_mutex_lock(&g_adaptor_mutex);
g_adaptor_event_thread_pid = 0; // set 0 to not call pthread_cancel
{
TRACE_DEBUG("pthread:%0x", (int)g_adaptor_event_thread_pid);
return bp_common_adaptor_disconnect(&g_adaptorinfo,
- &g_adaptor_event_thread_pid);
+ &g_adaptor_event_thread_pid);
}
static int __browser_adaptor_connect(int callback)
client_type = BP_CLIENT_TABS_SYNC;
#endif
- if (bp_common_adaptor_connect_to_provider(&g_adaptorinfo,
- client_type) < 0) {
+ if (bp_common_adaptor_connect_to_provider(&g_adaptorinfo, client_type) < 0) {
TRACE_ERROR("[CHECK connection]");
return -1;
}
}
g_bp_command.cmd = BP_CMD_NONE;
g_bp_command.id = -1;
- if(g_adaptorinfo != NULL) {
- g_bp_command.cid = g_adaptorinfo->cid;
- } else {
- g_bp_command.cid = 0;
- }
+ if (g_adaptorinfo != NULL)
+ g_bp_command.cid = g_adaptorinfo->cid;
+ else
+ g_bp_command.cid = 0;
+
if (callback == 1 && g_adaptor_event_thread_pid <= 0) {
// create thread here ( getting event_socket )
if (pthread_create(&g_adaptor_event_thread_pid, NULL,
return 0;
}
-static int __bp_tab_adaptor_get_ids_p
- (int **ids, int *count, bp_command_defs cmd)
+static int __bp_tab_adaptor_get_ids_p(int **ids, int *count, bp_command_defs cmd)
{
if (ids == NULL || count == NULL)
return -1;
return 0;
}
-static int __bp_tab_adaptor_get_string
- (const int id, bp_command_defs cmd, char **value)
+static int __bp_tab_adaptor_get_string(const int id, bp_command_defs cmd, char **value)
{
if (id < 0 || value == NULL)
return -1;
return ret;
}
-static int __bp_tab_adaptor_get_int
- (const int id, bp_command_defs cmd, int *value)
+static int __bp_tab_adaptor_get_int(const int id, bp_command_defs cmd, int *value)
{
if (id < 0 || value == NULL)
return -1;
return ret;
}
-static int __bp_tab_adaptor_set_string
- (const int id, bp_command_defs cmd, const char *value)
+static int __bp_tab_adaptor_set_string(const int id, bp_command_defs cmd, const char *value)
{
if (id < 0 || value == NULL || bp_common_precheck_string(value) < 0)
return -1;
return ret;
}
-static int __bp_tab_adaptor_set_int
- (const int id, bp_command_defs cmd, const int value)
+static int __bp_tab_adaptor_set_int(const int id, bp_command_defs cmd, const int value)
{
if (id < 0) {
TRACE_ERROR("[CHECK id][%d]", id);
int bp_tab_adaptor_get_errorcode(void)
{
- switch(errorcode) {
+ switch (errorcode) {
case BP_ERROR_INVALID_PARAMETER:
return BP_TAB_ERROR_INVALID_PARAMETER;
case BP_ERROR_OUT_OF_MEMORY:
return -1;
}
if (bp_ipc_send_custom_type(sock, &new_base_tab,
- sizeof(bp_tab_base_fmt)) < 0 ||
+ sizeof(bp_tab_base_fmt)) < 0 ||
bp_ipc_send_custom_type(sock, &offset,
- sizeof(bp_tab_offset)) < 0) {
+ sizeof(bp_tab_offset)) < 0) {
errorcode = BP_ERROR_IO_ERROR;
BP_PRINT_ERROR(*id, errorcode);
__browser_adaptor_disconnect();
memset(info, 0x00, sizeof(bp_tab_info_fmt));
// fill info
- if (offset & BP_TAB_O_INDEX) {
+ if (offset & BP_TAB_O_INDEX)
info->index = tabinfo.index;
- }
- if (offset & BP_TAB_O_IS_ACTIVATED) {
+
+ if (offset & BP_TAB_O_IS_ACTIVATED)
info->is_activated = tabinfo.is_activated;
- }
- if (offset & BP_TAB_O_IS_INCOGNITO) {
+
+ if (offset & BP_TAB_O_IS_INCOGNITO)
info->is_incognito = tabinfo.is_incognito;
- }
- if (offset & BP_TAB_O_BROWSER_INSTANCE) {
+
+ if (offset & BP_TAB_O_BROWSER_INSTANCE)
info->browser_instance = tabinfo.browser_instance;
- }
- if (offset & BP_TAB_O_DATE_CREATED) {
+
+ if (offset & BP_TAB_O_DATE_CREATED)
info->date_created = tabinfo.date_created;
- }
- if (offset & BP_TAB_O_DATE_MODIFIED) {
+
+ if (offset & BP_TAB_O_DATE_MODIFIED)
info->date_modified = tabinfo.date_modified;
- }
+
// get strings . keep the order with provider
if (offset & BP_TAB_O_URL) {
if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE)
return __bp_tab_adaptor_send_cmd(id, BP_CMD_TABS_ACTIVATE);
}
-int bp_tab_adaptor_get_duplicated_ids_p
- (int **ids, int *count, const int limit, const int offset,
+int bp_tab_adaptor_get_duplicated_ids_p(
+ int **ids, int *count, const int limit, const int offset,
const bp_tab_offset order_column_offset, const int ordering,
const bp_tab_offset check_column_offset,
const char *keyword, const int is_like)
}
bp_tab_offset oflags = check_column_offset;
if (bp_ipc_send_custom_type(sock, &conds,
- sizeof(bp_db_base_conds_fmt)) < 0 ||
+ sizeof(bp_db_base_conds_fmt)) < 0 ||
bp_ipc_send_custom_type(sock, &oflags,
- sizeof(bp_tab_offset)) < 0 ||
+ sizeof(bp_tab_offset)) < 0 ||
bp_adaptor_ipc_send_int(sock, is_like) < 0 ||
bp_ipc_send_string(sock, keyword) < 0) {
errorcode = BP_ERROR_IO_ERROR;
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < BP_MAX_IDS_COUNT&& ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;
return -1;
}
// getting ids array from provider
- if (bp_ipc_read_blob(sock, idlist,
- (sizeof(int) * ids_count)) < 0) {
+ if (bp_ipc_read_blob(sock, idlist, (sizeof(int) * ids_count)) < 0) {
free(idlist);
errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR);
BP_PRINT_ERROR(-1, errorcode);