diff options
author | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
commit | 117e22047c5752352342d64e3fb7ce00a4eb8113 (patch) | |
tree | e32de2cfba0dda8705ae528fcd1fbe23ba075685 /linden/indra/llmath/llcrc.cpp | |
parent | Second Life viewer sources 1.18.0.6 (diff) | |
download | meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.zip meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.gz meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.bz2 meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.xz |
Second Life viewer sources 1.18.1.2
Diffstat (limited to 'linden/indra/llmath/llcrc.cpp')
-rw-r--r-- | linden/indra/llmath/llcrc.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/linden/indra/llmath/llcrc.cpp b/linden/indra/llmath/llcrc.cpp index cc0f955..5b3ab4b 100644 --- a/linden/indra/llmath/llcrc.cpp +++ b/linden/indra/llmath/llcrc.cpp | |||
@@ -154,11 +154,11 @@ void LLCRC::update(U8 next_byte) | |||
154 | mCurrent = UPDC32(next_byte, mCurrent); | 154 | mCurrent = UPDC32(next_byte, mCurrent); |
155 | } | 155 | } |
156 | 156 | ||
157 | void LLCRC::update(const U8* buffer, U32 buffer_size) | 157 | void LLCRC::update(const U8* buffer, size_t buffer_size) |
158 | { | 158 | { |
159 | for ( ; buffer_size; --buffer_size, ++buffer) | 159 | for (size_t i = 0; i < buffer_size; i++) |
160 | { | 160 | { |
161 | mCurrent = UPDC32(*buffer, mCurrent); | 161 | mCurrent = UPDC32(buffer[i], mCurrent); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
@@ -175,17 +175,24 @@ void LLCRC::update(const char* filename) | |||
175 | if (fp) | 175 | if (fp) |
176 | { | 176 | { |
177 | fseek(fp, 0, SEEK_END); | 177 | fseek(fp, 0, SEEK_END); |
178 | U32 size = ftell(fp); | 178 | long size = ftell(fp); |
179 | 179 | ||
180 | fseek(fp, 0, SEEK_SET); | 180 | fseek(fp, 0, SEEK_SET); |
181 | 181 | ||
182 | if (size > 0) | 182 | if (size > 0) |
183 | { | 183 | { |
184 | U8* data = new U8[size]; | 184 | U8* data = new U8[size]; |
185 | fread(data, size, 1, fp); | 185 | size_t nread; |
186 | |||
187 | nread = fread(data, 1, size, fp); | ||
186 | fclose(fp); | 188 | fclose(fp); |
189 | |||
190 | if (nread < (size_t) size) | ||
191 | { | ||
192 | llwarns << "Short read on " << filename << llendl; | ||
193 | } | ||
187 | 194 | ||
188 | update(data, size); | 195 | update(data, nread); |
189 | delete[] data; | 196 | delete[] data; |
190 | } | 197 | } |
191 | } | 198 | } |