1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-11 19:24:10 +01:00
LibrePilot/flight/PiOS/STM32F10x/Libraries/minIni/minGlue.c
stac 874239154a Turn on -Werror on openpilot firmware build
This commit fixes all existing warnings.

All basic compiler warnings will now be treated as errors.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@658 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-24 16:33:46 +00:00

96 lines
1.8 KiB
C

#include "dosfs.h"
#include "pios.h"
#include "minGlue.h"
/* Global Variables */
extern uint8_t PIOS_SDCARD_Sector[SECTOR_SIZE];
extern VOLINFO PIOS_SDCARD_VolInfo;
/* Local Variables */
static uint32_t SuccessCount;
int dosfs_ini_openread(const char *filename, PFILEINFO file)
{
if(DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_READ, PIOS_SDCARD_Sector, file)) {
/* Error opening file */
return 0;
}
/* No errors */
return 1;
}
int dosfs_ini_openwrite(const char *filename, PFILEINFO file)
{
/* TODO: Check this works */
if(DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_WRITE, PIOS_SDCARD_Sector, file)) {
/* Error opening file */
return 0;
}
/* No errors */
return 1;
}
int dosfs_ini_close(PFILEINFO file)
{
/* This doesn't actually do anything */
DFS_Close(file);
/* No errors */
return 1;
}
int dosfs_ini_read(char *buffer, int size, PFILEINFO file)
{
if(PIOS_SDCARD_ReadLine(file, (uint8_t *)buffer, size) < 0)
{
/* Error reading line */
return 0;
}
/* No errors */
return 1;
}
int dosfs_ini_write(const char *buffer, PFILEINFO file)
{
/* TODO: Check this works */
DFS_WriteFile(file, PIOS_SDCARD_Sector, (uint8_t *)buffer, &SuccessCount, sizeof(buffer));
/* No errors */
return 1;
}
int dosfs_ini_rename(const char *source, const char *dest)
{
if(PIOS_SDCARD_FileCopy((char *)source, (char *)dest)) {
/* Error renaming file */
return 0;
}
/* No errors */
return 1;
}
int dosfs_ini_remove(const char *filename)
{
/* Remove the file */
if(PIOS_SDCARD_FileDelete((char *)filename)) {
/* Error deleting file */
return 0;
}
/* No errors */
return 1;
}
int dosfs_ini_rewind(PFILEINFO file)
{
/* TODO: Check this works */
DFS_Seek(file, 0, PIOS_SDCARD_Sector);
/* No errors */
return 1;
}