Turned on warnings for compilation
This commit is contained in:
parent
362ef81cb7
commit
bf9ddfd6f6
18 changed files with 26 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -50,6 +50,6 @@ int ipfs_blockstore_put(struct Block* block, struct FSRepo* fs_repo) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// send to Put with key
|
// send to Put with key
|
||||||
fs_repo->config->datastore->datastore_put(key, key_length, block, fs_repo->config->datastore);
|
fs_repo->config->datastore->datastore_put(key, key_length, block->data, block->data_length, fs_repo->config->datastore);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include
|
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall
|
||||||
LFLAGS =
|
LFLAGS =
|
||||||
DEPS = ../include/ipfs/commands/argument.h ../include/ipfs/commands/command_option.h \
|
DEPS = ../include/ipfs/commands/argument.h ../include/ipfs/commands/command_option.h \
|
||||||
../include/ipfs/commands/command.h ../include/ipfs/commands/context.h \
|
../include/ipfs/commands/command.h ../include/ipfs/commands/context.h \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include
|
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -Wall
|
||||||
LFLAGS =
|
LFLAGS =
|
||||||
DEPS = parse.h
|
DEPS = parse.h
|
||||||
OBJS = parse.o
|
OBJS = parse.o
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall
|
||||||
LFLAGS =
|
LFLAGS =
|
||||||
DEPS = builder.h ipfs_node.h
|
DEPS = builder.h ipfs_node.h
|
||||||
OBJS = builder.o
|
OBJS = builder.o
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../lmdb/libraries/liblmdb
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../lmdb/libraries/liblmdb -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -20,7 +20,7 @@ struct Datastore {
|
||||||
// function pointers for datastore operations
|
// function pointers for datastore operations
|
||||||
int (*datastore_open)(int argc, char** argv, struct Datastore* datastore);
|
int (*datastore_open)(int argc, char** argv, struct Datastore* datastore);
|
||||||
int (*datastore_close)(struct Datastore* datastore);
|
int (*datastore_close)(struct Datastore* datastore);
|
||||||
int (*datastore_put)(const char* key, size_t key_size, struct Block* block, struct Datastore* datastore);
|
int (*datastore_put)(const char* key, size_t key_size, unsigned char* data, size_t data_length, struct Datastore* datastore);
|
||||||
//int (*datastore_get)(const char* key, struct Block* block);
|
//int (*datastore_get)(const char* key, struct Block* block);
|
||||||
// a handle to the datastore "context" used by the datastore
|
// a handle to the datastore "context" used by the datastore
|
||||||
void* handle;
|
void* handle;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall
|
||||||
LFLAGS =
|
LFLAGS =
|
||||||
DEPS =
|
DEPS =
|
||||||
OBJS = utils.o
|
OBJS = utils.o
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../c-multihash/include
|
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../c-multihash/include -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../lmdb/libraries/liblmdb
|
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../lmdb/libraries/liblmdb -Wall
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g3
|
CFLAGS += -g3
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* @param block the block to be written
|
* @param block the block to be written
|
||||||
* @returns true(1) on success
|
* @returns true(1) on success
|
||||||
*/
|
*/
|
||||||
int repo_fsrepo_lmdb_put(const char* key, size_t key_size, struct Block* block, struct Datastore* datastore) {
|
int repo_fsrepo_lmdb_put(const char* key, size_t key_size, unsigned char* data, size_t data_size, struct Datastore* datastore) {
|
||||||
int retVal;
|
int retVal;
|
||||||
MDB_txn* mdb_txn;
|
MDB_txn* mdb_txn;
|
||||||
MDB_dbi mdb_dbi;
|
MDB_dbi mdb_dbi;
|
||||||
|
@ -38,8 +38,8 @@ int repo_fsrepo_lmdb_put(const char* key, size_t key_size, struct Block* block,
|
||||||
// write
|
// write
|
||||||
db_key.mv_size = key_size;
|
db_key.mv_size = key_size;
|
||||||
db_key.mv_data = (char*)key;
|
db_key.mv_data = (char*)key;
|
||||||
db_value.mv_size = block->data_length;
|
db_value.mv_size = data_size;
|
||||||
db_value.mv_data = block->data;
|
db_value.mv_data = data;
|
||||||
retVal = mdb_put(mdb_txn, mdb_dbi, &db_key, &db_value, MDB_NODUPDATA);
|
retVal = mdb_put(mdb_txn, mdb_dbi, &db_key, &db_value, MDB_NODUPDATA);
|
||||||
if (retVal != 0)
|
if (retVal != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/ -g3
|
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/ -g3 -Wall
|
||||||
LFLAGS = -L../../c-libp2p -L../../c-multihash -L../../c-multiaddr -lp2p -lm -lmultihash -lmultiaddr -lpthread
|
LFLAGS = -L../../c-libp2p -L../../c-multihash -L../../c-multiaddr -lp2p -lm -lmultihash -lmultiaddr -lpthread
|
||||||
DEPS = cmd/ipfs/test_init.h repo/test_repo_bootstrap_peers.h repo/test_repo_config.h repo/test_repo_identity.h cid/test_cid.h
|
DEPS = cmd/ipfs/test_init.h repo/test_repo_bootstrap_peers.h repo/test_repo_config.h repo/test_repo_identity.h cid/test_cid.h
|
||||||
OBJS = testit.o ../cmd/ipfs/init.o ../commands/argument.o ../commands/command_option.o \
|
OBJS = testit.o ../cmd/ipfs/init.o ../commands/argument.o ../commands/command_option.o \
|
||||||
|
|
|
@ -5,14 +5,16 @@
|
||||||
#define __TEST_INIT_H__
|
#define __TEST_INIT_H__
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
//#include <string.h>
|
||||||
|
|
||||||
#include "ipfs/cmd/ipfs/init.h"
|
#include "ipfs/cmd/ipfs/init.h"
|
||||||
#include "ipfs/commands/argument.h"
|
#include "ipfs/commands/argument.h"
|
||||||
#include "ipfs/commands/request.h"
|
#include "ipfs/commands/request.h"
|
||||||
#include "ipfs/commands/command.h"
|
#include "ipfs/commands/command.h"
|
||||||
|
#include "ipfs/os/utils.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
//#include <string.h>
|
|
||||||
|
|
||||||
int test_init_new_installation() {
|
int test_init_new_installation() {
|
||||||
unlink("/tmp/.ipfs/config");
|
unlink("/tmp/.ipfs/config");
|
||||||
|
|
|
@ -103,6 +103,9 @@ int make_ipfs_repository(struct FSRepo* fs_repo) {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create a repository and put a record in the datastore and a block in the blockstore
|
||||||
|
*/
|
||||||
int test_ipfs_datastore_put() {
|
int test_ipfs_datastore_put() {
|
||||||
struct Block* block;
|
struct Block* block;
|
||||||
int retVal;
|
int retVal;
|
||||||
|
@ -134,11 +137,8 @@ int test_ipfs_datastore_put() {
|
||||||
if (retVal == 0)
|
if (retVal == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
// send to Put with key
|
// send to Put with key
|
||||||
retVal = fs_repo->config->datastore->datastore_put(key, key_length, block, fs_repo->config->datastore);
|
retVal = fs_repo->config->datastore->datastore_put(key, key_length, block->data, block->data_length, fs_repo->config->datastore);
|
||||||
*/
|
|
||||||
if (retVal == 0)
|
if (retVal == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue