From 95c4806835cf9b049c5af1a42fd49ed7de82947b Mon Sep 17 00:00:00 2001
From: Vincent Dupont <vincent@otakeys.com>
Date: Mon, 11 Jul 2016 19:57:31 +0200
Subject: [PATCH 1/2] Use const pointer in write functions

---
 src/spiffs.h          | 2 +-
 src/spiffs_hydrogen.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/spiffs.h b/src/spiffs.h
index bea90b3..dfe967d 100644
--- a/src/spiffs.h
+++ b/src/spiffs.h
@@ -459,7 +459,7 @@ s32_t SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, s32_t len);
  * @param len           how much to write
  * @returns number of bytes written, or -1 if error
  */
-s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len);
+s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, const void *buf, s32_t len);
 
 /**
  * Moves the read/write file offset. Resulting offset is returned or negative if error.
diff --git a/src/spiffs_hydrogen.c b/src/spiffs_hydrogen.c
index 1cf64ff..8eb3919 100644
--- a/src/spiffs_hydrogen.c
+++ b/src/spiffs_hydrogen.c
@@ -411,7 +411,7 @@ s32_t SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
 }
 
 #if !SPIFFS_READ_ONLY
-static s32_t spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, void *buf, u32_t offset, s32_t len) {
+static s32_t spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, const void *buf, u32_t offset, s32_t len) {
   (void)fs;
   s32_t res = SPIFFS_OK;
   s32_t remaining = len;
@@ -434,7 +434,7 @@ static s32_t spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, void *buf, u32_t offs
 }
 #endif // !SPIFFS_READ_ONLY
 
-s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
+s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, const void *buf, s32_t len) {
 #if SPIFFS_READ_ONLY
   (void)fs; (void)fh; (void)buf; (void)len;
   return SPIFFS_ERR_RO_NOT_IMPL;
-- 
2.9.3