Unify image info structures because All of them have same format
[platform/core/multimedia/libmm-utility.git] / common / include / mm_util_private.h
1 /*
2  * libmm-utility
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: YoungHun Kim <yh8004.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_UTIL_PRIVATE_H__
23 #define __MM_UTIL_PRIVATE_H__
24
25 #include <glib.h>
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include "mm_util_debug.h"
29 #include "mm_util_type.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /* for memory management */
36 #define MMUTIL_SAFE_FREE(x)                             { if (x) { free(x); x = NULL; } }
37 #define MMUTIL_SAFE_G_FREE(x)                   { if (x) { g_free(x); x = NULL; } }
38 #define MMUTIL_SAFE_STRCPY(dst, src, n) g_strlcpy(dst, src, n)
39 #define MMUTIL_STRING_VALID(str)        ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
40
41 #define SAFE_STRLCPY(dst, src, n)      g_strlcpy(dst, src, n);
42
43 /* for alignment */
44 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
45 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
46 #define MM_UTIL_ROUND_UP_8(num) (((num)+7)&~7)
47 #define MM_UTIL_ROUND_UP_16(num) (((num)+15)&~15)
48 #define MM_UTIL_ROUND_DOWN_2(num) ((num)&(~1))
49 #define MM_UTIL_ROUND_DOWN_4(num) ((num)&(~3))
50 #define MM_UTIL_ROUND_DOWN_16(num) ((num)&(~15))
51
52 int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp);
53 void mm_util_safe_fclose(FILE *fp);
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif    /*__MM_UTIL_PRIVATE_H__*/