summaryrefslogtreecommitdiff
path: root/include/utils/MsgUtilFile.h
blob: 0407143627dee54129426a088aa6e683f0e14cd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * 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.
*/

#ifndef MSG_UTIL_FILE_H
#define MSG_UTIL_FILE_H

#include <stdio.h>
/*==================================================================================================
					DEFINES
==================================================================================================*/
#define FM_READ_WRITE_BUFFER_MAX (1024*1024*3)

/*==================================================================================================
					FUNCTION PROTOTYPES
==================================================================================================*/
bool MakeThumbnail(char *srcPath, char *dstPath);
/**  file operation wrapper - for avoding runtime error */
FILE* MsgOpenFile(const char* filepath, const char* opt);
void MsgCloseFile(FILE* pFile);
int MsgFseek(FILE* pFile, long int offset, int origin);
size_t MsgWriteFile(const char* pData, size_t size, size_t count, FILE  *pFile);
size_t MsgReadFile(void *pData, size_t size, size_t count, FILE *pFile);
long int MsgFtell(FILE *pFile);
int MsgFflush(FILE *pFile);
int MsgFsync(FILE *pFile);

bool MsgCreateFileName(char *pFileName);
bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize);
bool MsgReadFileForDecode(FILE* pFile, char* pBuf, int length, int* nSize);
bool MsgWriteDataFromEncodeBuffer(FILE* pFile, char* pInBuffer, int *pPtr, int maxLen, int* pOffset);
bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize);
void MsgDeleteFile(const char *pFileName);
bool MsgGetFileSize(const char *pFilePath, int* nSize);
int MsgGetFileSize(const char *pFileName);
FILE*  MsgOpenMMSFile(char *pFileName);
bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength);
char* MsgOpenAndReadMmsFile(const char* szFilePath, int offset, int size, int* npSize);
bool MsgWriteSmilFile(const char *pFilePath, char *pData, int DataSize);
int	MsgReadSmilFile(const char *pFileName, char **ppData);
void MsgDeleteSmilFile(const char *pFilePath);
int MsgRmRf(char *pDirPath);
unsigned int MsgDu(const char *pDirPath);
bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize);
void MsgMmsInitDir();
bool MsgAccessFile(const char *filepath, int mode);
bool MsgChmod(const char *filepath, int mode);
bool MsgChown(const char *filepath, int uid, int gid);
bool MsgCreateFile(const char *pFilePath, char *pData, int DataSize);
char *MsgGetDirName(char *file_path);
char *MsgGetFileName(char *file_path);
int MsgCheckFilepathSmack(const char *app_smack_label, char *file_path);

void MsgGetMimeType(char *filePath, char *mimeType, int size);
int MsgTcsScanFile(const char *filepath, int *bLevel);
bool MsgAclInit();
#endif /* MSG_UTIL_FILE_H */