applied coding rule for liboauth2 63/54763/1 accepted/tizen/mobile/20151218.044457 accepted/tizen/tv/20151218.044404 submit/tizen_mobile/20151218.025434 submit/tizen_tv/20151218.025452
authorIckhee Woo <ickhee.woo@samsung.com>
Thu, 17 Dec 2015 23:48:18 +0000 (08:48 +0900)
committerIckhee Woo <ickhee.woo@samsung.com>
Thu, 17 Dec 2015 23:48:18 +0000 (08:48 +0900)
Change-Id: I9ca03d902a8902e09d1d99370fe81f16b3dceedc
Signed-off-by: Ickhee Woo <ickhee.woo@samsung.com>
include/oauth2.h
include/oauth2_error.h
include/oauth2_manager.h
include/oauth2_request.h
include/oauth2_response.h
include/oauth2_types.h
sample/oauth2sample/inc/main.h
src/oauth2_private.h
src/oauth2_util.h

index 04d82dbdc1ac36d494db6c29615d8421a531bf3d..0bd45cb65ce09cf505ce883a4e66d148c5f1f61c 100644 (file)
@@ -39,4 +39,4 @@
  * @}
  */
 
-#endif // _OAUTH2_H_
+#endif /* _OAUTH2_H_ */
index 3611dd0d72c3c268e5e642b24891d84fc7c0692c..af5aa74914577a47ccf1bf18718c6f59730e50be 100644 (file)
@@ -38,7 +38,7 @@
  * @since_tizen 2.4
  * @privlevel public
  */
-typedef struct oauth2_error_soauth2_error_h;
+typedef struct oauth2_error_s *oauth2_error_h;
 
 /**
  * @brief Gets error code.
index 4e9da7b9337d708517b66731a773438a1ad86d8f..58a7aa149c64becc5a22c3781dc89b6244d43d58 100644 (file)
@@ -45,7 +45,7 @@
  * @brief The structure type for OAuth2 Manager handle.
  * @since_tizen 2.4
  */
-typedef struct oauth2_manager_soauth2_manager_h;
+typedef struct oauth2_manager_s *oauth2_manager_h;
 
 /**
  * @brief Creates oauth2_manager_h handle.
@@ -88,7 +88,7 @@ OAUTH2_API int oauth2_manager_destroy(oauth2_manager_h handle);
  * @pre oauth2_manager_request_token() must be called to get this callback invoked.
  * @see oauth2_manager_request_token()
  */
-typedef void (*oauth2_token_cb)(oauth2_response_h response, voiduser_data);
+typedef void (*oauth2_token_cb)(oauth2_response_h response, void *user_data);
 
 /**
  * @brief Request OAuth 2.0 access token.
@@ -127,7 +127,7 @@ OAUTH2_API int oauth2_manager_request_token(oauth2_manager_h handle, oauth2_requ
  * @pre oauth2_manager_request_authorization_grant() must be called to get this callback invoked.
  * @see oauth2_manager_request_authorization_grant()
  */
-typedef void (*oauth2_auth_grant_cb)(oauth2_response_h response, voiduser_data);
+typedef void (*oauth2_auth_grant_cb)(oauth2_response_h response, void *user_data);
 
 /**
  * @brief Request authorization grant.
@@ -166,7 +166,7 @@ OAUTH2_API int oauth2_manager_request_authorization_grant(oauth2_manager_h handl
  * @pre oauth2_manager_request_access_token() must be called to get this callback invoked.
  * @see oauth2_manager_request_access_token()
  */
-typedef void (*oauth2_access_token_cb)(oauth2_response_h response, voiduser_data);
+typedef void (*oauth2_access_token_cb)(oauth2_response_h response, void *user_data);
 
 /**
  * @brief Requests an access token.
@@ -205,7 +205,7 @@ OAUTH2_API int oauth2_manager_request_access_token(oauth2_manager_h handle, oaut
  * @pre oauth2_manager_refresh_access_token() must be called to get this callback invoked.
  * @see oauth2_manager_refresh_access_token().
  */
-typedef void (*oauth2_refresh_token_cb)(oauth2_response_h response, voiduser_data);
+typedef void (*oauth2_refresh_token_cb)(oauth2_response_h response, void *user_data);
 
 /**
  * @brief Requests a refresh token.
index 474572b8aa87c66cd5fb9576d2995785d7a73fcd..bd6cf4ab6a2ae00d71753a4c534e3900161438a7 100644 (file)
@@ -37,7 +37,7 @@
  * @brief The structure type for OAuth2 Request handle.
  * @since_tizen 2.4
  */
-typedef struct oauth2_request_soauth2_request_h;
+typedef struct oauth2_request_s *oauth2_request_h;
 
 /**
  * @brief Creates oauth2_request_h handle.
index 7e31b61002a32ae18cb5ac9979c37c786ffe4ce3..9f57cbbedafd02a3d1df5c81e542f49b49fadf2b 100644 (file)
@@ -37,7 +37,7 @@
  * @brief The structure type for OAuth2 Response handle.
  * @since_tizen 2.4
  */
