forked from pool/deutex
This commit is contained in:
parent
01054533a4
commit
173630e629
@ -1,4 +1,4 @@
|
||||
From 8531292e3e13f713188187e21565b81669c9e0c7 Mon Sep 17 00:00:00 2001
|
||||
From e954d4e296383f6b48fac9f8bf7b413aa70b4cc1 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: Mon, 1 Jan 2018 20:18:38 +0100
|
||||
Subject: [PATCH] Fix strict aliasing violations
|
||||
@ -35,7 +35,7 @@ deutex.c:1249:21: warning:
|
||||
1 file changed, 18 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/deutex.c b/src/deutex.c
|
||||
index 15ff8c3..f52608c 100644
|
||||
index 15ff8c3..f14dc82 100644
|
||||
--- a/src/deutex.c
|
||||
+++ b/src/deutex.c
|
||||
@@ -1124,11 +1124,14 @@ void COMhelp(int argc, const char *argv[])
|
||||
@ -48,9 +48,9 @@ index 15ff8c3..f52608c 100644
|
||||
printf("%s:\n", d->help);
|
||||
- width1 = *((short *) &d->exec) + OPTINDENT;
|
||||
- width2 = *((short *) &d->use);
|
||||
+ memcpy(&tmp, &d->exec, sizeof(tmp));
|
||||
+ memcpy(&tmp, d->exec, sizeof(tmp));
|
||||
+ width1 = tmp + OPTINDENT;
|
||||
+ memcpy(&tmp, &d->use, sizeof(tmp));
|
||||
+ memcpy(&tmp, d->use, sizeof(tmp));
|
||||
+ width2 = tmp;
|
||||
if (width1 + 1 + width2 > TTYCOL)
|
||||
width1 = TTYCOL - width2 - COLSPACING;
|
||||
@ -71,7 +71,7 @@ index 15ff8c3..f52608c 100644
|
||||
/* Can't happen */
|
||||
- *((short *) ¤t_section->com) = SHRT_MAX;
|
||||
+ tmp = SHRT_MAX;
|
||||
+ memcpy(¤t_section->com, &tmp, sizeof(tmp));
|
||||
+ memcpy(current_section->com, &tmp, sizeof(tmp));
|
||||
|
||||
- *((short *) ¤t_section->exec) = (short) width1t;
|
||||
- if (*((short *) ¤t_section->exec) != width1t)
|
||||
@ -80,7 +80,7 @@ index 15ff8c3..f52608c 100644
|
||||
+ tmp = width1t;
|
||||
+ if (tmp != width1t)
|
||||
+ tmp = SHRT_MAX;
|
||||
+ memcpy(¤t_section->exec, &tmp, sizeof(tmp));
|
||||
+ memcpy(current_section->exec, &tmp, sizeof(tmp));
|
||||
|
||||
- *((short *) ¤t_section->use) = (short) width2t;
|
||||
- if (*((short *) ¤t_section->use) != width2t)
|
||||
@ -89,7 +89,7 @@ index 15ff8c3..f52608c 100644
|
||||
+ tmp = width2t;
|
||||
+ if (tmp != width2t)
|
||||
+ tmp = SHRT_MAX;
|
||||
+ memcpy(¤t_section->use, &tmp, sizeof(tmp));
|
||||
+ memcpy(current_section->use, &tmp, sizeof(tmp));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user