Moved CRC32 from core to logic (no bug, r=me).
Moved CRC32 from core to logic (no bug, r=me).
1.1 --- a/core/AMBuilder Thu Jan 14 03:29:31 2010 -0800
1.2 +++ b/core/AMBuilder Mon Jan 18 03:08:52 2010 -0800
1.3 @@ -14,7 +14,6 @@
1.4 'AdminCache.cpp',
1.5 'ExtensionSys.cpp',
1.6 'MenuStyle_Valve.cpp',
1.7 - 'sm_crc32.cpp',
1.8 'logic_bridge.cpp',
1.9 'smn_entities.cpp',
1.10 'sm_stringutil.cpp',
2.1 --- a/core/GameConfigs.cpp Thu Jan 14 03:29:31 2010 -0800
2.2 +++ b/core/GameConfigs.cpp Mon Jan 18 03:08:52 2010 -0800
2.3 @@ -39,7 +39,7 @@
2.4 #include "MemoryUtils.h"
2.5 #include "LibrarySys.h"
2.6 #include "HandleSys.h"
2.7 -#include "sm_crc32.h"
2.8 +#include "logic_bridge.h"
2.9
2.10 #if defined PLATFORM_LINUX
2.11 #include <dlfcn.h>
3.1 --- a/core/Makefile Thu Jan 14 03:29:31 2010 -0800
3.2 +++ b/core/Makefile Mon Jan 18 03:08:52 2010 -0800
3.3 @@ -19,7 +19,7 @@
3.4 MemoryUtils.cpp PlayerManager.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
3.5 sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
3.6 sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
3.7 - MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
3.8 + MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp \
3.9 frame_hooks.cpp concmd_cleaner.cpp PhraseCollection.cpp NextMap.cpp \
3.10 NativeOwner.cpp logic_bridge.cpp ConsoleDetours.cpp
3.11 OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
4.1 --- a/core/PluginSys.h Thu Jan 14 03:29:31 2010 -0800
4.2 +++ b/core/PluginSys.h Mon Jan 18 03:08:52 2010 -0800
4.3 @@ -473,3 +473,4 @@
4.4 extern CPluginManager g_PluginSys;
4.5
4.6 #endif //_INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
4.7 +
5.1 --- a/core/logic/AMBuilder Thu Jan 14 03:29:31 2010 -0800
5.2 +++ b/core/logic/AMBuilder Mon Jan 18 03:08:52 2010 -0800
5.3 @@ -29,7 +29,8 @@
5.4 'smn_textparse.cpp',
5.5 'smn_adt_trie.cpp',
5.6 'Profiler.cpp',
5.7 - 'smn_functions.cpp'
5.8 + 'smn_functions.cpp',
5.9 + 'sm_crc32.cpp'
5.10 ]
5.11 if AMBuild.target['platform'] == 'windows':
5.12 files.append('thread/WinThreads.cpp')
6.1 --- a/core/logic/Makefile Thu Jan 14 03:29:31 2010 -0800
6.2 +++ b/core/logic/Makefile Mon Jan 18 03:08:52 2010 -0800
6.3 @@ -25,7 +25,8 @@
6.4 smn_textparse.cpp \
6.5 smn_adt_trie.cpp \
6.6 Profiler.cpp \
6.7 - smn_functions.cpp
6.8 + smn_functions.cpp \
6.9 + sm_crc32.cpp
6.10
6.11 ##############################################
6.12 ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
7.1 --- a/core/logic/common_logic.cpp Thu Jan 14 03:29:31 2010 -0800
7.2 +++ b/core/logic/common_logic.cpp Mon Jan 18 03:08:52 2010 -0800
7.3 @@ -36,6 +36,7 @@
7.4 #include "ThreadSupport.h"
7.5 #include "TextParsers.h"
7.6 #include "Profiler.h"
7.7 +#include "sm_crc32.h"
7.8
7.9 sm_core_t smcore;
7.10 IHandleSys *handlesys;
7.11 @@ -54,7 +55,8 @@
7.12 {
7.13 NULL,
7.14 g_pThreader,
7.15 - sm_profiler
7.16 + sm_profiler,
7.17 + UTIL_CRC32
7.18 };
7.19
7.20 static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
8.1 --- a/core/logic/intercom.h Thu Jan 14 03:29:31 2010 -0800
8.2 +++ b/core/logic/intercom.h Mon Jan 18 03:08:52 2010 -0800
8.3 @@ -42,7 +42,7 @@
8.4 * Add 1 to the RHS of this expression to bump the intercom file
8.5 * This is to prevent mismatching core/logic binaries
8.6 */
8.7 -#define SM_LOGIC_MAGIC (0x0F47C0DE - 2)
8.8 +#define SM_LOGIC_MAGIC (0x0F47C0DE - 3)
8.9
8.10 #if defined SM_LOGIC
8.11 class IVEngineServer
8.12 @@ -96,6 +96,7 @@
8.13 SMGlobalClass *head;
8.14 IThreader *threader;
8.15 IProfiler *profiler;
8.16 + unsigned int (*CRC32)(const void *, size_t);
8.17 };
8.18
8.19 typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
9.1 --- a/core/logic_bridge.cpp Thu Jan 14 03:29:31 2010 -0800
9.2 +++ b/core/logic_bridge.cpp Mon Jan 18 03:08:52 2010 -0800
9.3 @@ -43,12 +43,14 @@
9.4 #include "ShareSys.h"
9.5 #include "sm_srvcmds.h"
9.6 #include "ForwardSys.h"
9.7 +#include "logic_bridge.h"
9.8
9.9 static ILibrary *g_pLogic = NULL;
9.10 static LogicInitFunction logic_init_fn;
9.11
9.12 IThreader *g_pThreader;
9.13 ITextParsers *textparsers;
9.14 +SM_FN_CRC32 UTIL_CRC32;
9.15
9.16 class VEngineServer_Logic : public IVEngineServer_Logic
9.17 {
9.18 @@ -126,6 +128,7 @@
9.19
9.20 g_pThreader = logic.threader;
9.21 g_pSourcePawn2->SetProfiler(logic.profiler);
9.22 + UTIL_CRC32 = logic.CRC32;
9.23 }
9.24
9.25 bool StartLogicBridge(char *error, size_t maxlength)
10.1 --- a/core/logic_bridge.h Thu Jan 14 03:29:31 2010 -0800
10.2 +++ b/core/logic_bridge.h Mon Jan 18 03:08:52 2010 -0800
10.3 @@ -35,5 +35,9 @@
10.4 bool StartLogicBridge(char *error, size_t maxlength);
10.5 void ShutdownLogicBridge();
10.6
10.7 +typedef unsigned int (*SM_FN_CRC32)(const void *, size_t);
10.8 +
10.9 +extern SM_FN_CRC32 UTIL_CRC32;
10.10 +
10.11 #endif /* _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_ */
10.12
11.1 --- a/core/msvc9/sourcemod_mm.vcproj Thu Jan 14 03:29:31 2010 -0800
11.2 +++ b/core/msvc9/sourcemod_mm.vcproj Mon Jan 18 03:08:52 2010 -0800
11.3 @@ -2037,10 +2037,6 @@
11.4 >
11.5 </File>
11.6 <File
11.7 - RelativePath="..\sm_crc32.cpp"
11.8 - >
11.9 - </File>
11.10 - <File
11.11 RelativePath="..\sm_memtable.cpp"
11.12 >
11.13 </File>
11.14 @@ -2243,10 +2239,6 @@
11.15 >
11.16 </File>
11.17 <File
11.18 - RelativePath="..\sm_crc32.h"
11.19 - >
11.20 - </File>
11.21 - <File
11.22 RelativePath="..\sm_fastlink.h"
11.23 >
11.24 </File>
12.1 --- a/core/sm_crc32.cpp Thu Jan 14 03:29:31 2010 -0800
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,96 +0,0 @@
12.4 -/**
12.5 - * vim: set ts=4 :
12.6 - * =============================================================================
12.7 - * SourceMod
12.8 - * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
12.9 - * =============================================================================
12.10 - *
12.11 - * This program is free software; you can redistribute it and/or modify it under
12.12 - * the terms of the GNU General Public License, version 3.0, as published by the
12.13 - * Free Software Foundation.
12.14 - *
12.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
12.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12.18 - * details.
12.19 - *
12.20 - * You should have received a copy of the GNU General Public License along with
12.21 - * this program. If not, see <http://www.gnu.org/licenses/>.
12.22 - *
12.23 - * As a special exception, AlliedModders LLC gives you permission to link the
12.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
12.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
12.26 - * by the Valve Corporation. You must obey the GNU General Public License in
12.27 - * all respects for all other code used. Additionally, AlliedModders LLC grants
12.28 - * this exception to all derivative works. AlliedModders LLC defines further
12.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
12.30 - * or <http://www.sourcemod.net/license.php>.
12.31 - *
12.32 - * Version: $Id$
12.33 - */
12.34 -
12.35 -#include "sm_crc32.h"
12.36 -
12.37 -/**
12.38 - * Polynomial: 0x04C11DB7
12.39 - */
12.40 -const unsigned int CRCTable[256] = {
12.41 - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
12.42 - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
12.43 - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
12.44 - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
12.45 - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
12.46 - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
12.47 - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
12.48 - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
12.49 - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
12.50 - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
12.51 - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
12.52 - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
12.53 - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
12.54 - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
12.55 - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
12.56 - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
12.57 - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
12.58 - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
12.59 - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
12.60 - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
12.61 - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
12.62 - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
12.63 - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
12.64 - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
12.65 - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
12.66 - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
12.67 - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
12.68 - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
12.69 - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
12.70 - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
12.71 - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
12.72 - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
12.73 - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
12.74 - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
12.75 - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
12.76 - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
12.77 - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
12.78 - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
12.79 - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
12.80 - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
12.81 - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
12.82 - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
12.83 - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
12.84 -
12.85 -unsigned int UTIL_CRC32(const void *pdata, size_t data_length)
12.86 -{
12.87 - unsigned char *data = (unsigned char *)pdata;
12.88 - unsigned int crc = 0xFFFFFFFF;
12.89 - unsigned char c;
12.90 -
12.91 - for (size_t i=0; i<data_length; i++, data++)
12.92 - {
12.93 - c = (unsigned char)((crc ^ *data) & 0xFF);
12.94 - crc = CRCTable[c] ^ (crc >> 8);
12.95 - }
12.96 -
12.97 - return crc;
12.98 -}
12.99 -
13.1 --- a/core/sm_crc32.h Thu Jan 14 03:29:31 2010 -0800
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,40 +0,0 @@
13.4 -/**
13.5 - * vim: set ts=4 :
13.6 - * =============================================================================
13.7 - * SourceMod
13.8 - * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
13.9 - * =============================================================================
13.10 - *
13.11 - * This program is free software; you can redistribute it and/or modify it under
13.12 - * the terms of the GNU General Public License, version 3.0, as published by the
13.13 - * Free Software Foundation.
13.14 - *
13.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
13.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13.18 - * details.
13.19 - *
13.20 - * You should have received a copy of the GNU General Public License along with
13.21 - * this program. If not, see <http://www.gnu.org/licenses/>.
13.22 - *
13.23 - * As a special exception, AlliedModders LLC gives you permission to link the
13.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
13.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
13.26 - * by the Valve Corporation. You must obey the GNU General Public License in
13.27 - * all respects for all other code used. Additionally, AlliedModders LLC grants
13.28 - * this exception to all derivative works. AlliedModders LLC defines further
13.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
13.30 - * or <http://www.sourcemod.net/license.php>.
13.31 - *
13.32 - * Version: $Id$
13.33 - */
13.34 -
13.35 -#ifndef _INCLUDE_SOURCEMOD_CRC32_H_
13.36 -#define _INCLUDE_SOURCEMOD_CRC32_H_
13.37 -
13.38 -#include <stddef.h>
13.39 -
13.40 -unsigned int UTIL_CRC32(const void *data, size_t data_length);
13.41 -
13.42 -#endif //_INCLUDE_SOURCEMOD_CRC32_H_
13.43 -