Browse Source

make api string params const

pull/53/head
Richard Antony Burton 9 years ago
parent
commit
c2235ccb6f
  1. 12
      src/spiffs.h
  2. 12
      src/spiffs_hydrogen.c

12
src/spiffs.h

@ -315,7 +315,7 @@ void SPIFFS_unmount(spiffs *fs);
* @param path the path of the new file * @param path the path of the new file
* @param mode ignored, for posix compliance * @param mode ignored, for posix compliance
*/ */
s32_t SPIFFS_creat(spiffs *fs, char *path, spiffs_mode mode); s32_t SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode);
/** /**
* Opens/creates a file. * Opens/creates a file.
@ -326,7 +326,7 @@ s32_t SPIFFS_creat(spiffs *fs, char *path, spiffs_mode mode);
* SPIFFS_WR_ONLY, SPIFFS_RDWR, SPIFFS_DIRECT * SPIFFS_WR_ONLY, SPIFFS_RDWR, SPIFFS_DIRECT
* @param mode ignored, for posix compliance * @param mode ignored, for posix compliance
*/ */
spiffs_file SPIFFS_open(spiffs *fs, char *path, spiffs_flags flags, spiffs_mode mode); spiffs_file SPIFFS_open(spiffs *fs, const char *path, spiffs_flags flags, spiffs_mode mode);
/** /**
@ -381,7 +381,7 @@ s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence);
* @param fs the file system struct * @param fs the file system struct
* @param path the path of the file to remove * @param path the path of the file to remove
*/ */
s32_t SPIFFS_remove(spiffs *fs, char *path); s32_t SPIFFS_remove(spiffs *fs, const char *path);
/** /**
* Removes a file by filehandle * Removes a file by filehandle
@ -396,7 +396,7 @@ s32_t SPIFFS_fremove(spiffs *fs, spiffs_file fh);
* @param path the path of the file to stat * @param path the path of the file to stat
* @param s the stat struct to populate * @param s the stat struct to populate
*/ */
s32_t SPIFFS_stat(spiffs *fs, char *path, spiffs_stat *s); s32_t SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s);
/** /**
* Gets file status by filehandle * Gets file status by filehandle
@ -426,7 +426,7 @@ s32_t SPIFFS_close(spiffs *fs, spiffs_file fh);
* @param old path of file to rename * @param old path of file to rename
* @param newPath new path of file * @param newPath new path of file
*/ */
s32_t SPIFFS_rename(spiffs *fs, char *old, char *newPath); s32_t SPIFFS_rename(spiffs *fs, const char *old, const char *newPath);
/** /**
* Returns last error of last file operation. * Returns last error of last file operation.
@ -449,7 +449,7 @@ void SPIFFS_clearerr(spiffs *fs);
* @param name the name of the directory * @param name the name of the directory
* @param d pointer the directory stream to be populated * @param d pointer the directory stream to be populated
*/ */
spiffs_DIR *SPIFFS_opendir(spiffs *fs, char *name, spiffs_DIR *d); spiffs_DIR *SPIFFS_opendir(spiffs *fs, const char *name, spiffs_DIR *d);
/** /**
* Closes a directory stream * Closes a directory stream

12
src/spiffs_hydrogen.c

@ -166,7 +166,7 @@ void SPIFFS_clearerr(spiffs *fs) {
fs->err_code = SPIFFS_OK; fs->err_code = SPIFFS_OK;
} }
s32_t SPIFFS_creat(spiffs *fs, char *path, spiffs_mode mode) { s32_t SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode) {
(void)mode; (void)mode;
SPIFFS_API_CHECK_CFG(fs); SPIFFS_API_CHECK_CFG(fs);
SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_API_CHECK_MOUNT(fs);
@ -182,7 +182,7 @@ s32_t SPIFFS_creat(spiffs *fs, char *path, spiffs_mode mode) {
return 0; return 0;
} }
spiffs_file SPIFFS_open(spiffs *fs, char *path, spiffs_flags flags, spiffs_mode mode) { spiffs_file SPIFFS_open(spiffs *fs, const char *path, spiffs_flags flags, spiffs_mode mode) {
(void)mode; (void)mode;
SPIFFS_API_CHECK_CFG(fs); SPIFFS_API_CHECK_CFG(fs);
SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_API_CHECK_MOUNT(fs);
@ -522,7 +522,7 @@ s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) {
return offs; return offs;
} }
s32_t SPIFFS_remove(spiffs *fs, char *path) { s32_t SPIFFS_remove(spiffs *fs, const char *path) {
SPIFFS_API_CHECK_CFG(fs); SPIFFS_API_CHECK_CFG(fs);
SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_API_CHECK_MOUNT(fs);
SPIFFS_LOCK(fs); SPIFFS_LOCK(fs);
@ -607,7 +607,7 @@ static s32_t spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spi
return res; return res;
} }
s32_t SPIFFS_stat(spiffs *fs, char *path, spiffs_stat *s) { s32_t SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s) {
SPIFFS_API_CHECK_CFG(fs); SPIFFS_API_CHECK_CFG(fs);
SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_API_CHECK_MOUNT(fs);
SPIFFS_LOCK(fs); SPIFFS_LOCK(fs);
@ -720,7 +720,7 @@ s32_t SPIFFS_close(spiffs *fs, spiffs_file fh) {
return res; return res;
} }
s32_t SPIFFS_rename(spiffs *fs, char *old, char *new) { s32_t SPIFFS_rename(spiffs *fs, const char *old, const char *new) {
SPIFFS_API_CHECK_CFG(fs); SPIFFS_API_CHECK_CFG(fs);
SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_API_CHECK_MOUNT(fs);
SPIFFS_LOCK(fs); SPIFFS_LOCK(fs);
@ -760,7 +760,7 @@ s32_t SPIFFS_rename(spiffs *fs, char *old, char *new) {
return res; return res;
} }
spiffs_DIR *SPIFFS_opendir(spiffs *fs, char *name, spiffs_DIR *d) { spiffs_DIR *SPIFFS_opendir(spiffs *fs, const char *name, spiffs_DIR *d) {
(void)name; (void)name;
if (!SPIFFS_CHECK_CFG((fs))) { if (!SPIFFS_CHECK_CFG((fs))) {

Loading…
Cancel
Save