From 9776ff15a091507ceb95ccf41c01d09282ae24f8 Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 21 Mar 2017 15:08:01 +0000 Subject: [PATCH] c99 and endian changes for centos --- crypto/encoding/Makefile | 2 +- crypto/sha1.c | 5 +++++ include/libp2p/net/p2pnet.h | 1 + peer/Makefile | 2 +- secio/Makefile | 2 +- test/Makefile | 4 ++-- utils/Makefile | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/crypto/encoding/Makefile b/crypto/encoding/Makefile index 7fdf705..7eda9dd 100644 --- a/crypto/encoding/Makefile +++ b/crypto/encoding/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../../include -g3 +CFLAGS = -O0 -I../../include -g3 -std=c99 LFLAGS = DEPS = ../../include/libp2p/crypto/encoding/base58.h ../../include/libp2p/crypto/encoding/base64.h \ ../../include/libp2p/crypto/encoding/x509.h ../../include/libp2p/crypto/encoding/base16.h \ diff --git a/crypto/sha1.c b/crypto/sha1.c index 50784c8..192e2d2 100644 --- a/crypto/sha1.c +++ b/crypto/sha1.c @@ -100,6 +100,11 @@ void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]); /* blk0() and blk() perform the initial expand. */ /* I got the idea of expanding during the round function from SSLeay */ +// NOTE: Need to do endianness better +#if (!defined(__BYTE_ORDER__)) +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#endif + #if (defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) #define blk0(i) block->l[i] #elif (defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) diff --git a/include/libp2p/net/p2pnet.h b/include/libp2p/net/p2pnet.h index 132eaf3..a6b3446 100644 --- a/include/libp2p/net/p2pnet.h +++ b/include/libp2p/net/p2pnet.h @@ -2,6 +2,7 @@ #define P2PNET_H #include +#include int socket_open4(); int socket_bind4(int s, uint32_t ip, uint16_t port); diff --git a/peer/Makefile b/peer/Makefile index 0d989e9..0ff9452 100644 --- a/peer/Makefile +++ b/peer/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I../../c-protobuf -I../../c-multihash/include -I../../c-multiaddr/include -g3 +CFLAGS = -O0 -I../include -I../../c-protobuf -I../../c-multihash/include -I../../c-multiaddr/include -g3 -std=c99 LFLAGS = DEPS = OBJS = peer.o peerstore.o providerstore.o diff --git a/secio/Makefile b/secio/Makefile index 0baa3c7..31bb4fc 100644 --- a/secio/Makefile +++ b/secio/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -Wall -I../include -I../../c-protobuf +CFLAGS = -O0 -Wall -I../include -I../../c-protobuf -std=c99 ifdef DEBUG CFLAGS += -g3 diff --git a/test/Makefile b/test/Makefile index aabceac..cfdab55 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -I../include -I. -I../../c-multihash/include -I../../c-multiaddr/include +CFLAGS = -O0 -I../include -I. -I../../c-multihash/include -I../../c-multiaddr/include -std=c99 ifdef DEBUG CFLAGS += -g3 @@ -25,4 +25,4 @@ clean: rm -f *.o rm -f testit_libp2p -test: clean testit_libp2p \ No newline at end of file +test: clean testit_libp2p diff --git a/utils/Makefile b/utils/Makefile index 1921f2c..ca4b4a9 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O0 -Wall -I../include -I../../c-multiaddr/include +CFLAGS = -O0 -Wall -I../include -I../../c-multiaddr/include -std=c99 ifdef DEBUG CFLAGS += -g3