-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compiler warnings (Visual Studio 2019) #232
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -809,7 +809,7 @@ static int pthread_create(pthread_t *th, pthread_attr_t *attr, void *(* func)(vo | |
if (attr) | ||
{ | ||
tv->p_state = attr->p_state; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Bit of a personal style, even though "unsigned ssize;" is legal, I'm not a fan of it. Should it accidentally in the future be corrected to "unsigned int ssize;" I would not be objecting :) |
||
ssize = attr->s_size; | ||
ssize = (unsigned int) attr->s_size; | ||
} | ||
|
||
/* Make sure tv->h has value of -1 */ | ||
|
@@ -965,7 +965,7 @@ static int pthread_mutex_timedlock(pthread_mutex_t *m, struct timespec *ts) | |
if (ct > t) return ETIMEDOUT; | ||
|
||
/* Wait on semaphore within critical section */ | ||
WaitForSingleObject(((struct _pthread_crit_t *)m)->sem, t - ct); | ||
WaitForSingleObject(((struct _pthread_crit_t *)m)->sem, (DWORD) (t - ct)); | ||
|
||
/* Try to grab lock */ | ||
if (!pthread_mutex_trylock(m)) return 0; | ||
|
@@ -1305,7 +1305,7 @@ static int pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m, struct | |
|
||
pthread_testcancel(); | ||
|
||
if (!SleepConditionVariableCS(c, m, tm)) return ETIMEDOUT; | ||
if (!SleepConditionVariableCS(c, m, (DWORD)tm)) return ETIMEDOUT; | ||
|
||
/* We can have a spurious wakeup after the timeout */ | ||
if (!_pthread_rel_time_in_ms(t)) return ETIMEDOUT; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ extern int wosix_close(int fd); | |
extern int wosix_ioctl(int fd, unsigned long request, void *zc); | ||
extern int wosix_read(int fd, void *data, uint32_t len); | ||
extern int wosix_write(int fd, const void *data, uint32_t len); | ||
extern int wosix_isatty(int fd); | ||
extern int wosix_isatty(intptr_t fd); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which would defeat the purpose of a posix wrapper library taking posix "int fd" and handling it for the local platform.
|
||
extern int wosix_mkdir(const char *path, mode_t mode); | ||
extern int wosix_pwrite(int fd, const void *buf, size_t nbyte, off_t offset); | ||
extern int wosix_pread(int fd, void *buf, size_t nbyte, off_t offset); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,7 @@ dir_is_empty_stat(const char *dirname) | |
* We only want to return false if the given path is a non empty | ||
* directory, all other errors are handled elsewhere. | ||
*/ | ||
if (stat(dirname, &st) < 0 || !S_ISDIR(st.st_mode)) { | ||
if (stat(dirname, (struct stat*)&st) < 0 || !S_ISDIR(st.st_mode)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure we should define |
||
return (B_TRUE); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7372,7 +7372,7 @@ zfsdev_open(dev_t dev, int flags, int devtype, struct proc *p) | |
#ifdef _WIN32 | ||
int flags = 0; | ||
int devtype = 0; | ||
struct proc *p = current_proc(); | ||
PEPROCESS p = current_proc(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine. But ultimately we want |
||
PAGED_CODE(); | ||
|
||
#endif | ||
|
@@ -7405,12 +7405,12 @@ zfsdev_release(dev_t dev, int flags, int devtype, struct proc *p) | |
#ifdef _WIN32 | ||
int flags = 0; | ||
int devtype = 0; | ||
struct proc *p = current_proc(); | ||
PEPROCESS p = current_proc(); | ||
PAGED_CODE(); | ||
|
||
#endif | ||
|
||
dprintf("zfsdev_release, dev 0x%x flag %02X devtype %d, dev is %p, thread %p\n", | ||
dprintf("zfsdev_release, dev 0x%x flag %02X devtype %d, proc is %p, thread %p\n", | ||
minor(dev), flags, devtype, p, current_thread()); | ||
mutex_enter(&zfsdev_state_lock); | ||
error = zfsdev_state_destroy(dev); | ||
|
@@ -7864,7 +7864,7 @@ zfs_attach(void) | |
&ioctlDeviceObject); // Returned ptr to Device Object | ||
|
||
if (!NT_SUCCESS(ntStatus)) { | ||
dprintf(("ZFS: Couldn't create the device object /dev/zfs (%wZ)\n", ZFS_DEV_KERNEL)); | ||
dprintf("ZFS: Couldn't create the device object /dev/zfs (%wZ)\n", ZFS_DEV_KERNEL); | ||
return ntStatus; | ||
} | ||
dprintf("ZFS: created kernel device node: %p: name %wZ\n", ioctlDeviceObject, ZFS_DEV_KERNEL); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is tricky. libefi is a library we got from ZOL, and due to that, it uses posix
"int fd"
for file-descriptors. I wrote the hacky "wosix" wrapper around thatHANDLE
s will "often" fit inside anint
, and we convert (truncate) between the two usingHTOI()
andITOH()
- which should "hide" any warnings wrt to truncation.We could claim ownership of libefi, and make it "ours", but much of libzfs also uses
int fd
, and changing that could make future merges painful. I can think of a few way to address this though.Which leads to a bigger discussion on how we should handle that in future.