Debian Codegraph @

android/app/jni/extern/SAASound/src/minIni/minGlue-FatFs.h

raw
1 /* Glue functions for the minIni library, based on the FatFs and Petit-FatFs
2 * libraries, see http://elm-chan.org/fsw/ff/00index_e.html
3 *
4 * By CompuPhase, 2008-2019
5 * This "glue file" is in the public domain. It is distributed without
6 * warranties or conditions of any kind, either express or implied.
7 *
8 * (The FatFs and Petit-FatFs libraries are copyright by ChaN and licensed at
9 * its own terms.)
10 */
11
12 #define INI_BUFFERSIZE 256 /* maximum line length, maximum path length */
13
14 /* You must set FF_USE_STRFUNC to 1 or 2 in the include file ff.h (or tff.h)
15 * to enable the "string functions" fgets() and fputs().
16 */
17 #include "ff.h" /* include tff.h for Tiny-FatFs */
18
19 /* When setting FF_USE_STRFUNC to 2 (for LF to CR/LF translation), INI_LINETERM
20 * should be defined to "\n" (otherwise "\r\n" will be translated by FatFS to
21 * "\r\r\n").
22 */
23 #if defined FF_USE_STRFUNC && FF_USE_STRFUNC == 2 && !defined INI_LINETERM
24 #define INI_LINETERM "\n"
25 #endif
26
27 #define INI_FILETYPE FIL
28 #define ini_openread(filename,file) (f_open((file), (filename), FA_READ+FA_OPEN_EXISTING) == FR_OK)
29 #define ini_openwrite(filename,file) (f_open((file), (filename), FA_WRITE+FA_CREATE_ALWAYS) == FR_OK)
30 #define ini_close(file) (f_close(file) == FR_OK)
31 #define ini_read(buffer,size,file) f_gets((buffer), (size), (file))
32 #define ini_write(buffer,file) f_puts((buffer), (file))
33 #define ini_remove(filename) (f_unlink(filename) == FR_OK)
34
35 #define INI_FILEPOS DWORD
36 #define ini_tell(file,pos) (*(pos) = f_tell((file)))
37 #define ini_seek(file,pos) (f_lseek((file), *(pos)) == FR_OK)
38
39 static int ini_rename(TCHAR *source, const TCHAR *dest)
40 {
41 /* Function f_rename() does not allow drive letters in the destination file */
42 char *drive = strchr(dest, ':');
43 drive = (drive == NULL) ? dest : drive + 1;
44 return (f_rename(source, drive) == FR_OK);
45 }