From 4defb6e9673f5bc75939c336f04b540feaffbca5 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Tue, 21 Jun 2016 12:44:03 +0200 Subject: [PATCH] - Fix myoffsetof using misaligned pointer access. That could be a problem for particularly pedantic platforms. --- src/cmdlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmdlib.h b/src/cmdlib.h index 05e515374..b035842cd 100644 --- a/src/cmdlib.h +++ b/src/cmdlib.h @@ -16,7 +16,7 @@ #include // the dec offsetof macro doesnt work very well... -#define myoffsetof(type,identifier) ((size_t)&((type *)1)->identifier - 1) +#define myoffsetof(type,identifier) ((size_t)&((type *)alignof(type))->identifier - alignof(type)) int Q_filelength (FILE *f); bool FileExists (const char *filename);