Fix coding style according to tizen rule
[platform/core/security/drm-service-core-tizen.git] / tappsd / src / intf / drm_intf_tapps.cpp
index 6257e57..2af4fb0 100644 (file)
  * 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.
- */
-
-/**
- * @file       drm_intf_tapps.cpp
- * @brief      This file includes definitions of the drm TAPPS intf APIs.
+ *
+ * @file    drm_intf_tapps.cpp
+ * @brief   drm TAPPS intf APIs.
  */
 
 #include "drm_intf_tapps.h"
 
 /* String Operations */
 #ifdef _TAPPS_DEBUG_ENABLE_
-unsigned int TAPPS_gstrlcat(char* s1,const char* s2,unsigned int destsize,const char* funName, unsigned int lineno)
+unsigned int TAPPS_gstrlcat(char *s1, const char *s2, unsigned int destsize,
+                                                       const char *funName, unsigned int lineno)
 {
        unsigned int ret_g_strlcat = (unsigned int)g_strlcat(s1, s2, destsize);
 
-       if(ret_g_strlcat >= (unsigned int)destsize)
-       {
-               DRM_TAPPS_EXCEPTION("Truncation occured during concatenation at [%s:%u] s1=%s s2=%s destsize=%u ret_g_strlcpy=%u \n",funName,lineno,s1,s2,destsize,ret_g_strlcat);
-       }
-       else
-       {
-               DRM_TAPPS_FRQ_LOG("Concatenation Successful at [%s:%u] s1=%s s2=%s destsize=%u ret_g_strlcpy=%u \n",funName,lineno,s1,s2,destsize,ret_g_strlcat);
+       if (ret_g_strlcat >= (unsigned int)destsize) {
+               DRM_TAPPS_EXCEPTION("Truncation occured during concatenation at [%s:%u] "
+                                                       "s1=%s s2=%s destsize=%u ret_g_strlcpy=%u",
+                                                       funName, lineno, s1, s2, destsize, ret_g_strlcat);
+       } else {
+               DRM_TAPPS_FRQ_LOG("Concatenation Successful at [%s:%u] s1=%s s2=%s "
+                                                 "destsize=%u ret_g_strlcpy=%u",
+                                                 funName, lineno, s1, s2, destsize, ret_g_strlcat);
        }
 
        return ret_g_strlcat;
 }
 
-unsigned int TAPPS_gstrlcpy(char* s1,const char* s2,unsigned int destsize,const char* funName, unsigned int lineno)
+unsigned int TAPPS_gstrlcpy(char *s1, const char *s2, unsigned int destsize,
+                                                       const char *funName, unsigned int lineno)
 {
        unsigned int ret_g_strlcpy = (unsigned int)g_strlcpy(s1, s2, destsize);
 
-       if(ret_g_strlcpy >= (unsigned int)destsize)
-       {
-               DRM_TAPPS_EXCEPTION("Truncation occured during copying at [%s:%u] s1=%s s2=%s destsize=%u ret_g_strlcpy=%u \n",funName,lineno,s1,s2,destsize,ret_g_strlcpy);
-       }
-       else
-       {
-               DRM_TAPPS_FRQ_LOG("Copy Successful at [%s:%u] s1=%s s2=%s destsize=%u ret_g_strlcpy=%u \n",funName,lineno,s1,s2,destsize,ret_g_strlcpy);
+       if (ret_g_strlcpy >= (unsigned int)destsize) {
+               DRM_TAPPS_EXCEPTION("Truncation occured during copying at [%s:%u] "
+                                                       "s1=%s s2=%s destsize=%u ret_g_strlcpy=%u",
+                                                       funName, lineno, s1, s2, destsize, ret_g_strlcpy);
+       } else {
+               DRM_TAPPS_FRQ_LOG("Copy Successful at [%s:%u] s1=%s s2=%s destsize=%u "
+                                                 "ret_g_strlcpy=%u",
+                                                 funName, lineno, s1, s2, destsize, ret_g_strlcpy);
        }
 
        return ret_g_strlcpy;
 }
 
-unsigned int TAPPS_strlen(const char* s,const char* funName, unsigned int lineno)
+unsigned int TAPPS_strlen(const char *s, const char *funName,
+                                                 unsigned int lineno)
 {
-       DRM_TAPPS_FRQ_LOG("Function = %s, Line number = %u",funName,lineno);
+       DRM_TAPPS_FRQ_LOG("Function = %s, Line number = %u", funName, lineno);
 
        return strlen(s);
 }
 #endif
 
-int TAPPS_strnicmp(const char * s1, const char * s2, unsigned int sz)
+int TAPPS_strnicmp(const char *s1, const char *s2, unsigned int sz)
 {
-       int tmp1=0, tmp2=0;
+       int tmp1 = 0, tmp2 = 0;
 
-       unsigned int idx =0;
+       unsigned int idx = 0;
 
-       do
-       {
-               if ( ((tmp1 = (unsigned char)(*(s1++))) >= 'A') && (tmp1 <= 'Z') )
+       do {
+               if (((tmp1 = (unsigned char)(*(s1++))) >= 'A') && (tmp1 <= 'Z'))
                        tmp1 -= ('A' - 'a');
 
-               if ( ((tmp2 = (unsigned char)(*(s2++))) >= 'A') && (tmp2 <= 'Z') )
+               if (((tmp2 = (unsigned char)(*(s2++))) >= 'A') && (tmp2 <= 'Z'))
                        tmp2 -= ('A' - 'a');
 
                idx++;
-       } while ( tmp1 && (tmp1== tmp2)  && idx < sz);
+       } while (tmp1 && (tmp1 == tmp2)  && idx < sz);
 
        return (tmp1 - tmp2);
 }
@@ -86,71 +88,66 @@ int TAPPS_strnicmp(const char * s1, const char * s2, unsigned int sz)
 
 /* Mutex Handling */
 
-int dtapps_mutex_lock (dtappslockarg dtapps_mutex)
+int dtapps_mutex_lock(dtappslockarg dtapps_mutex)
 {
-       int retval=-1;
+       int retval = -1;
 
-       DRM_TAPPS_FRQ_LOG( "%s MUT-LK-ULK Thread [%d] trying to lock the Mutex=0x%x \n",__func__,drmgettid(),dtapps_mutex);
+       DRM_TAPPS_FRQ_LOG("MUT-LK-ULK Thread [%d] trying to lock the Mutex=0x%x",
+                                         drmgettid(), dtapps_mutex);
 
        retval = pthread_mutex_lock(dtapps_mutex);
 
-       if(retval != 0)
-       {
-               if(retval == EDEADLK)
-               {
-                       DRM_TAPPS_FRQ_LOG("Mutex is already locked by the same thread  \n");
-               }
-               else
-               {
-                       DRM_TAPPS_EXCEPTION( "Error locking mutex %d  \n", retval);
+       if (retval != 0) {
+               if (retval == EDEADLK) {
+                       DRM_TAPPS_FRQ_LOG("Mutex is already locked by the same thread");
+               } else {
+                       DRM_TAPPS_EXCEPTION("Error locking mutex %d", retval);
                        perror("\n drm_mutex_lock:Error:");
                }
-               retval=-1;
-       }
-       else
-       {
-               DRM_TAPPS_FRQ_LOG( "Mutex lock is successful  \n");
+
+               retval = -1;
+       } else {
+               DRM_TAPPS_FRQ_LOG("Mutex lock is successful");
        }
-       DRM_TAPPS_FRQ_LOG( "%s retval=%d \n",__func__,retval);
+
+       DRM_TAPPS_FRQ_LOG("retval=%d", retval);
 
        return retval;
 }
 
 
-int dtapps_mutex_unlock (dtappslockarg dtapps_mutex)
+int dtapps_mutex_unlock(dtappslockarg dtapps_mutex)
 {
-       int status=-1;
+       int status = -1;
 
-       DRM_TAPPS_FRQ_LOG( "%s MUT-LK-ULK Thread [%d] trying to unlock the Mutex=0x%x \n",__func__,drmgettid(),dtapps_mutex);
+       DRM_TAPPS_FRQ_LOG("MUT-LK-ULK Thread [%d] trying to unlock the Mutex=0x%x",
+                                         drmgettid(), dtapps_mutex);
 
        status = pthread_mutex_unlock(dtapps_mutex);
 
-       if(status != 0)
-       {
-               DRM_TAPPS_EXCEPTION( "Error unlocking mutex:return value=[%d] \n", status);
-               perror("\n drm_mutex_unlock:Error:");
+       if (status != 0) {
+               DRM_TAPPS_EXCEPTION("Error unlocking mutex:return value=[%d]", status);
+               perror("drm_mutex_unlock:Error:");
                status = -1;
-       }
-       else
-       {
-               DRM_TAPPS_FRQ_LOG( "Mutex unlocked is successful :return value=[%d] \n",status);
+       } else {
+               DRM_TAPPS_FRQ_LOG("Mutex unlocked is successful :return value=[%d]", status);
        }
 
-       DRM_TAPPS_FRQ_LOG( "%s status=%d \n",__func__,status);
+       DRM_TAPPS_FRQ_LOG("status=%d", status);
 
        return status;
 }
 
-void dtapps_sleep(unsigned int TimeInSec,unsigned int TimeInMicroSec)
+void dtapps_sleep(unsigned int TimeInSec, unsigned int TimeInMicroSec)
 {
        struct timeval tv;
-       int retval= -1;
+       int retval = -1;
        tv.tv_sec = TimeInSec;
        tv.tv_usec = TimeInMicroSec;
 
-       DRM_TAPPS_FRQ_LOG("%s TimeInSec =%u TimeInMicroSec=%u \n",__func__,tv.tv_sec,tv.tv_usec);
+       DRM_TAPPS_FRQ_LOG("TimeInSec =%u TimeInMicroSec=%u", tv.tv_sec, tv.tv_usec);
 
        retval = select(0, NULL, NULL, NULL, &tv);
 
-       DRM_TAPPS_FRQ_LOG("%s select retval=%d \n",__func__,retval);
+       DRM_TAPPS_FRQ_LOG("select retval=%d \n", retval);
 }