summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fs/ntapi_tt_mount.c4
-rw-r--r--src/fs/ntapi_tt_stat.c2
-rw-r--r--src/internal/ntapi_impl.h2
-rw-r--r--src/msq/ntapi_msq_connect.c2
-rw-r--r--src/sem/ntapi_sem_connect.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/src/fs/ntapi_tt_mount.c b/src/fs/ntapi_tt_mount.c
index f5ae113..448841e 100644
--- a/src/fs/ntapi_tt_mount.c
+++ b/src/fs/ntapi_tt_mount.c
@@ -105,7 +105,7 @@ static int32_t __stdcall __tt_get_dos_drive_device_or_root_handle(
else
return NT_STATUS_INVALID_PARAMETER_2;
- dos_name.strlen = ((size_t)(&((_dos_name_buffer *)0)->root));
+ dos_name.strlen = __offsetof(_dos_name_buffer,root);
dos_name.maxlen = 0;
dos_name.buffer = &(dos_name_buffer.global_prefix[0]);
@@ -232,7 +232,7 @@ int32_t __stdcall __ntapi_tt_get_dos_drive_mount_points(
dev_mount_point->symlink_name_length = 0;
dev_mount_point->unique_id_offset = 0;
dev_mount_point->unique_id_length = 0;
- dev_mount_point->device_name_offset = ((size_t)(&((nt_mount_point_param *)0)->device_name));
+ dev_mount_point->device_name_offset = __offsetof(nt_mount_point_param,device_name);
dev_mount_point->device_name_length = dev_name->name_length;
dev_mount_point->mount_points_offset = 0;
diff --git a/src/fs/ntapi_tt_stat.c b/src/fs/ntapi_tt_stat.c
index cab84c3..088adf6 100644
--- a/src/fs/ntapi_tt_stat.c
+++ b/src/fs/ntapi_tt_stat.c
@@ -56,7 +56,7 @@ int32_t __stdcall __ntapi_tt_stat(
__ntapi->tt_aligned_block_memcpy(
(uintptr_t *)stat,
(uintptr_t *)buffer,
- ((size_t)(&((nt_fai *)0)->name_info)));
+ __offsetof(nt_fai,name_info));
/* record volume-relative file name length */
fai = (nt_fai *)buffer;
diff --git a/src/internal/ntapi_impl.h b/src/internal/ntapi_impl.h
index 4c26f55..791dbc1 100644
--- a/src/internal/ntapi_impl.h
+++ b/src/internal/ntapi_impl.h
@@ -145,7 +145,7 @@ int32_t __ntapi_tt_open_dir_utf8(void ** hfile, void * hat, const char * arg, in
int __ntapi_ipc_page_alloc(struct dalist_ex * dlist, void ** addr, size_t * alloc_size);
/* debug */
-#define __ntidx(x) (&(((ntapi_vtbl *)0)->x)) / sizeof(size_t)
+#define __ntidx(x) __offsetof(ntapi_vtbl,x) / sizeof(size_t)
#endif
diff --git a/src/msq/ntapi_msq_connect.c b/src/msq/ntapi_msq_connect.c
index c4a0f98..301adfa 100644
--- a/src/msq/ntapi_msq_connect.c
+++ b/src/msq/ntapi_msq_connect.c
@@ -114,7 +114,7 @@ static int32_t __msqpid_symlink_set(
__ntapi->tt_port_name_from_attr(
&svcname,&msqctl->attr);
- str.strlen = (uint16_t)(size_t)(&(((nt_port_name *)0)->null_termination));
+ str.strlen = (uint16_t)(__offsetof(nt_port_name,null_termination));
str.maxlen = sizeof(nt_port_name);
str.buffer = svcname.base_named_objects;
diff --git a/src/sem/ntapi_sem_connect.c b/src/sem/ntapi_sem_connect.c
index 2dc9a94..33a4541 100644
--- a/src/sem/ntapi_sem_connect.c
+++ b/src/sem/ntapi_sem_connect.c
@@ -114,7 +114,7 @@ static int32_t __sempid_symlink_set(
__ntapi->tt_port_name_from_attr(
&svcname,&semctl->attr);
- str.strlen = (uint16_t)(size_t)(&(((nt_port_name *)0)->null_termination));
+ str.strlen = (uint16_t)(__offsetof(nt_port_name,null_termination));
str.maxlen = sizeof(nt_port_name);
str.buffer = svcname.base_named_objects;