Fix SAM defect - GlobalVariable 16/255416/2 accepted/tizen/unified/20210319.141018 submit/tizen/20210318.073807
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 18 Mar 2021 05:06:15 +0000 (14:06 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 18 Mar 2021 05:24:20 +0000 (14:24 +0900)
- Remove global extern variable
- Use static for global varable

[Version] 0.4.48
[Issue Type] SAM Improvement

Change-Id: Id986a3c86f2d5a73ba888cb67396246168df3433
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
include/camera_private.h
packaging/capi-media-camera.spec
src/camera.c
src/camera_internal.c
test/camera_test.c

index e8a4509..e2aa8d8 100644 (file)
@@ -55,37 +55,37 @@ extern "C" {
 
 #define CAM_LOG_CRITICAL(format, args...) \
        do { \
-               if (g_mmcam_log_level >= CAMERA_LOG_LEVEL_CRITICAL) \
+               if (_camera_get_log_level() >= CAMERA_LOG_LEVEL_CRITICAL) \
                        LOGF(format, ##args); \
        } while (0)
 
 #define CAM_LOG_ERROR(format, args...) \
        do { \
-               if (g_mmcam_log_level >= CAMERA_LOG_LEVEL_ERROR) \
+               if (_camera_get_log_level() >= CAMERA_LOG_LEVEL_ERROR) \
                        LOGE(format, ##args); \
        } while (0)
 
 #define CAM_LOG_WARNING(format, args...) \
        do { \
-               if (g_mmcam_log_level >= CAMERA_LOG_LEVEL_WARNING) \
+               if (_camera_get_log_level() >= CAMERA_LOG_LEVEL_WARNING) \
                        LOGW(format, ##args); \
        } while (0)
 
 #define CAM_LOG_INFO(format, args...) \
        do { \
-               if (g_mmcam_log_level >= CAMERA_LOG_LEVEL_INFO) \
+               if (_camera_get_log_level() >= CAMERA_LOG_LEVEL_INFO) \
                        LOGI(format, ##args); \
        } while (0)
 
 #define CAM_LOG_DEBUG(format, args...) \
        do { \
-               if (g_mmcam_log_level >= CAMERA_LOG_LEVEL_DEBUG) \
+               if (_camera_get_log_level() >= CAMERA_LOG_LEVEL_DEBUG) \
                        LOGD(format, ##args); \
        } while (0)
 
 #define CAM_LOG_VERBOSE(format, args...) \
        do { \
-               if (g_mmcam_log_level >= CAMERA_LOG_LEVEL_VERBOSE) \
+               if (_camera_get_log_level() >= CAMERA_LOG_LEVEL_VERBOSE) \
                        LOGD("[V] "format, ##args); \
        } while (0)
 
@@ -249,6 +249,7 @@ void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info,
 void _camera_msg_send_param2_int(int api, camera_cb_info_s *cb_info,
        int *ret, camera_msg_param *param0, camera_msg_param *param1, int timeout);
 void _camera_msg_return_buffer(int ret_fd, camera_cb_info_s *cb_info);
+int _camera_get_log_level(void);
 
 typedef bool (*camera_supported_cb_param1)(int param, void *user_data);
 typedef bool (*camera_supported_cb_param2)(int param1, int param2, void *user_data);
index 556dd5f..2e09c89 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.4.47
+Version:    0.4.48
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 1d8d6bd..9187df2 100644 (file)
@@ -41,7 +41,7 @@ static guint g_cam_dev_state_changed_cb_subscribe_id;
 static GMutex g_cam_idle_event_lock;
 
 /* log level */
-int g_mmcam_log_level = CAMERA_LOG_LEVEL_INFO;
+static int g_camera_log_level = CAMERA_LOG_LEVEL_INFO;
 
 static bool __camera_import_tbm_fd(tbm_bufmgr bufmgr, int fd, tbm_bo *bo, tbm_bo_handle *bo_handle);
 static void __camera_release_imported_bo(tbm_bo *bo);
@@ -2457,10 +2457,10 @@ int _camera_create_private(camera_device_e device, bool is_network, camera_h *ca
                pc->cb_info->preview_format = preview_format;
                pc->cb_info->dp_info.type = CAMERA_DISPLAY_TYPE_NONE;
                pc->cb_info->user_buffer_supported = (gboolean)user_buffer_supported;
-               g_mmcam_log_level = log_level;
+               g_camera_log_level = log_level;
 
                CAM_LOG_INFO("default preview format %d, user buffer %d, log level %d",
-                       preview_format, user_buffer_supported, g_mmcam_log_level);
+                       preview_format, user_buffer_supported, g_camera_log_level);
 
                *camera = (camera_h)pc;
 
@@ -6764,3 +6764,9 @@ _DONE:
 
        return ret;
 }
+
+
+int _camera_get_log_level(void)
+{
+       return g_camera_log_level;
+}
index be219da..234e6a9 100644 (file)
@@ -38,9 +38,6 @@ typedef struct _cdm_symbol_table {
 } cdm_symbol_table;
 
 
-/* log level */
-extern int g_mmcam_log_level;
-
 //LCOV_EXCL_START
 int camera_start_evas_rendering(camera_h camera)
 {
index 9e4152e..d850519 100644 (file)
@@ -54,14 +54,14 @@ struct _appdata {
 };
 typedef struct _appdata appdata;
 
-struct appcore_ops ops = {
+static struct appcore_ops ops = {
        .create = app_create,
        .terminate = app_terminate,
 };
 
-appdata ad;
-GIOChannel *stdin_channel;
-camera_device_e camera_device;
+static appdata ad;
+static GIOChannel *stdin_channel;
+static camera_device_e camera_device;
 static GTimer *timer;
 static int g_camera_device_state_changed_cb_id;
 static int g_camera_device_list_changed_cb_id;