ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/image.C
(Generate patch)

Comparing deliantra/server/socket/image.C (file contents):
Revision 1.19 by root, Thu Feb 15 18:09:34 2007 UTC vs.
Revision 1.22 by pippijn, Thu Mar 1 12:28:17 2007 UTC

33 * things like all the structures as globals. 33 * things like all the structures as globals.
34 */ 34 */
35 35
36#include <global.h> 36#include <global.h>
37#include <sproto.h> 37#include <sproto.h>
38
39#include "crc.h"
38 40
39#define MAX_FACE_SETS 20 /**< Maximum number of image sets the program will handle */ 41#define MAX_FACE_SETS 20 /**< Maximum number of image sets the program will handle */
40 42
41/** Information about one image */ 43/** Information about one image */
42typedef struct FaceInfo 44typedef struct FaceInfo
280 LOG (llevError, "read_client_images: Image num %d not in 0..%d\n%s", num, nrofpixmaps, buf); 282 LOG (llevError, "read_client_images: Image num %d not in 0..%d\n%s", num, nrofpixmaps, buf);
281 abort (); 283 abort ();
282 } 284 }
283 285
284 /* Skip accross the number data */ 286 /* Skip accross the number data */
285 for (cp = buf + 6; *cp != ' '; cp++); 287 for (cp = buf + 6; *cp != ' '; cp++)
288 ;
289
286 len = atoi (cp); 290 len = atoi (cp);
287 if (len == 0 || len > MAX_IMAGE_SIZE) 291 if (len == 0 || len > MAX_IMAGE_SIZE)
288 { 292 {
289 LOG (llevError, "read_client_images: length not valid: %d > %d \n%s", len, MAX_IMAGE_SIZE, buf); 293 LOG (llevError, "read_client_images: length not valid: %d > %d \n%s", len, MAX_IMAGE_SIZE, buf);
290 abort (); 294 abort ();
299 { 303 {
300 LOG (llevError, "read_client_images: Did not read desired amount of data, wanted %d, got %d\n%s", len, i, buf); 304 LOG (llevError, "read_client_images: Did not read desired amount of data, wanted %d, got %d\n%s", len, i, buf);
301 abort (); 305 abort ();
302 } 306 }
303 307
304 facesets[fileno].faces[num].checksum = 0; 308 crc32 chksum;
309
305 for (i = 0; i < len; i++) 310 for (i = 0; i < len; i++)
306 { 311 chksum (facesets[fileno].faces[num].data[i]);
307 rotate_right (facesets[fileno].faces[num].checksum); 312
308 facesets[fileno].faces[num].checksum += facesets[fileno].faces[num].data[i];
309 facesets[fileno].faces[num].checksum &= 0xffffffff; 313 facesets[fileno].faces[num].checksum = chksum;
310 }
311 } 314 }
312 315
313 close_and_delete (infile, compressed); 316 close_and_delete (infile, compressed);
314 } /* For fileno < MAX_FACE_SETS */ 317 } /* For fileno < MAX_FACE_SETS */
315} 318}
438 */ 441 */
439void 442void
440send_image_sums (client *ns, char *params) 443send_image_sums (client *ns, char *params)
441{ 444{
442 int start, stop; 445 int start, stop;
443 char *cp, buf[MAX_BUF]; 446 char *cp;
444 447
445 packet sl; 448 packet sl;
446 449
447 start = atoi (params); 450 start = atoi (params);
448 for (cp = params; *cp != '\0'; cp++) 451 for (cp = params; *cp != '\0'; cp++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines