[Libsysio-commit] HEAD: libsysio/drivers/incore fs_incore.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-02-24 15:12:44
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32223/drivers/incore Modified Files: fs_incore.c Log Message: Cleaned out all the pointer arithmetic utilizing void pointers. No longer build the empty statvfs{64} modules. All in an attempt to make the code C99 compliant. Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- fs_incore.c 14 Feb 2004 19:42:57 -0000 1.14 +++ fs_incore.c 24 Feb 2004 14:58:26 -0000 1.15 @@ -377,7 +377,7 @@ _sysio_incore_init() /* * Move to entry for `..' */ - de = (void *)de + off; + de = (struct intnl_dirent *)((char *)de + off); de->d_reclen = INCORE_D_RECLEN(2); #ifdef _DIRENT_HAVE_D_NAMLEN de->d_namlen = 2; @@ -446,7 +446,7 @@ incore_trunc(struct incore_inode *icino, return -ENOSPC; icino->ici_data = p; if (clear && n > icino->ici_st.st_size) - (void )memset(icino->ici_data + icino->ici_st.st_size, + (void )memset((char *)icino->ici_data + icino->ici_st.st_size, 0, (size_t )(n - icino->ici_st.st_size)); out: @@ -495,12 +495,14 @@ incore_directory_new(struct incore_files sizeof(incore_dir_template)); de = icino->ici_data; de->d_ino = st->st_ino; - (void *)de += + de = + (struct intnl_dirent *)((char *)de + #ifdef _DIRENT_HAVE_D_OFF - de->d_off; + de->d_off #else - de->d_reclen; + de->d_reclen #endif + ); de->d_ino = parent->ici_st.st_ino; /* @@ -754,7 +756,7 @@ incore_directory_probe(void *data, } if (n >= siz) break; - de = data + n; + de = (struct intnl_dirent *)((char *)data + n); } return NULL; @@ -948,7 +950,7 @@ incore_directory_enumerate(struct intnl_ if (reclen > cinfo->nbytes) return de; (void *)memcpy(cinfo->data, de, reclen); - cinfo->data += reclen; + cinfo->data = (char *)cinfo->data + reclen; cinfo->nbytes -= reclen; return NULL; } @@ -973,7 +975,7 @@ _sysio_incore_dirop_getdirentries(struct *basep, (probe_ty )incore_directory_position, NULL, - icino->ici_data + *basep); + (char *)icino->ici_data + *basep); if (!de) { /* * Past EOF. @@ -984,7 +986,7 @@ _sysio_incore_dirop_getdirentries(struct copy_info.data = buf; copy_info.nbytes = nbytes; - off = (void *)de - icino->ici_data; + off = (char *)de - (char *)icino->ici_data; de = incore_directory_probe(de, icino->ici_st.st_size - off, @@ -1037,7 +1039,7 @@ incore_directory_insert(struct incore_in if (de) return -EEXIST; de = lookup_data.de; - xt = (void *)lookup_data.de - parent->ici_data; + xt = (char *)lookup_data.de - (char *)parent->ici_data; n = #ifdef _DIRENT_HAVE_D_OFF de->d_off; @@ -1057,7 +1059,7 @@ incore_directory_insert(struct incore_in err = incore_trunc(parent, xt + r + reclen, 1); if (err) return err; - de = parent->ici_data + xt; + de = (struct intnl_dirent *)((char *)parent->ici_data + xt); n = parent->ici_st.st_size; } @@ -1066,7 +1068,7 @@ incore_directory_insert(struct incore_in #else de->d_reclen = r; #endif - (void *)de += r; /* reposition */ + de = (struct intnl_dirent *)((char *)de + r); /* reposition */ xt += r; #ifndef _DIRENT_HAVE_D_OFF @@ -1213,13 +1215,13 @@ incore_unlink_entry(struct incore_inode &lookup_data); if (!de) return -ENOENT; - assert((size_t )((void *)de - - icino->ici_data) >= sizeof(incore_dir_template)); + assert((size_t )((char *)de - (char *)icino->ici_data) >= + sizeof(incore_dir_template)); #ifndef _DIRENT_HAVE_D_OFF reclen = de->d_reclen; #else off = de->d_off; - reclen = off - ((void *)de - icino->ici_data); + reclen = off - ((char *)de - (char *)icino->ici_data); #endif (void )memset(de, 0, reclen); #ifndef _DIRENT_HAVE_D_OFF @@ -1492,7 +1494,7 @@ incore_read(void *buf, size_t nbytes, n = icino->ici_st.st_size - (size_t )off; if (n > nbytes) n = nbytes; - (void )memcpy(buf, icino->ici_data + off, (size_t )n); + (void )memcpy(buf, (char *)icino->ici_data + off, (size_t )n); return (ssize_t )n; } @@ -1531,7 +1533,7 @@ incore_write(const void *buf, size_t nby if (err) return err; } - (void )memcpy(icino->ici_data + off, buf, nbytes); + (void )memcpy((char *)icino->ici_data + off, buf, nbytes); return (ssize_t )nbytes; } |