summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d249802)
raw | patch | inline | side by side (parent: d249802)
author | Shahul Hameed <skhajamohid1@bloomberg.net> | |
Wed, 29 Jul 2015 15:06:50 +0000 (11:06 -0400) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 1 Aug 2015 07:08:02 +0000 (09:08 +0200) |
src/utils_crc32.c | patch | blob | history | |
src/utils_crc32.h | patch | blob | history | |
src/write_kafka.c | patch | blob | history |
diff --git a/src/utils_crc32.c b/src/utils_crc32.c
index 4c6d694160c97f49323f872280f3e1d86b320646..f9eaf880c03737863741ce3e12bcd3c8f94ab658 100644 (file)
--- a/src/utils_crc32.c
+++ b/src/utils_crc32.c
* polynomial $edb88320
*/
-#include <sys/types.h>
+#include <stdint.h>
+#include <stddef.h>
-u_int32_t crc32_buffer(const u_char *, size_t);
+uint32_t crc32_buffer(const unsigned char *, size_t);
static unsigned int crc32_tab[] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
/* Return a 32-bit CRC of the contents of the buffer. */
-u_int32_t
-crc32_buffer(const u_char *s, size_t len)
+uint32_t
+crc32_buffer(const unsigned char *s, size_t len)
{
size_t i;
- u_int32_t ret;
+ uint32_t ret;
ret = 0;
for (i = 0; i < len; i++)
diff --git a/src/utils_crc32.h b/src/utils_crc32.h
index 822a62b3dccca5a656b98aaea8338e8387a47c89..cf60d24d7c6e94c62865bea365b8410fb649f5e1 100644 (file)
--- a/src/utils_crc32.h
+++ b/src/utils_crc32.h
#ifndef UTILS_CRC32_H
#define UTILS_CRC32_H 1
-u_int32_t crc32_buffer(const u_char *, size_t);
+uint32_t crc32_buffer(const unsigned char *, size_t);
#endif
diff --git a/src/write_kafka.c b/src/write_kafka.c
index b6e89618ec9ddbf51738556171ace8b278944130..775e2e0934f55613d69e5521a3829a495a8a8c4a 100644 (file)
--- a/src/write_kafka.c
+++ b/src/write_kafka.c
#include "utils_format_json.h"
#include "utils_crc32.h"
-#include <sys/types.h>
+#include <stdint.h>
#include <librdkafka/rdkafka.h>
#include <pthread.h>
#include <zlib.h>
#define KAFKA_FORMAT_JSON 0
#define KAFKA_FORMAT_COMMAND 1
#define KAFKA_FORMAT_GRAPHITE 2
- u_int8_t format;
+ uint8_t format;
unsigned int graphite_flags;
_Bool store_rates;
rd_kafka_topic_conf_t *conf;
rd_kafka_conf_t *kafka_conf;
rd_kafka_t *kafka;
int has_key;
- u_int32_t key;
+ uint32_t key;
char *prefix;
char *postfix;
char escape_char;
const void *keydata, size_t keylen,
int32_t partition_cnt, void *p, void *m)
{
- u_int32_t key = *((u_int32_t *)keydata );
- u_int32_t target = key % partition_cnt;
+ uint32_t key = *((uint32_t *)keydata );
+ uint32_t target = key % partition_cnt;
int32_t i = partition_cnt;
while (--i > 0 && !rd_kafka_topic_partition_available(rkt, target)) {
user_data_t *ud)
{
int status = 0;
- u_int32_t key;
+ uint32_t key;
char buffer[8192];
size_t bfree = sizeof(buffer);
size_t bfill = 0;