Skip to contentSkip to conversation

Fix romfs void pointer compile error

PATCH New Jody Bruchon 1 participant 1 message Feb 11, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix romfs void pointer compile error

commit 82afea9a87740a766e5f2683bf27b312aab95572

Author: Jody Bruchon <[email protected]>
Date:   Sat Feb 11 01:17:00 2012 -0500

In elks/fs/romfs/inode.c, the function romfs_copyfrom() accepts Void *dest, but an invalid lvalue error was generated by this:

((char *)dest) += maxsize;

By asking for char *dest instead, the function compiles properly. Since romfs is "in development," I cannot test the code, but it at least compiles now.

elks/fs/romfs/inode.c +2 -2
index 551e99f..d1381d5 100644
@@ -243,7 +243,7 @@ static int romfs_strnlen(struct inode *i, loff_t offset, size_t count)
     return res;
 }
 
-static int romfs_copyfrom(struct inode *i, void *dest, loff_t offset,
+static int romfs_copyfrom(struct inode *i, char *dest, loff_t offset,
 			  size_t count)
 {
     struct buffer_head *bh;
@@ -279,7 +279,7 @@ static int romfs_copyfrom(struct inode *i, void *dest, loff_t offset,
 
     while (res < count) {
 	offset += maxsize;
-	((char *) dest) += maxsize;
+	*dest += maxsize;
 
 	bh = bread(i->i_dev, (block_t) (offset >> ROMBSBITS));