CVS update: php3/dbase
| From: | martin | Date: | Tue, 05 Jan 1999 16:22:38 +0000 |
| Subject: | CVS update: php3/dbase | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3287@lists.php.net to get a copy of this message | ||
Date: Tuesday January 5, 1999 @ 11:22
Author: martin
Update of /repository/php3/dbase
In directory asf:/u/temp/cvs-serv20900
Modified Files:
dbf_head.c dbf_ndx.c
Log Message:
On platforms where read(), write() et al. are prototyped to accept
a char* buffer, passing a structure results in (sometimes invalid)
conversion. Use explicit generic cast for structures.
Index: php3/dbase/dbf_head.c
diff -c php3/dbase/dbf_head.c:1.3 php3/dbase/dbf_head.c:1.4
*** php3/dbase/dbf_head.c:1.3 Mon Nov 23 01:07:27 1998
--- php3/dbase/dbf_head.c Tue Jan 5 11:22:28 1999
***************
*** 27,33 ****
return NULL;
if (lseek(fd, 0, 0) < 0)
return NULL;
! if ((ret = read(fd, &dbhead, sizeof(dbhead))) < 0)
return NULL;
/* build in core info */
--- 27,33 ----
return NULL;
if (lseek(fd, 0, 0) < 0)
return NULL;
! if ((ret = read(fd, (void *)&dbhead, sizeof(dbhead))) < 0)
return NULL;
/* build in core info */
***************
*** 106,112 ****
if (lseek(fd, 0, 0) < 0)
return -1;
! if ((ret = write(fd, &dbhead, sizeof(dbhead))) < 0)
return -1;
return ret;
}
--- 106,112 ----
if (lseek(fd, 0, 0) < 0)
return -1;
! if ((ret = write(fd, (void *)&dbhead, sizeof(dbhead))) < 0)
return -1;
return ret;
}
***************
*** 119,125 ****
struct dbf_dfield dbfield;
int ret;
! if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
return ret;
}
--- 119,125 ----
struct dbf_dfield dbfield;
int ret;
! if ((ret = read(dbh->db_fd, (void *)&dbfield, sizeof(dbfield))) < 0) {
return ret;
}
***************
*** 170,176 ****
}
/* now write it out to disk */
! if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
return ret;
}
return 1;
--- 170,176 ----
}
/* now write it out to disk */
! if ((ret = write(dbh->db_fd, (void *)&dbfield, sizeof(dbfield))) < 0) {
return ret;
}
return 1;
Index: php3/dbase/dbf_ndx.c
diff -c php3/dbase/dbf_ndx.c:1.2 php3/dbase/dbf_ndx.c:1.3
*** php3/dbase/dbf_ndx.c:1.2 Sun Dec 20 23:20:59 1998
--- php3/dbase/dbf_ndx.c Tue Jan 5 11:22:29 1999
***************
*** 24,30 ****
free(dp);
return NULL;
}
! if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) {
free(dp); free(np);
return NULL;
}
--- 24,30 ----
free(dp);
return NULL;
}
! if ((lseek(fd, 0, 0) < 0) || (read(fd, (void *)dp, NDX_PAGE_SZ) < 0)) {
free(dp); free(np);
return NULL;
}
***************
*** 65,71 ****
}
fp->ndxp_page_data = dp;
if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) ||
! (read(hp->ndx_fd, dp, NDX_PAGE_SZ) < 0)) {
free(fp); free(dp);
return NULL;
}
--- 65,71 ----
}
fp->ndxp_page_data = dp;
if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) ||
! (read(hp->ndx_fd, (void *)dp, NDX_PAGE_SZ) < 0)) {
free(fp); free(dp);
return NULL;
}
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net