mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
Windows: read and write take void* buffers, open takes a const char*
nt_read and nt_write were defined to take a char* buffer which was then cast to a void *. Meantime every call of OS_READ and OS_WRITE were casting to a char*. Equally every call of OS_OPEN was passing down a const char*, causing warnings. This checkin fixes this: nt_read : char* to void* nt_write: char* to const void* nt_open char* to const char* Change-Id: Id4e138b9d347e1a9f35241e162a105d5f462b168 Reviewed-on: http://gerrit.openafs.org/3744 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
parent
42c5806599
commit
6d2636b886
@ -2742,7 +2742,7 @@ convertVolumeInfo(FD_t fdr, FD_t fdw, afs_uint32 vid)
|
||||
struct VolumeDiskData vd;
|
||||
char *p;
|
||||
|
||||
if (OS_READ(fdr, (char *)&vd, sizeof(struct VolumeDiskData)) !=
|
||||
if (OS_READ(fdr, &vd, sizeof(struct VolumeDiskData)) !=
|
||||
sizeof(struct VolumeDiskData)) {
|
||||
Log("1 convertVolumeInfo: read failed for %lu with code %d\n",
|
||||
afs_printable_uint32_lu(vid),
|
||||
@ -2761,7 +2761,7 @@ convertVolumeInfo(FD_t fdr, FD_t fdw, afs_uint32 vid)
|
||||
if (p && !strcmp(p, ".readonly")) {
|
||||
memset(p, 0, 9);
|
||||
}
|
||||
if (OS_WRITE(fdw, (char *)&vd, sizeof(struct VolumeDiskData)) !=
|
||||
if (OS_WRITE(fdw, &vd, sizeof(struct VolumeDiskData)) !=
|
||||
sizeof(struct VolumeDiskData)) {
|
||||
Log("1 convertVolumeInfo: write failed for %lu with code %d\n",
|
||||
afs_printable_uint32_lu(vid),
|
||||
|
@ -76,7 +76,7 @@ nt_unlink(char *name)
|
||||
* the handle or -1 on error.
|
||||
*/
|
||||
FD_t
|
||||
nt_open(char *name, int flags, int mode)
|
||||
nt_open(const char *name, int flags, int mode)
|
||||
{
|
||||
HANDLE fh;
|
||||
DWORD nt_access = 0;
|
||||
@ -141,12 +141,12 @@ nt_close(FD_t fd)
|
||||
}
|
||||
|
||||
int
|
||||
nt_write(FD_t fd, char *buf, afs_sfsize_t size)
|
||||
nt_write(FD_t fd, void *buf, afs_sfsize_t size)
|
||||
{
|
||||
BOOL code;
|
||||
DWORD nbytes;
|
||||
|
||||
code = WriteFile((HANDLE) fd, (void *)buf, (DWORD) size, &nbytes, NULL);
|
||||
code = WriteFile((HANDLE) fd, buf, (DWORD) size, &nbytes, NULL);
|
||||
|
||||
if (!code) {
|
||||
errno = nterr_nt2unix(GetLastError(), EBADF);
|
||||
@ -181,12 +181,12 @@ nt_pwrite(FD_t fd, const void * buf, afs_sfsize_t count, afs_foff_t offset)
|
||||
}
|
||||
|
||||
int
|
||||
nt_read(FD_t fd, char *buf, afs_sfsize_t size)
|
||||
nt_read(FD_t fd, void *buf, afs_sfsize_t size)
|
||||
{
|
||||
BOOL code;
|
||||
DWORD nbytes;
|
||||
|
||||
code = ReadFile((HANDLE) fd, (void *)buf, (DWORD) size, &nbytes, NULL);
|
||||
code = ReadFile((HANDLE) fd, buf, (DWORD) size, &nbytes, NULL);
|
||||
|
||||
if (!code) {
|
||||
DWORD gle = GetLastError();
|
||||
|
@ -22,10 +22,10 @@ extern char *PrintInode(char *, Inode);
|
||||
#endif
|
||||
|
||||
/* Basic file operations */
|
||||
extern FD_t nt_open(char *name, int flags, int mode);
|
||||
extern FD_t nt_open(const char *name, int flags, int mode);
|
||||
extern int nt_close(FD_t fd);
|
||||
extern int nt_write(FD_t fd, char *buf, afs_sfsize_t size);
|
||||
extern int nt_read(FD_t fd, char *buf, afs_sfsize_t size);
|
||||
extern int nt_write(FD_t fd, void *buf, afs_sfsize_t size);
|
||||
extern int nt_read(FD_t fd, void *buf, afs_sfsize_t size);
|
||||
extern int nt_pread(FD_t fd, void * buf, afs_sfsize_t count, afs_foff_t offset);
|
||||
extern int nt_pwrite(FD_t fd, const void * buf, afs_sfsize_t count, afs_foff_t offset);
|
||||
extern afs_sfsize_t nt_size(FD_t fd);
|
||||
|
Loading…
Reference in New Issue
Block a user