comparison src/dmzlib.c @ 2414:69a5af2eb1ea

Remove useless dmMemset().
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Jan 2020 23:27:01 +0200
parents 36edd316184a
children 8d8197b3d052
comparison
equal deleted inserted replaced
2413:902cc22018a1 2414:69a5af2eb1ea
90 static int dmZLibBuildHuffmanTables(DMZHuffmanContext * ctx, const Uint8 * sizelist, const int num) 90 static int dmZLibBuildHuffmanTables(DMZHuffmanContext * ctx, const Uint8 * sizelist, const int num)
91 { 91 {
92 int i, k = 0; 92 int i, k = 0;
93 int code, nextCode[16], sizes[17]; 93 int code, nextCode[16], sizes[17];
94 94
95 dmMemset(sizes, 0, sizeof(sizes)); 95 memset(sizes, 0, sizeof(sizes));
96 dmMemset(ctx->fast, 0, sizeof(ctx->fast)); 96 memset(ctx->fast, 0, sizeof(ctx->fast));
97 97
98 for (i = 0; i < num; i++) 98 for (i = 0; i < num; i++)
99 sizes[sizelist[i]]++; 99 sizes[sizelist[i]]++;
100 100
101 sizes[0] = 0; 101 sizes[0] = 0;
410 hlit, hdist); 410 hlit, hdist);
411 } 411 }
412 412
413 // Get lengths table (uninitialized entries should be set to 0) 413 // Get lengths table (uninitialized entries should be set to 0)
414 codeLengths[256] = 0; 414 codeLengths[256] = 0;
415 dmMemset(codeLengthSizes, 0, sizeof(codeLengthSizes)); 415 memset(codeLengthSizes, 0, sizeof(codeLengthSizes));
416 for (i = 0; i < hclen; i++) 416 for (i = 0; i < hclen; i++)
417 { 417 {
418 int s = dmZReceive(ctx, 3); 418 int s = dmZReceive(ctx, 3);
419 codeLengthSizes[dm_zlib_length_dezigzag[i]] = (Uint8) s; 419 codeLengthSizes[dm_zlib_length_dezigzag[i]] = (Uint8) s;
420 } 420 }
445 if (n == 0) 445 if (n == 0)
446 { 446 {
447 return dmErrorDBG(DMERR_INVALID_DATA, 447 return dmErrorDBG(DMERR_INVALID_DATA,
448 "Invalid bit length repeat.\n"); 448 "Invalid bit length repeat.\n");
449 } 449 }
450 dmMemset(codeLengths + n, codeLengths[n - 1], bv); 450 memset(codeLengths + n, codeLengths[n - 1], bv);
451 n += bv; 451 n += bv;
452 } 452 }
453 else 453 else
454 if (c == 17) 454 if (c == 17)
455 { 455 {
456 int bv = dmZReceive(ctx, 3) + 3; 456 int bv = dmZReceive(ctx, 3) + 3;
457 dmMemset(codeLengths + n, 0, bv); 457 memset(codeLengths + n, 0, bv);
458 n += bv; 458 n += bv;
459 } 459 }
460 else 460 else
461 { 461 {
462 int bv = dmZReceive(ctx, 7) + 11; 462 int bv = dmZReceive(ctx, 7) + 11;
463 dmMemset(codeLengths + n, 0, bv); 463 memset(codeLengths + n, 0, bv);
464 n += bv; 464 n += bv;
465 } 465 }
466 } 466 }
467 467
468 if (codeLengths[256] == 0) 468 if (codeLengths[256] == 0)
560 int dmZLibInitInflate(DMZLibContext *ctx) 560 int dmZLibInitInflate(DMZLibContext *ctx)
561 { 561 {
562 if (ctx == NULL) 562 if (ctx == NULL)
563 return DMERR_NULLPTR; 563 return DMERR_NULLPTR;
564 564
565 dmMemset(ctx, 0, sizeof(DMZLibContext)); 565 memset(ctx, 0, sizeof(DMZLibContext));
566 return DMERR_OK; 566 return DMERR_OK;
567 } 567 }
568 568
569 569
570 void dmZLibCloseInflate(DMZLibContext *ctx) 570 void dmZLibCloseInflate(DMZLibContext *ctx)
571 { 571 {
572 if (ctx != NULL) 572 if (ctx != NULL)
573 { 573 {
574 dmMemset(ctx, 0, sizeof(DMZLibContext)); 574 memset(ctx, 0, sizeof(DMZLibContext));
575 } 575 }
576 } 576 }
577 577
578 578
579 int dmZLibInflate(DMZLibContext * ctx) 579 int dmZLibInflate(DMZLibContext * ctx)