From 31cb5e8260bb2cc00643d9cc835da52d5851be5d Mon Sep 17 00:00:00 2001 From: "Peter S. May" Date: Fri, 12 Jul 2002 06:45:56 +0000 Subject: [PATCH] Added function GetCrc32ForString. --- stepmania/src/RageUtil.cpp | 10 ++++++++++ stepmania/src/RageUtil.h | 1 + 2 files changed, 11 insertions(+) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 402a19b7b2..a4998e79c1 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -286,6 +286,16 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bRe ::FindClose( hFind ); } +//----------------------------------------------------------------------------- +// Name: GetCrc32ForString( CString s) +// Desc: Coerces CString into an unsigned char array and runs CRC-32 on it. +//----------------------------------------------------------------------------- +unsigned int GetCrc32ForString( CString s ) +{ + // A CString has built in length data! Isn't that great? + return GetCrc32((unsigned char*)s.GetBuffer(s.GetLength()), s.GetLength()); +} + //----------------------------------------------------------------------------- // Name: GetHashForString( CString s ) // Desc: This new version of GetHashForString uses a stronger hashing algorithm diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 8eaa1737ad..c3ed424355 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -98,6 +98,7 @@ CString join( void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false, bool bReturnPathToo=false ); int GetHashForString( CString s ); +unsigned int GetCrc32ForString( CString s ); int GetHashForFile( CString sPath ); int GetHashForDirectory( CString sDir ); // a hash value that remains the same as long as nothing in the directory has changed