Mercurial > hg-old > index.cgi
comparison lwlink/readfiles.c @ 173:0395e6fd67e9
Fixed stupid errors with changes for archive handling
author | lost |
---|---|
date | Mon, 02 Mar 2009 04:13:49 +0000 |
parents | d610b8aef91b |
children | 6ebb93b409ba |
comparison
equal
deleted
inserted
replaced
172:47427342e41d | 173:0395e6fd67e9 |
---|---|
338 for (;;) | 338 for (;;) |
339 { | 339 { |
340 if (cc >= fn -> filesize || !(fn -> filedata[cc])) | 340 if (cc >= fn -> filesize || !(fn -> filedata[cc])) |
341 return; | 341 return; |
342 | 342 |
343 for (l = cc; cc < fn -> filesize && fn -> filedata[cc]; l++) | 343 for (l = cc; cc < fn -> filesize && fn -> filedata[cc]; cc++) |
344 /* do nothing */ ; | 344 /* do nothing */ ; |
345 | |
346 cc++; | |
345 | 347 |
346 if (cc >= fn -> filesize) | 348 if (cc >= fn -> filesize) |
347 { | 349 { |
348 fprintf(stderr, "Malformed archive file %s.\n", fn -> filename); | 350 fprintf(stderr, "Malformed archive file %s.\n", fn -> filename); |
349 exit(1); | 351 exit(1); |
350 } | 352 } |
351 | 353 |
352 if (cc + 4 > fn -> filesize) | 354 if (cc + 4 > fn -> filesize) |
353 return; | 355 return; |
354 | 356 |
355 flen = (fn -> filedata[cc++] << 24) | (fn -> filedata[cc++] << 16) | 357 flen = (fn -> filedata[cc++] << 24); |
356 | (fn -> filedata[cc++] << 8) | (fn -> filedata[cc]); | 358 flen |= (fn -> filedata[cc++] << 16); |
359 flen |= (fn -> filedata[cc++] << 8); | |
360 flen |= (fn -> filedata[cc++]); | |
357 | 361 |
358 if (flen == 0) | 362 if (flen == 0) |
359 return; | 363 return; |
360 | 364 |
361 if (cc + flen > fn -> filesize) | 365 if (cc + flen > fn -> filesize) |
370 memset(fn -> subs[fn -> nsubs], 0, sizeof(fileinfo_t)); | 374 memset(fn -> subs[fn -> nsubs], 0, sizeof(fileinfo_t)); |
371 fn -> subs[fn -> nsubs] -> filedata = fn -> filedata + cc; | 375 fn -> subs[fn -> nsubs] -> filedata = fn -> filedata + cc; |
372 fn -> subs[fn -> nsubs] -> filesize = flen; | 376 fn -> subs[fn -> nsubs] -> filesize = flen; |
373 fn -> subs[fn -> nsubs] -> filename = lw_strdup(fn -> filedata + l); | 377 fn -> subs[fn -> nsubs] -> filename = lw_strdup(fn -> filedata + l); |
374 fn -> subs[fn -> nsubs] -> parent = fn; | 378 fn -> subs[fn -> nsubs] -> parent = fn; |
379 | |
375 read_file(fn -> subs[fn -> nsubs]); | 380 read_file(fn -> subs[fn -> nsubs]); |
376 fn -> nsubs++; | 381 fn -> nsubs++; |
382 cc += flen; | |
377 } | 383 } |
378 } | 384 } |