Debian Codegraph @

src/bniutils/bni.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2000 Marco Ziech ([email protected])
3 Copyright (C) 2000 Ross Combs ([email protected])
4
5 This program is xfree software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
20 #include "bni.h"cxx . . $ `<file>/src/bniutils/bni.h`/
21
22 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
23 #include "fileio.h"cxx . . $ `<file>/src/bniutils/fileio.h`/
24 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
25
26 namespace pvpgncxx . . $ pvpgn/
27 {
28
29 namespace bnicxx . . $ pvpgn/bni/
30 {
31
32 extern t_bnifilecxx . . $ pvpgn/bni/t_bnifile# * load_bnicxx . . $ pvpgn/bni/load_bni(740814a27d52ca3d).(stdcxx . . $ std/::FILEcxx . . $ std/FILE# *f) {
33 t_bnifilecxx . . $ pvpgn/bni/t_bnifile# *b;
34 unsigned int i;
35
36 if (f == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
37 b = (t_bnifilecxx . . $ pvpgn/bni/t_bnifile#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_bnifile));
38 file_rpushcxx . . $ pvpgn/bni/file_rpush(8d4262d45fc644ab).(f);
39 b->unknown1cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown1. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
40 if (b->unknown1cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown1. != 0x00000010)
41 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "load_bni: field 1 is not 0x00000010. Data may be invalid!\n");
42 b->unknown2cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown2. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
43 if (b->unknown2cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown2. != 0x00000001)
44 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "load_bni: field 2 is not 0x00000001. Data may be invalid!\n");
45 b->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
46 if (b->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons. > BNI_MAXICONScxx . . $ `src/bniutils/bni.h:25:9`!) {
47 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "load_bni: more than %d (BNI_MAXICONS) icons. Increase maximum number of icons in \"bni.h\".\n", BNI_MAXICONScxx . . $ `src/bniutils/bni.h:25:9`!);
48 b->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons. = BNI_MAXICONScxx . . $ `src/bniutils/bni.h:25:9`!;
49 }
50 b->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
51 if (b->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons. < 1) {
52 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "load_bni: strange, no icons present in BNI file\n");
53 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
54 }
55 else {
56 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons. = (struct bni_iconlist_structcxx . . $ pvpgn/bni/bni_iconlist_struct#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(b->numicons*sizeof(t_bniicon));
57 }
58 for (i = 0; i < b->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons.; i++) {
59 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
60 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].xcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#x. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
61 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].ycxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#y. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
62 if (b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id. == 0) {
63 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].tagcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#tag. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
64 }
65 else {
66 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].tagcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#tag. = 0;
67 }
68 b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].unknowncxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#unknown. = file_readd_lecxx . . $ pvpgn/bni/file_readd_le(db52760e79bf9054).();
69 }
70 if (stdcxx . . $ std/::ftellcxx . . $ std/ftell(1dcafcd8ef4c6e6c).(f) != (long)b->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset.)
71 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "load_bni: Warning, %lu bytes of garbage after BNI header\n", (unsigned long)(b->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset. - stdcxx . . $ std/::ftellcxx . . $ std/ftell(1dcafcd8ef4c6e6c).(f)));
72 file_rpopcxx . . $ pvpgn/bni/file_rpop(49f6e7a06ebc5aa8).();
73 return b;
74 }
75
76 extern int write_bnicxx . . $ pvpgn/bni/write_bni(330f3994042b07e0).(stdcxx . . $ std/::FILEcxx . . $ std/FILE# *f, t_bnifilecxx . . $ pvpgn/bni/t_bnifile# *b) {
77 unsigned int i;
78
79 if (f == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return -1;
80 if (b == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return -1;
81 file_wpushcxx . . $ pvpgn/bni/file_wpush(8d4262d45fc644ab).(f);
82 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->unknown1cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown1.);
83 if (b->unknown1cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown1. != 0x00000010)
84 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "write_bni: field 1 is not 0x00000010. Data may be invalid!\n");
85 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->unknown2cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown2.);
86 if (b->unknown2cxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#unknown2. != 0x00000001)
87 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "write_bni: field 2 is not 0x00000001. Data may be invalid!\n");
88 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons.);
89 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset.);
90 for (i = 0; i < b->numiconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#numicons.; i++) {
91 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id.);
92 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].xcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#x.);
93 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].ycxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#y.);
94 if (b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].idcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#id. == 0) {
95 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].tagcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#tag.);
96 }
97 file_writed_lecxx . . $ pvpgn/bni/file_writed_le(4c679297bf94b9eb).(b->iconscxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#icons.->iconcxx . . $ pvpgn/bni/bni_iconlist_struct#icon.[i].unknowncxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_0#unknown.);
98 }
99 if (stdcxx . . $ std/::ftellcxx . . $ std/ftell(1dcafcd8ef4c6e6c).(f) != (long)b->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset.)
100 stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Warning: dataoffset is incorrect! (=0x%lx should be 0x%lx)\n", (unsigned long)b->dataoffsetcxx . . $ pvpgn/bni/$anonymous_type_7e9560d5c9d60d71_1#dataoffset., (unsigned long)stdcxx . . $ std/::ftellcxx . . $ std/ftell(1dcafcd8ef4c6e6c).(f));
101 file_wpopcxx . . $ pvpgn/bni/file_wpop(49f6e7a06ebc5aa8).();
102 return 0;
103 }
104
105 }
106
107 }