mirror of
https://github.com/aaru-dps/Aaru.Checksums.Native.git
synced 2025-12-16 11:14:29 +00:00
Fix C89.
This commit is contained in:
@@ -38,9 +38,10 @@ AARU_EXPORT adler32_ctx* AARU_CALL adler32_init()
|
||||
|
||||
AARU_EXPORT int AARU_CALL adler32_update(adler32_ctx* ctx, const uint8_t* data, uint32_t len)
|
||||
{
|
||||
uint32_t i;
|
||||
if(!ctx || !data) return -1;
|
||||
|
||||
for(uint32_t i = 0; i < len; i++)
|
||||
for(i = 0; i < len; i++)
|
||||
{
|
||||
ctx->sum1 = (ctx->sum1 + data[i]) % ADLER_MODULE;
|
||||
ctx->sum2 = (ctx->sum2 + ctx->sum1) % ADLER_MODULE;
|
||||
|
||||
3
crc16.c
3
crc16.c
@@ -35,9 +35,10 @@ AARU_EXPORT crc16_ctx* AARU_CALL crc16_init(void)
|
||||
|
||||
AARU_EXPORT int AARU_CALL crc16_update(crc16_ctx* ctx, const uint8_t* data, uint32_t len)
|
||||
{
|
||||
uint32_t i;
|
||||
if(!ctx || !data) return -1;
|
||||
|
||||
for(uint32_t i = 0; i < len; i++) ctx->crc = (ctx->crc >> 8) ^ crc16_table[data[i] ^ (ctx->crc & 0xFF)];
|
||||
for(i = 0; i < len; i++) ctx->crc = (ctx->crc >> 8) ^ crc16_table[data[i] ^ (ctx->crc & 0xFF)];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,10 @@ AARU_EXPORT crc16_ccitt_ctx* AARU_CALL crc16_ccitt_init(void)
|
||||
|
||||
AARU_EXPORT int AARU_CALL crc16_ccitt_update(crc16_ccitt_ctx* ctx, const uint8_t* data, uint32_t len)
|
||||
{
|
||||
uint32_t i;
|
||||
if(!ctx || !data) return -1;
|
||||
|
||||
for(uint32_t i = 0; i < len; i++) ctx->crc = crc16_ccitt_table[(ctx->crc >> 8) ^ data[i]] ^ (ctx->crc << 8);
|
||||
for(i = 0; i < len; i++) ctx->crc = crc16_ccitt_table[(ctx->crc >> 8) ^ data[i]] ^ (ctx->crc << 8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,10 @@ AARU_EXPORT fletcher16_ctx* AARU_CALL fletcher16_init()
|
||||
|
||||
AARU_EXPORT int AARU_CALL fletcher16_update(fletcher16_ctx* ctx, const uint8_t* data, uint32_t len)
|
||||
{
|
||||
uint32_t i;
|
||||
if(!ctx || !data) return -1;
|
||||
|
||||
for(uint32_t i = 0; i < len; i++)
|
||||
for(i = 0; i < len; i++)
|
||||
{
|
||||
ctx->sum1 = (ctx->sum1 + data[i]) % FLETCHER16_MODULE;
|
||||
ctx->sum2 = (ctx->sum2 + ctx->sum1) % FLETCHER16_MODULE;
|
||||
|
||||
@@ -38,9 +38,10 @@ AARU_EXPORT fletcher32_ctx* AARU_CALL fletcher32_init()
|
||||
|
||||
AARU_EXPORT int AARU_CALL fletcher32_update(fletcher32_ctx* ctx, const uint8_t* data, uint32_t len)
|
||||
{
|
||||
uint32_t i;
|
||||
if(!ctx || !data) return -1;
|
||||
|
||||
for(uint32_t i = 0; i < len; i++)
|
||||
for(i = 0; i < len; i++)
|
||||
{
|
||||
ctx->sum1 = (ctx->sum1 + data[i]) % FLETCHER32_MODULE;
|
||||
ctx->sum2 = (ctx->sum2 + ctx->sum1) % FLETCHER32_MODULE;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "library.h"
|
||||
#include "spamsum.h"
|
||||
@@ -45,9 +46,10 @@ AARU_EXPORT spamsum_ctx* AARU_CALL spamsum_init(void)
|
||||
|
||||
AARU_EXPORT int AARU_CALL spamsum_update(spamsum_ctx* ctx, const uint8_t* data, uint32_t len)
|
||||
{
|
||||
int i;
|
||||
if(!ctx || !data) return -1;
|
||||
|
||||
for(int i = 0; i < len; i++) fuzzy_engine_step(ctx, data[i]);
|
||||
for( i = 0; i < len; i++) fuzzy_engine_step(ctx, data[i]);
|
||||
|
||||
ctx->total_size += len;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user