-typedef struct oauth2_response_soauth2_response_h;
+typedef struct oauth2_response_s *oauth2_response_h;
 
 /**
  * @brief Destroys the received oauth2_response_h handle.
index 57eca889412e46049ad704371604e7ae824c5182..820773ff1e94d151e8b630340b49a21ac991cf98 100644 (file)
  *
  * @see oauth2_request_set_client_authentication_type()
  */
-typedef enum
-{
+typedef enum {
        OAUTH2_CLIENT_AUTHENTICATION_TYPE_MIN = -1,/**< @internal**/
        OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC,/**< HTTP Basic Authentication for client authentication.**/
-    OAUTH2_CLIENT_AUTHENTICATION_TYPE_DIGEST,/**< HTTP Digest Authentication for client authentication.**/
+       OAUTH2_CLIENT_AUTHENTICATION_TYPE_DIGEST,/**< HTTP Digest Authentication for client authentication.**/
        OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY,/**< Client credentials are sent via request body**/
        OAUTH2_CLIENT_AUTHENTICATION_TYPE_MAX,/**< @internal**/
-}oauth2_client_authentication_type_e;
+} oauth2_client_authentication_type_e;
 
 /**
  * @brief Enumerations to set grant_type.
@@ -57,15 +56,14 @@ typedef enum
  *
  * @see oauth2_request_set_grant_type()
  */
-typedef enum
-{
+typedef enum {
        OAUTH2_GRANT_TYPE_MIN = -1, /**< @internal**/
        OAUTH2_GRANT_TYPE_AUTH_CODE, /**< Access Token Request for Authorization Code Grant type.**/
        OAUTH2_GRANT_TYPE_PASSWORD, /**< Access Token Request for Resource Owner Password Credentials Grant type.**/
        OAUTH2_GRANT_TYPE_CLIENT_CREDENTIALS, /**< Access Token Request for Client Credentials Grant type.**/
        OAUTH2_GRANT_TYPE_REFRESH, /**< Refresh Token Request.**/
        OAUTH2_GRANT_TYPE_MAX, /**< @internal**/
-}oauth2_grant_type_e;
+} oauth2_grant_type_e;
 
 /**
  * @brief Enumerations to set response_type.
@@ -73,35 +71,33 @@ typedef enum
  *
  * @see oauth2_request_set_response_type()
  */
-typedef enum
-{
+typedef enum {
        OAUTH2_RESPONSE_TYPE_MIN = -1, /**< @internal**/
        OAUTH2_RESPONSE_TYPE_CODE,/**< Requesting an authorization code as response type.**/
        OAUTH2_RESPONSE_TYPE_TOKEN,/**< Requesting an access token(implicit grant) as response type.**/
        OAUTH2_RESPONSE_TYPE_MAX, /**< @internal**/
-}oauth2_response_type_e;
+} oauth2_response_type_e;
 
 /**
  *  @brief    Enumerations of error codes for oauth2 APIs.
  *  @since_tizen  2.4
  */
-typedef enum
-{
-    OAUTH2_ERROR_NONE                   = TIZEN_ERROR_NONE,                   /**< Successful */
-    OAUTH2_ERROR_OUT_OF_MEMORY             = TIZEN_ERROR_OUT_OF_MEMORY,              /**< Out of memory */
-    OAUTH2_ERROR_INVALID_PARAMETER         = TIZEN_ERROR_INVALID_PARAMETER,        /**< Invalid parameter */
+typedef enum {
+       OAUTH2_ERROR_NONE                   = TIZEN_ERROR_NONE,                   /**< Successful */
+       OAUTH2_ERROR_OUT_OF_MEMORY             = TIZEN_ERROR_OUT_OF_MEMORY,              /**< Out of memory */
+       OAUTH2_ERROR_INVALID_PARAMETER         = TIZEN_ERROR_INVALID_PARAMETER,        /**< Invalid parameter */
 
-    OAUTH2_ERROR_ALREADY_IN_PROGRESS = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Operation already in progress */
-    OAUTH2_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Operation not supported */
-    OAUTH2_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
-    OAUTH2_ERROR_PARSE_FAILED = TIZEN_ERROR_ACCOUNT_OAUTH | 0x01, /**< Response parse failed */
-    OAUTH2_ERROR_NETWORK_ERROR = TIZEN_ERROR_ACCOUNT_OAUTH | 0x02, /**< Network error */
-    OAUTH2_ERROR_SERVER = TIZEN_ERROR_ACCOUNT_OAUTH | 0x03, /**< Server error */
-    OAUTH2_ERROR_USER_CANCELLED = TIZEN_ERROR_ACCOUNT_OAUTH | 0x04, /**< User cancelled the operation  */
+       OAUTH2_ERROR_ALREADY_IN_PROGRESS = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Operation already in progress */
+       OAUTH2_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Operation not supported */
+       OAUTH2_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+       OAUTH2_ERROR_PARSE_FAILED = TIZEN_ERROR_ACCOUNT_OAUTH | 0x01, /**< Response parse failed */
+       OAUTH2_ERROR_NETWORK_ERROR = TIZEN_ERROR_ACCOUNT_OAUTH | 0x02, /**< Network error */
+       OAUTH2_ERROR_SERVER = TIZEN_ERROR_ACCOUNT_OAUTH | 0x03, /**< Server error */
+       OAUTH2_ERROR_USER_CANCELLED = TIZEN_ERROR_ACCOUNT_OAUTH | 0x04, /**< User cancelled the operation  */
 
-    OAUTH2_ERROR_VALUE_NOT_FOUND = TIZEN_ERROR_ACCOUNT_OAUTH | 0x05,    /**< Value not found */
-    OAUTH2_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN /**< Unknown error */
-}oauth2_error_e;
+       OAUTH2_ERROR_VALUE_NOT_FOUND = TIZEN_ERROR_ACCOUNT_OAUTH | 0x05,         /**< Value not found */
+       OAUTH2_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN /**< Unknown error */
+} oauth2_error_e;
 
 /* End of oauth2 APIs */
 /**
index 9924751696fe8def7ade352e2d9e7772f4887536..9652be42d06a5b57b1b963d83b421c6b4583eae6 100644 (file)
@@ -11,7 +11,7 @@
  * 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. 
+ * limitations under the License.
  */
 
 #include <app.h>
