From 6ddadf66f11b03170f1bb81f8001abcd0be5eb51 Mon Sep 17 00:00:00 2001 From: Youngjae Shin Date: Tue, 12 Sep 2017 11:16:46 +0900 Subject: [PATCH] apply tizen coding style Change-Id: I688bf24f9e92cc0488eac926469503287fff1ee0 --- doc/tizen_doc.h | 4 ++-- include/private/tizen_error_private.h | 2 +- include/tizen.h | 6 +++--- include/tizen_error.h | 24 ++++++++++++------------ include/tizen_type.h | 6 +++--- src/tizen_error.c | 11 ++++------- tool/tizen_error_private_template.h | 2 +- 7 files changed, 26 insertions(+), 29 deletions(-) diff --git a/doc/tizen_doc.h b/doc/tizen_doc.h index 5addc0a..eb25593 100755 --- a/doc/tizen_doc.h +++ b/doc/tizen_doc.h @@ -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. */ @@ -25,6 +25,6 @@ * @section CAPI_COMMON_ERROR_OVERVIEW Overview * This file declares common errors and provides following features for handling the error. * - Getting/Setting the error value. - * - Retrieving the error messages with error value. + * - Retrieving the error messages with error value. */ diff --git a/include/private/tizen_error_private.h b/include/private/tizen_error_private.h index 254c6f9..17d484e 100644 --- a/include/private/tizen_error_private.h +++ b/include/private/tizen_error_private.h @@ -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. */ diff --git a/include/tizen.h b/include/tizen.h index ce0f0be..60630db 100755 --- a/include/tizen.h +++ b/include/tizen.h @@ -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. */ #ifndef __TIZEN_H__ @@ -31,5 +31,5 @@ # define TIZEN_DEPRECATED_API # endif #endif - -#endif // __TIZEN_H__ \ No newline at end of file + +#endif // __TIZEN_H__ diff --git a/include/tizen_error.h b/include/tizen_error.h index d08c4ff..b292372 100644 --- a/include/tizen_error.h +++ b/include/tizen_error.h @@ -242,21 +242,21 @@ extern "C" { /* Tizen Buffer Manager Error */ #define TIZEN_ERROR_TBM -0x02830000 /* Tizen EOM Error */ -#define TIZEN_ERROR_EOM -0x02840000 +#define TIZEN_ERROR_EOM -0x02840000 /* Tizen PANEL Error */ -#define TIZEN_ERROR_PANEL -0x02850000 +#define TIZEN_ERROR_PANEL -0x02850000 /* Tizen TZSH Error */ -#define TIZEN_ERROR_TZSH -0x02860000 +#define TIZEN_ERROR_TZSH -0x02860000 /* Tizen Download Error */ -#define TIZEN_ERROR_DOWNLOAD -0x02A00000 +#define TIZEN_ERROR_DOWNLOAD -0x02A00000 /* Tizen WebView Error */ #define TIZEN_ERROR_WEBVIEW -0x02A10000 /* Tizen Location Manager Error */ #define TIZEN_ERROR_LOCATION_MANAGER -0x02C00000 /* Tizen Geofence Manager Error */ -#define TIZEN_ERROR_GEOFENCE_MANAGER -0x02C10000 +#define TIZEN_ERROR_GEOFENCE_MANAGER -0x02C10000 /* Tizen Maps Service Error */ -#define TIZEN_ERROR_MAPS_SERVICE -0x02C20000 +#define TIZEN_ERROR_MAPS_SERVICE -0x02C20000 /* Tizen STT Error */ #define TIZEN_ERROR_STT -0x02F00000 /* Tizen TTS Error */ @@ -387,7 +387,7 @@ typedef enum { TIZEN_ERROR_END_OF_COLLECTION, } tizen_error_e; - + /** * @brief Gets the last error code in the thread. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif @@ -398,7 +398,7 @@ typedef enum { */ int get_last_result(void); - + /** * @brief Sets the last error code to be returned in the thread. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif @@ -408,7 +408,7 @@ int get_last_result(void); */ void set_last_result(int err); - + /** * @brief Gets the message for given the error code. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif @@ -431,12 +431,12 @@ void set_last_result(int err); */ char *get_error_message(int err); - + /** * @} */ - - + + #ifdef __cplusplus } diff --git a/include/tizen_type.h b/include/tizen_type.h index 718dd5b..90091e5 100755 --- a/include/tizen_type.h +++ b/include/tizen_type.h @@ -11,9 +11,9 @@ * 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. */ - + #ifndef __TIZEN_TYPE_H__ #define __TIZEN_TYPE_H__ @@ -22,7 +22,7 @@ #ifndef NULL #ifdef __cplusplus #define NULL (0L) - #else + #else #define NULL ((void*) 0) #endif #endif diff --git a/src/tizen_error.c b/src/tizen_error.c index 1fd722b..ec0db35 100644 --- a/src/tizen_error.c +++ b/src/tizen_error.c @@ -59,21 +59,18 @@ char *get_error_message(int err_code) if (err_code == 0) { strncpy(msg, "Successful", strlen("Successful")); } else if (err_code >= TIZEN_ERROR_OWNER_DEAD && err_code < 0) { - if ((~err_code + 1) == -ENOSYS) { + if ((~err_code + 1) == -ENOSYS) strncpy(msg, "Invalid operation", strlen("Invalid operation")); - } else { + else strerror_r(~err_code + 1, msg, sizeof(msg)); - } } else if (err_code >= TIZEN_ERROR_MIN_PLATFORM_ERROR && err_code < TIZEN_ERROR_END_OF_COLLECTION) { tmp = _get_error_message(err_code); - if (tmp != NULL) { + if (tmp != NULL) strncpy(msg, tmp, strlen(tmp)); - } } else if (err_code >= TIZEN_ERROR_MIN_PLATFORM_MODULE && err_code < -0x009F0000) { tmp = _get_error_message(err_code); - if (tmp != NULL) { + if (tmp != NULL) strncpy(msg, tmp, strlen(tmp)); - } } else {; } return msg; diff --git a/tool/tizen_error_private_template.h b/tool/tizen_error_private_template.h index 96c53a8..3822745 100644 --- a/tool/tizen_error_private_template.h +++ b/tool/tizen_error_private_template.h @@ -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. */ -- 2.7.4