From: Jeongmo Yang Date: Thu, 18 Mar 2021 05:06:15 +0000 (+0900) Subject: Fix SAM defect - GlobalVariable X-Git-Tag: accepted/tizen/unified/20210319.141018^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e592b667fb6403ca367ae67089fe4887e3d59f31;p=platform%2Fcore%2Fapi%2Fcamera.git Fix SAM defect - GlobalVariable - 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 --- diff --git a/include/camera_private.h b/include/camera_private.h index e8a4509..e2aa8d8 100644 --- a/include/camera_private.h +++ b/include/camera_private.h @@ -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); diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 556dd5f..2e09c89 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -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 diff --git a/src/camera.c b/src/camera.c index 1d8d6bd..9187df2 100644 --- a/src/camera.c +++ b/src/camera.c @@ -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; +} diff --git a/src/camera_internal.c b/src/camera_internal.c index be219da..234e6a9 100644 --- a/src/camera_internal.c +++ b/src/camera_internal.c @@ -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) { diff --git a/test/camera_test.c b/test/camera_test.c index 9e4152e..d850519 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -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;