2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef MSG_UTIL_FILE_H
18 #define MSG_UTIL_FILE_H
21 /*==================================================================================================
23 ==================================================================================================*/
24 #define FM_READ_WRITE_BUFFER_MAX (1024*1024*3)
26 /*==================================================================================================
28 ==================================================================================================*/
30 bool MakeThumbnail(char *srcPath, char *dstPath);
31 /** file operation wrapper - for avoding runtime error */
32 FILE* MsgOpenFile(const char* filepath, const char* opt);
33 void MsgCloseFile(FILE* pFile);
34 int MsgFseek(FILE* pFile, long int offset, int origin);
35 size_t MsgWriteFile(const char* pData, size_t size, size_t count, FILE *pFile);
36 size_t MsgReadFile(void *pData, size_t size, size_t count, FILE *pFile);
37 long int MsgFtell(FILE *pFile);
38 int MsgFflush(FILE *pFile);
39 int MsgFsync(FILE *pFile);
41 bool MsgCreateFileName(char *pFileName);
42 bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize);
43 bool MsgReadFileForDecode(FILE* pFile, char* pBuf, int length, int* nSize);
44 bool MsgWriteDataFromEncodeBuffer(FILE* pFile, char* pInBuffer, int *pPtr, int maxLen, int* pOffset );
45 bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize);
46 void MsgDeleteFile(const char *pFileName);
47 bool MsgGetFileSize(const char *pFilePath, int* nSize);
48 int MsgGetFileSize(const char *pFileName);
49 FILE* MsgOpenMMSFile(char *pFileName);
50 bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength);
51 char* MsgOpenAndReadMmsFile(const char* szFilePath, int offset, int size, int* npSize );
52 bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize);
53 int MsgReadSmilFile(const char *pFileName, char **ppData);
54 void MsgDeleteSmilFile(const char *pFilePath);
55 int MsgRmRf(char *pDirPath);
56 unsigned int MsgDu(const char *pDirPath);
57 bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize);
59 bool MsgAccessFile(const char *filepath, int mode);
60 bool MsgChmod(const char *filepath, int mode);
61 bool MsgChown(const char *filepath, int uid, int gid);
62 bool MsgCreateFile(const char *pFilePath,char *pData, int DataSize);
63 char *MsgGetDirName(char *file_path);
64 char *MsgGetFileName(char *file_path);
65 int MsgCheckFilepathSmack(const char *app_smack_label, char *file_path);
67 bool MsgScanFile(char *filePath);
68 void MsgGetMimeType(char *filePath, char *mimeType, int size);
69 #endif // MSG_UTIL_FILE_H