diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llcommon/llcrc.h | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llcommon/llcrc.h')
-rw-r--r-- | linden/indra/llcommon/llcrc.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/linden/indra/llcommon/llcrc.h b/linden/indra/llcommon/llcrc.h new file mode 100644 index 0000000..20f214e --- /dev/null +++ b/linden/indra/llcommon/llcrc.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /** | ||
2 | * @file llcrc.h | ||
3 | * @brief LLCRC class header file. | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2002-2008, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | ||
22 | * By copying, modifying or distributing this software, you acknowledge | ||
23 | * that you have read and understood your obligations described above, | ||
24 | * and agree to abide by those obligations. | ||
25 | * | ||
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
28 | * COMPLETENESS OR PERFORMANCE. | ||
29 | * $/LicenseInfo$ | ||
30 | */ | ||
31 | |||
32 | #ifndef LL_LLCRC_H | ||
33 | #define LL_LLCRC_H | ||
34 | |||
35 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
36 | // Class llcrc | ||
37 | // | ||
38 | // Simple 32 bit crc. To use, instantiate an LLCRC instance and feed | ||
39 | // it the bytes you want to check. It will update the internal crc as | ||
40 | // you go, and you can qery it at the end. As a horribly inefficient | ||
41 | // example (don't try this at work kids): | ||
42 | // | ||
43 | // LLCRC crc; | ||
44 | // FILE* fp = LLFile::fopen(filename,"rb"); | ||
45 | // while(!feof(fp)) { | ||
46 | // crc.update(fgetc(fp)); | ||
47 | // } | ||
48 | // fclose(fp); | ||
49 | // llinfos << "File crc: " << crc.getCRC() << llendl; | ||
50 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
51 | |||
52 | class LLCRC | ||
53 | { | ||
54 | protected: | ||
55 | U32 mCurrent; | ||
56 | |||
57 | public: | ||
58 | LLCRC(); | ||
59 | |||
60 | U32 getCRC() const; | ||
61 | void update(U8 next_byte); | ||
62 | void update(const U8* buffer, size_t buffer_size); | ||
63 | void update(const std::string& filename); | ||
64 | |||
65 | #ifdef _DEBUG | ||
66 | // This function runs tests to make sure the crc is | ||
67 | // working. Returns TRUE if it is. | ||
68 | static BOOL testHarness(); | ||
69 | #endif | ||
70 | }; | ||
71 | |||
72 | |||
73 | #endif // LL_LLCRC_H | ||