- The shared library will be seperated. So new files are renamed mc_xxx.
Change-Id: Ia091efcd0f9403948777bc63f808b7f2803eb76a
int mc_util_get_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command);
char *mc_util_generate_uuid(void);
int mc_util_bundle_to_string(bundle *bundle_data, char **str_data);
-int mc_safe_strtoi(const char *buffer, int *value);
-int mc_safe_strtoull(const char *buffer, unsigned long long *value);
/* for d-bus IPC */
int mc_ipc_get_dbus_connection(GDBusConnection **conn, int *dref_count);
#include "media_controller_client.h"
#include "media_controller_private.h"
#include "media_controller_db.h"
+#include "mc_util.h"
#include <bundle_internal.h>
static void __client_server_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data);
#include "media_controller_private.h"
#include "media_controller_db.h"
+#include "mc_util.h"
#include <bundle_internal.h>
#define MAX_PLAYLIST_LEN 100
return ret;
}
-
-int mc_safe_strtoi(const char *buffer, int *value)
-{
- char *end = NULL;
- errno = 0;
- mc_retvm_if(buffer == NULL || value == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid parameter");
-
- const long sl = strtol(buffer, &end, 10);
-
- mc_retvm_if(end == buffer, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "not a decimal number");
- mc_retvm_if('\0' != *end, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "extra characters at end of input: %s", end);
- mc_retvm_if((LONG_MIN == sl || LONG_MAX == sl) && (ERANGE == errno), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "out of range of type long");
- mc_retvm_if(sl > INT_MAX, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "greater than INT_MAX");
- mc_retvm_if(sl < INT_MIN, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "smaller than INT_MIN");
-
- *value = (int)sl;
-
- return MEDIA_CONTROLLER_ERROR_NONE;
-}
-
-int mc_safe_strtoull(const char *buffer, unsigned long long *value)
-{
- char *end = NULL;
- errno = 0;
- mc_retvm_if(buffer == NULL || value == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid parameter");
-
- const unsigned long long ull = strtoull(buffer, &end, 10);
-
- mc_retvm_if(end == buffer, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "not a decimal number");
- mc_retvm_if('\0' != *end, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "extra characters at end of input: %s", end);
- mc_retvm_if((ULLONG_MAX == ull) && (ERANGE == errno), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "out of range of type long");
-
- *value = (unsigned long long)ull;
-
- return MEDIA_CONTROLLER_ERROR_NONE;
-}
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_UTIL_H__
+#define __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_UTIL_H__
+
+int mc_safe_strtoi(const char *buffer, int *value);
+int mc_safe_strtoull(const char *buffer, unsigned long long *value);
+
+#endif /*__TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_UTIL_H__*/
* limitations under the License.
*/
-#ifndef __TIZEN_MEDIA_CONTROLLER_CYNARA_H__
-#define __TIZEN_MEDIA_CONTROLLER_CYNARA_H__
+#ifndef __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_CYNARA_H__
+#define __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_CYNARA_H__
#include <stdbool.h>
void mc_cynara_finish(void);
-#endif/* _MEDIA_CONTROLLER_CYNARA_H_ */
+#endif/* __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_CYNARA_H__ */
* limitations under the License.
*/
-#ifndef __TIZEN_MEDIA_CONTROLLER_DB_UTIL_H__
-#define __TIZEN_MEDIA_CONTROLLER_DB_UTIL_H__
+#ifndef __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_DB_UTIL_H__
+#define __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_DB_UTIL_H__
#include <glib.h>
int mc_db_util_remove_dead_application(uid_t uid, const char *app_id, mc_priv_type_e priv_type);
-#endif /*__TIZEN_MEDIA_CONTROLLER_DB_UTIL_H__*/
+#endif /*__TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_DB_UTIL_H__*/
* limitations under the License.
*/
-#ifndef __TIZEN_MEDIA_CONTROLLER_SOCKET_H__
-#define __TIZEN_MEDIA_CONTROLLER_SOCKET_H__
+#ifndef __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_SOCKET_H__
+#define __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_SOCKET_H__
#include <sys/un.h>
#include <netinet/in.h>
}
#endif /* __cplusplus */
-#endif /* __TIZEN_MEDIA_CONTROLLER_SERVER_H__ */
+#endif /* __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_SOCKET_H__ */
* limitations under the License.
*/
-#ifndef _MEDIA_CONTROLLER_SVC_H_
-#define _MEDIA_CONTROLLER_SVC_H_
+#ifndef __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_SVC_H__
+#define __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_SVC_H__
#include <glib.h>
}
#endif /* __cplusplus */
-#endif/* _MEDIA_CONTROLLER_SVC_H_ */
+#endif/* __TIZEN_MULTIMEDIA_MEDIA_CONTROLLER_SVC_H__ */
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#include <unistd.h>
+#include <stdio.h>
+
+#include "media_controller_private.h"
+#include "mc_util.h"
+
+int mc_safe_strtoi(const char *buffer, int *value)
+{
+ char *end = NULL;
+ errno = 0;
+ mc_retvm_if(buffer == NULL || value == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid parameter");
+
+ const long sl = strtol(buffer, &end, 10);
+
+ mc_retvm_if(end == buffer, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "not a decimal number");
+ mc_retvm_if('\0' != *end, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "extra characters at end of input: %s", end);
+ mc_retvm_if((LONG_MIN == sl || LONG_MAX == sl) && (ERANGE == errno), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "out of range of type long");
+ mc_retvm_if(sl > INT_MAX, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "greater than INT_MAX");
+ mc_retvm_if(sl < INT_MIN, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "smaller than INT_MIN");
+
+ *value = (int)sl;
+
+ return MEDIA_CONTROLLER_ERROR_NONE;
+}
+
+int mc_safe_strtoull(const char *buffer, unsigned long long *value)
+{
+ char *end = NULL;
+ errno = 0;
+ mc_retvm_if(buffer == NULL || value == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid parameter");
+
+ const unsigned long long ull = strtoull(buffer, &end, 10);
+
+ mc_retvm_if(end == buffer, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "not a decimal number");
+ mc_retvm_if('\0' != *end, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "extra characters at end of input: %s", end);
+ mc_retvm_if((ULLONG_MAX == ull) && (ERANGE == errno), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "out of range of type unsigned long long");
+
+ *value = ull;
+
+ return MEDIA_CONTROLLER_ERROR_NONE;
+}
#include "media_controller_private.h"
#include "media_controller_db_util.h"
+#include "mc_util.h"
#define MC_DB_TRIGGER_PLAYLIST "cleanup_playlist"
return ret;
}
-int mc_safe_strtoi(const char *buffer, int *value)
-{
- char *end = NULL;
- errno = 0;
- mc_retvm_if(buffer == NULL || value == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid parameter");
-
- const long sl = strtol(buffer, &end, 10);
-
- mc_retvm_if(end == buffer, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "not a decimal number");
- mc_retvm_if('\0' != *end, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "extra characters at end of input: %s", end);
- mc_retvm_if((LONG_MIN == sl || LONG_MAX == sl) && (ERANGE == errno), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "out of range of type long");
- mc_retvm_if(sl > INT_MAX, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "greater than INT_MAX");
- mc_retvm_if(sl < INT_MIN, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "smaller than INT_MIN");
-
- *value = (int)sl;
-
- return MEDIA_CONTROLLER_ERROR_NONE;
-}
-
-int mc_safe_strtoull(const char *buffer, unsigned long long *value)
-{
- char *end = NULL;
- errno = 0;
- mc_retvm_if(buffer == NULL || value == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid parameter");
-
- const unsigned long long ull = strtoull(buffer, &end, 10);
-
- mc_retvm_if(end == buffer, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "not a decimal number");
- mc_retvm_if('\0' != *end, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "extra characters at end of input: %s", end);
- mc_retvm_if((ULLONG_MAX == ull) && (ERANGE == errno), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "out of range of type long");
-
- *value = (unsigned long long)ull;
-
- return MEDIA_CONTROLLER_ERROR_NONE;
-}
-
char *mc_db_get_db_path(uid_t uid)
{
char *db_path = NULL;