Debian Codegraph @

src/d2dbs/dbsdupecheck.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2001 faster ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
19 #include "setup.h"cxx . . $ `<file>/src/d2dbs/setup.h`/
20 #include "dbsdupecheck.h"cxx . . $ `<file>/src/d2dbs/dbsdupecheck.h`/
21
22 #include "common/bn_type.h"cxx . . $ `<file>/src/common/bn_type.h`/
23 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
24 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
25
26 namespace pvpgncxx . . $ pvpgn/
27 {
28
29 namespace d2dbscxx . . $ pvpgn/d2dbs/
30 {
31
32 const char * delimitercxx . . $ pvpgn/d2dbs/delimiter. = "JM";
33
34 int is_delimitcxx . . $ pvpgn/d2dbs/is_delimit(1ef8e6ec083aabb9).(char * data)
35 {
36 if ((data[0] == delimitercxx . . $ pvpgn/d2dbs/delimiter.[0]) && (data[1] == delimitercxx . . $ pvpgn/d2dbs/delimiter.[1])) return 1;
37 else return 0;
38 }
39
40 void * find_delimitercxx . . $ pvpgn/d2dbs/find_delimiter(bd4386618e413df3).(char * data, unsigned int datalen)
41 {
42 char * datap = data;
43 unsigned int count;
44 for (count = 1; count < datalen; count++)
45 {
46 if (is_delimitcxx . . $ pvpgn/d2dbs/is_delimit(1ef8e6ec083aabb9).(datap)) return datap;
47 }
48 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
49 }
50
51 #define SKIPLENcxx . . $ `src/d2dbs/dbsdupecheck.cpp:51:9`! 750
52
53 extern int dbsdupecheckcxx . . $ pvpgn/d2dbs/dbsdupecheck(8fa947920630fc02).(char * data, unsigned int datalen)
54 {
55 char * pointer, *datap;
56 unsigned int restlen;
57
58 unsigned short itemcount, counter;
59 unsigned long uid;
60
61 // skip characters that have never played yet
62 if (datalen < SKIPLENcxx . . $ `src/d2dbs/dbsdupecheck.cpp:51:9`!) return DBSDUPECHECK_CONTAINS_NO_DUPEcxx . . $ `src/d2dbs/dbsdupecheck.h:20:9`!;
63
64 // we skip the first SKIPLEN bytes containing various char infos wo don't care about
65 // this a) speeds things up
66 // and b) prevents us from detecting our magic index in a bad charname ;-)
67 datap = data + SKIPLENcxx . . $ `src/d2dbs/dbsdupecheck.cpp:51:9`!;
68 restlen = datalen - SKIPLENcxx . . $ `src/d2dbs/dbsdupecheck.cpp:51:9`!;
69
70 do
71 {
72 pointer = (char*)find_delimitercxx . . $ pvpgn/d2dbs/find_delimiter(bd4386618e413df3).(datap, restlen);
73 restlen -= (pointer - datap);
74 datap = pointer;
75 } while ((is_delimitcxx . . $ pvpgn/d2dbs/is_delimit(1ef8e6ec083aabb9).(datap) != 1) || (is_delimitcxx . . $ pvpgn/d2dbs/is_delimit(1ef8e6ec083aabb9).(datap + 4) != 1)); // now we should have found "JMxxJM"
76
77 itemcount = bn_short_getcxx . . $ pvpgn/bn_short_get(469dcb4e54b221a8).((bn_basiccxx . . $ pvpgn/bn_basic#*)&datap[2]);
78
79 datap += 4;
80 restlen -= 4;
81
82 for (counter = 0; counter < itemcount; counter++)
83 {
84 if ((datap[4] & 0x20) == 0x20)
85 {
86 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "simple item");
87 datap += 14;
88 restlen -= 14;
89 }
90 else
91 {
92 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "extended item");
93 uid = bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).((bn_basiccxx . . $ pvpgn/bn_basic#*)&datap[14]);
94 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "unique ID: {}", uid);
95 pointer = (char*)find_delimitercxx . . $ pvpgn/d2dbs/find_delimiter(bd4386618e413df3).(datap, restlen);
96 restlen -= (pointer - datap);
97 datap = pointer;
98 }
99 }
100
101 return DBSDUPECHECK_CONTAINS_NO_DUPEcxx . . $ `src/d2dbs/dbsdupecheck.h:20:9`!;
102 }
103
104 }
105
106 }