diff options
author | tjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2007-02-12 18:52:15 +0000 |
---|---|---|
committer | tjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2007-02-12 18:52:15 +0000 |
commit | 1646bf59c7bc568bd4788cc43c166e4eaa0dca3d (patch) | |
tree | 4f34bbcfa05fb4bf7b48f86abd0c851e612584df /code/qcommon | |
parent | 3c238e0604bb62959053e1555e7e38cbd1c4188a (diff) | |
download | ioquake3-aero-1646bf59c7bc568bd4788cc43c166e4eaa0dca3d.tar.gz ioquake3-aero-1646bf59c7bc568bd4788cc43c166e4eaa0dca3d.zip |
* (bug 3019) adds the cvar cl_guidServerUniq (defaults to 1). When set to
non-zero, cl_guid will be unique for each server that the client
connects to
git-svn-id: svn://svn.icculus.org/quake3/trunk@1041 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r-- | code/qcommon/md5.c | 19 | ||||
-rw-r--r-- | code/qcommon/qcommon.h | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/code/qcommon/md5.c b/code/qcommon/md5.c index ffe7752..dcb4e44 100644 --- a/code/qcommon/md5.c +++ b/code/qcommon/md5.c @@ -257,9 +257,9 @@ static void MD5Final(struct MD5Context *ctx, unsigned char *digest) } -char *Com_MD5File(const char *fn, int length) +char *Com_MD5File( const char *fn, int length, const char *prefix, int prefix_len ) { - static char final[33] = {"unknown"}; + static char final[33] = {""}; unsigned char digest[16] = {""}; fileHandle_t f; MD5_CTX md5; @@ -269,8 +269,15 @@ char *Com_MD5File(const char *fn, int length) int r = 0; int total = 0; - filelen = FS_FOpenFileRead(fn, &f, qtrue); - if(filelen < 1) { + Q_strncpyz( final, "", sizeof( final ) ); + + filelen = FS_SV_FOpenFileRead( fn, &f ); + + if( !f ) { + return final; + } + if( filelen < 1 ) { + FS_FCloseFile( f ); return final; } if(filelen < length || !length) { @@ -278,6 +285,10 @@ char *Com_MD5File(const char *fn, int length) } MD5Init(&md5); + + if( prefix_len && *prefix ) + MD5Update(&md5 , (unsigned char *)prefix, prefix_len); + for(;;) { r = FS_Read2(buffer, sizeof(buffer), f); if(r < 1) diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index b07d77e..8bde028 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -732,7 +732,7 @@ void Com_Quit_f( void ); int Com_EventLoop( void ); int Com_Milliseconds( void ); // will be journaled properly unsigned Com_BlockChecksum( const void *buffer, int length ); -char *Com_MD5File(const char *filename, int length); +char *Com_MD5File(const char *filename, int length, const char *prefix, int prefix_len); int Com_HashKey(char *string, int maxlen); int Com_Filter(char *filter, char *name, int casesensitive); int Com_FilterPath(char *filter, char *name, int casesensitive); |