MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / GetChecksum

Method GetChecksum

neo/framework/DeclManager.cpp:1043–1080  ·  view source on GitHub ↗

=================== idDeclManagerLocal::GetChecksum =================== */

Source from the content-addressed store, hash-verified

1041===================
1042*/
1043int idDeclManagerLocal::GetChecksum( void ) const {
1044 int i, j, total, num;
1045 int *checksumData;
1046
1047 // get the total number of decls
1048 total = 0;
1049 for ( i = 0; i < DECL_MAX_TYPES; i++ ) {
1050 total += linearLists[i].Num();
1051 }
1052
1053 checksumData = (int *) _alloca16( total * 2 * sizeof( int ) );
1054
1055 total = 0;
1056 for ( i = 0; i < DECL_MAX_TYPES; i++ ) {
1057 declType_t type = (declType_t) i;
1058
1059 // FIXME: not particularly pretty but PDAs and associated decls are localized and should not be checksummed
1060 if ( type == DECL_PDA || type == DECL_VIDEO || type == DECL_AUDIO || type == DECL_EMAIL ) {
1061 continue;
1062 }
1063
1064 num = linearLists[i].Num();
1065 for ( j = 0; j < num; j++ ) {
1066 idDeclLocal *decl = linearLists[i][j];
1067
1068 if ( decl->sourceFile == &implicitDecls ) {
1069 continue;
1070 }
1071
1072 checksumData[total*2+0] = total;
1073 checksumData[total*2+1] = decl->checksum;
1074 total++;
1075 }
1076 }
1077
1078 LittleRevBytes( checksumData, sizeof(int), total * 2 );
1079 return MD5_BlockChecksum( checksumData, total * 2 * sizeof( int ) );
1080}
1081
1082/*
1083===================

Callers 2

SpawnMethod · 0.80
ConnectToServerMethod · 0.80

Calls 3

LittleRevBytesFunction · 0.85
MD5_BlockChecksumFunction · 0.85
NumMethod · 0.45

Tested by

no test coverage detected