/
0002-ogg.git-ea2b959407.patch
66 lines (59 loc) · 2.28 KB
/
0002-ogg.git-ea2b959407.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From: James Ross-Gowan <rossymiles@gmail.com>
Date: Tue, 17 Jan 2017 09:36:57 +0000 (+1100)
Subject: Fix struct comparison in tests for Win64
X-Git-Tag: v1.3.3~2
X-Git-Url: http://git.xiph.org/?p=ogg.git;a=commitdiff_plain;h=ea2b959407a3adf1da7b675733f4968ea69a64eb
Fix struct comparison in tests for Win64
On 64-bit Windows, sizeof(unsigned char *) is 8, sizeof(long) is 4 and
alignof(ogg_int64_t) is 8. This results in a 4-byte hole in ogg_packet
after "long e_o_s", which means ogg_packet structs cannot be reliably
compared by memcmp. Compare ogg_packet structs member-by-member instead.
This fixes `make check` for me on mingw-w64/GCC.
Signed-off-by: Ralph Giles <giles@thaumas.net>
---
diff --git a/src/framing.c b/src/framing.c
index 6f63ab2..79fc715 100644
--- a/src/framing.c
+++ b/src/framing.c
@@ -1493,6 +1493,34 @@ const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
1,
0};
+int compare_packet(const ogg_packet *op1, const ogg_packet *op2){
+ if(op1->packet!=op2->packet){
+ fprintf(stderr,"op1->packet != op2->packet\n");
+ return(1);
+ }
+ if(op1->bytes!=op2->bytes){
+ fprintf(stderr,"op1->bytes != op2->bytes\n");
+ return(1);
+ }
+ if(op1->b_o_s!=op2->b_o_s){
+ fprintf(stderr,"op1->b_o_s != op2->b_o_s\n");
+ return(1);
+ }
+ if(op1->e_o_s!=op2->e_o_s){
+ fprintf(stderr,"op1->e_o_s != op2->e_o_s\n");
+ return(1);
+ }
+ if(op1->granulepos!=op2->granulepos){
+ fprintf(stderr,"op1->granulepos != op2->granulepos\n");
+ return(1);
+ }
+ if(op1->packetno!=op2->packetno){
+ fprintf(stderr,"op1->packetno != op2->packetno\n");
+ return(1);
+ }
+ return(0);
+}
+
void test_pack(const int *pl, const int **headers, int byteskip,
int pageskip, int packetskip){
unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
@@ -1601,7 +1629,7 @@ void test_pack(const int *pl, const int **headers, int byteskip,
ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
/* verify peek and out match */
- if(memcmp(&op_de,&op_de2,sizeof(op_de))){
+ if(compare_packet(&op_de,&op_de2)){
fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
depacket);
exit(1);