index ce51c23fbefd78e4e840219762ed234d6ceba7e6..a2fb75f57a632e50bc375e8e253aa31b449a4185 100644 (file)
@@ -22,9 +22,9 @@
 #include <bundle.h>
 #include <curl/curl.h>
 
-#ifdef WITH_CHROMIUM           
-#include <ewk_chromium.h>              
-#else          
+#ifdef WITH_CHROMIUM
+#include <ewk_chromium.h>
+#else
 #include <EWebKit.h>
 #include <ewk_view.h>
 #endif
 
 #define OAUTH2_LOADING_POP_UP_TEXT                     "Loading..."
 
-typedef enum{
+typedef enum {
        REQUEST_ACCESS_TOKEN = 1,
        REQUEST_AUTHORIZATION_CODE
 } _oauth_request_function;
 
-typedef struct _oauth2_request_s
-{
+typedef struct _oauth2_request_s {
        bundle *request_data;
-}oauth2_request_s;
+} oauth2_request_s;
 
-typedef struct _oauth2_error_s
-{
+typedef struct _oauth2_error_s {
        bundle *error_data;
-}oauth2_error_s;
+} oauth2_error_s;
 
-typedef struct _oauth2_response_s
-{
+typedef struct _oauth2_response_s {
        oauth2_error_s *error;
        bundle *response_data;
-}oauth2_response_s;
+} oauth2_response_s;
 
-typedef struct _oauth2_manager_s
-{
+typedef struct _oauth2_manager_s {
        oauth2_request_s *request;
        Evas_Object *login_win;
        Evas_Object *content_box;
@@ -134,7 +130,7 @@ typedef struct _oauth2_manager_s
        void *user_data;
        void *temp_data;
        bool is_webview_active;
-}oauth2_manager_s;
+} oauth2_manager_s;
 
 int _oauth2_response_create(oauth2_response_s **response);
 
index 45f7595184745a2034e10a583e1a1e0249c88e73..cefb15a034821605eeb603ece4e56cbe4a08c5b7 100644 (file)
 #endif
 
 #define OAUTH2_LOG_E(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, \
-               __LINE__, ##args)       //LCOV_EXCL_LINE
+               __LINE__, ##args)       /* LCOV_EXCL_LINE */
 
 #define OAUTH2_LOG_D(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, \
-               __LINE__, ##args)       //LCOV_EXCL_LINE
+               __LINE__, ##args)       /* LCOV_EXCL_LINE */
 
 #define OAUTH2_LOG_I(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, \
-               __LINE__, ##args)       //LCOV_EXCL_LINE
+               __LINE__, ##args)       /* LCOV_EXCL_LINE */
 
 #define OAUTH2_RETURN_VAL(eval, expr, ret_val, X) \
        if (!(eval)) { \
        expr; \
        OAUTH2_LOG_E(X); \
        return ret_val; \
-} else {;}     //LCOV_EXCL_LINE
+} else { ; }   /* LCOV_EXCL_LINE */
 
 #define OAUTH2_FREE(ptr) \
        if (ptr != NULL) { \
                free(ptr); \
                ptr = NULL; \
-       }       //LCOV_EXCL_LINE
+       }       /* LCOV_EXCL_LINE */
 
 int oauth2_util_get_query(const char *url, char **query);
 int oauth2_util_get_fragment(const char *url, char **fragment);
-int oauth2_util_get_params(const charurl_part, bundle **params);
+int oauth2_util_get_params(const char *url_part, bundle **params);
 
 #endif /* _OAUTH2_UTIL_H_ */