shithub: lwext4

Download patch

ref: e702a129dc5b73885b53d4ab01d1d5fd4f53df1b
parent: a354f63d53a22ed38158069664c887e0ae3b5f86
author: gkostka <kostka.grzegorz@gmail.com>
date: Sat Nov 8 11:07:15 EST 2014

ext4_write: parameter litt fix (const)

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -934,14 +934,11 @@
     return r;
 }
 
-int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
+int ext4_fwrite(ext4_file *f, const void *buf, uint32_t size, uint32_t *wcnt)
 {
-    int r = EOK;
     uint32_t u;
     uint32_t fblock;
-    struct ext4_block b;
-    uint8_t *u8_buf = buf;
-    struct ext4_inode_ref ref;
+
     uint32_t sblock;
     uint32_t sblock_end;
     uint32_t file_blocks;
@@ -948,6 +945,11 @@
     uint32_t block_size;
     uint32_t fblock_start;
     uint32_t fblock_cnt;
+
+    struct ext4_block b;
+    struct ext4_inode_ref ref;
+    const uint8_t *u8_buf = buf;
+    int r;;
 
     ext4_assert(f && f->mp);
 
--- a/lwext4/ext4.h
+++ b/lwext4/ext4.h
@@ -292,7 +292,7 @@
  * @param   size write length
  * @param   wcnt bytes written (may be NULL)
  * @return  standard error code*/
-int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt);
+int ext4_fwrite(ext4_file *f, const void *buf, uint32_t size, uint32_t *wcnt);
 
 /**@brief   File seek operation.
  * @param   f file handle