fix some casts, sign errors, initializations, stack arrays

This commit is contained in:
Russell Sears 2013-02-13 16:18:19 -08:00
parent 4adc546a8e
commit 7c09a7280f
15 changed files with 46 additions and 46 deletions

View file

@ -168,8 +168,8 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis)
IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG}) # profiler)
SET(CMAKE_C_FLAGS "-g -Wall -ansi -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -ansi -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-g -Wall -Wextra -ansi -Wno-unused-parameter -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -Wextra -ansi -Wno-unused-parameter -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" )
SET(COMMON_LIBRARIES stasis m pthread Crun Cstd)
SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
@ -178,8 +178,8 @@ ELSE( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
# TODO: how to detect compilers correctly on old cmake??? This is a huge hack; it uses old gcc
# options, since cmake is old...
SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG})
SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-g -Wall -Wlong-long -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ENDIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/stasis

View file

@ -37,7 +37,7 @@ void * status_worker(void * ignored) {
while(1) {
struct timespec ts = stasis_double_to_timespec(1.0);
nanosleep(&ts,0);
printf("current ops/sec %lld\n", completed_ops - last_ops);
printf("current ops/sec %lld\n", (long long) (completed_ops - last_ops));
last_ops = completed_ops;
iter ++;
if((! (iter % 10)) && (op_count == 0)) {

View file

@ -171,7 +171,7 @@ int stasis_dirty_page_table_flush_with_target(stasis_dirty_page_table_t * dirtyP
long buffered = 0;
do {
dpt_entry dummy = { 0, 0 };
pageid_t vals[stride];
pageid_t * vals = stasis_alloca(stride, pageid_t);
int off = 0;
int strides = 0;
all_flushed = 1;

View file

@ -173,27 +173,27 @@ size_t stasis_log_in_memory_max_entries = 0; // unlimited
#endif
#ifdef STASIS_LOG_FILE_NAME
char * stasis_log_file_name = STASIS_LOG_FILE_NAME;
const char * stasis_log_file_name = STASIS_LOG_FILE_NAME;
#else
char * stasis_log_file_name = "logfile.txt";
const char * stasis_log_file_name = "logfile.txt";
#endif
#ifdef STASIS_STORE_FILE_NAME
char * stasis_store_file_name = STASIS_STORE_FILE_NAME;
const char * stasis_store_file_name = STASIS_STORE_FILE_NAME;
#else
char * stasis_store_file_name = "storefile.txt";
const char * stasis_store_file_name = "storefile.txt";
#endif
#ifdef STASIS_STORE_FILE_1_NAME
char * stasis_store_file_1_name = STASIS_STORE_FILE_1_NAME;
const char * stasis_store_file_1_name = STASIS_STORE_FILE_1_NAME;
#else
char * stasis_store_file_1_name = "storefile1.txt";
const char * stasis_store_file_1_name = "storefile1.txt";
#endif
#ifdef STASIS_STORE_FILE_2_NAME
char * stasis_store_file_2_name = STASIS_STORE_FILE_2_NAME;
#else
char * stasis_store_file_2_name = "storefile2.txt";
const char * stasis_store_file_2_name = "storefile2.txt";
#endif
#ifdef STASIS_BUFFER_MANAGER_HASH_PREFETCH_COUNT

View file

@ -136,7 +136,7 @@ inline static int file_write_unlocked(stasis_handle_t * h, lsn_t off,
return error;
}
inline static void print_eof_error(char * file, int line) {
inline static void print_eof_error(const char * file, int line) {
fprintf(stderr, "%s:%d Internal error: attempt to access negative offset, or beyond EOF.\n", file, line);
fflush(stderr);
}

View file

@ -213,7 +213,7 @@ stasis_handle_t * stasis_handle_raid0_factory(void) {
} else {
int count = 0;
while(stasis_handle_raid0_filenames[count]) count++;
stasis_handle_t * h[count];
stasis_handle_t ** h = stasis_alloca(count, stasis_handle_t*);
for(int i = 0; i < count; i++) {
h[i] = stasis_handle_file_factory(stasis_handle_raid0_filenames[i], O_CREAT | O_RDWR | stasis_buffer_manager_io_handle_flags, FILE_PERM);
}

View file

@ -283,7 +283,6 @@ recordid Talloc(int xid, unsigned long size) {
if(size >= BLOB_THRESHOLD_SIZE) {
type = BLOB_SLOT;
} else {
assert(size >= 0);
type = size;
}

View file

@ -1,5 +1,3 @@
#define __USE_GNU
#define _GNU_SOURCE
#include <stasis/util/latches.h>
#include <stasis/transactional.h>

View file

@ -125,8 +125,7 @@ void stasis_page_init(stasis_dirty_page_table_t * dpt) {
void stasis_page_deinit(void) {
for(int i = 0; i < MAX_PAGE_TYPE; i++) {
page_impl p = { 0 };
page_impls[i] = p;
memset(&page_impls[i], 0, sizeof(page_impls[i]));
}
stasis_page_fixed_deinit();

View file

@ -34,7 +34,7 @@ void print_profile_tuple(profile_tuple * tup) {
double mean_hold = ((double)tup->sum_hold)/ ((double)tup->count);
double std_hold = sqrt((((double)tup->sum_hold2) / ((double)tup->count)) - (mean_hold * mean_hold));
printf("{count=%ld spin[%1.4lf %1.4lf %0.0lf] held[%1.4lf %1.4lf %0.0lf]us}", tup->count,
printf("{count=%ld spin[%1.4f %1.4f %0.0f] held[%1.4f %1.4f %0.0f]us}", tup->count,
mean_spin, std_spin, tup->max_spin,
mean_hold, std_hold, tup->max_hold);
} else {

View file

@ -154,7 +154,7 @@ lsn_t stasis_ringbuffer_consume_bytes(stasis_ringbuffer_t * ring, lsn_t* sz, lsn
while(RING_VOLATILE == (ret = stasis_ringbuffer_nb_consume_bytes(ring, RING_NEXT, sz))) {
pthread_cond_wait(&ring->write_done, &ring->mut);
*sz = (ring->flush > ring->rf) ? RING_NEXT : orig_sz;
*sz = (ring->flush > ring->rf) ? ((lsn_t)RING_NEXT) : orig_sz;
if(ring->shutdown) {
if(ring->rt == ring->wf) {
DEBUG(stderr, "Shutting down, and there are no more bytes. Signaling shutdown thread.\n");

View file

@ -2,11 +2,7 @@
#define _ROSE_COMPRESSION_COMPRESSION_H__
#include <limits.h>
#define __STDC_LIMIT_MACROS 1
#include <stdint.h>
#ifndef UINT16_MAX // XXX should be defined in stdint.h.
#define UINT16_MAX (65535)
#endif
namespace rose {

View file

@ -207,26 +207,30 @@ Multicolumn<TUPLE>::recordFind(int xid, TUPLE& val, TUPLE& scratch) {
*/
static const page_impl multicolumn_impl = {
-1,
-1, // page type
0, // has header
0, // multicolumnRead,
0, // multicolumnWrite,
0, // multicolumnWrite,
0, // multicolumnReadDone,
0, // multicolumnWriteDone,
0, // multicolumnWriteDone,
0, // multicolumnGetType,
0, // multicolumnSetType,
0, // multicolumnGetLength,
0, // multicolumnFirst,
0, // multicolumnNext,
0, // multicolumnLast,
0, // multicolumnIsBlockSupported,
0, // multicolumnBlockFirst,
0, // multicolumnBlockNext,
0, // multicolumnBlockDone,
0, // multicolumnFreespace,
0, // multicolumnCompact,
0, // multicolumnPreRalloc,
0, // multicolumnPostRalloc,
0, // multicolumnFree,
0, // dereference_identity,
0, // multicolumnCompact,
0, // multicolumnCompactSlotIDs,
0, // multicolumnPreRalloc,
0, // multicolumnPostRalloc,
0, // multicolumnSplice,
0, // multicolumnFree,
0, // dereference_identity,
0, // multicolumnLoaded,
0, // multicolumnFlushed
0, // multicolumnCleanup

View file

@ -62,26 +62,30 @@ static void pStarCleanup(Page * p) {
*/
static const page_impl pstar_impl = {
-1,
-1, // page type
0, // has header
0, // pStarRead,
0, // pStarWrite,
0, // pStarWrite,
0, // pStarReadDone,
0, // pStarWriteDone,
0, // pStarWriteDone,
0, // pStarGetType,
0, // pStarSetType,
0, // pStarGetLength,
0, // pStarFirst,
0, // pStarNext,
0, // pStarLast
0, // pStarIsBlockSupported,
0, // pStarBlockFirst,
0, // pStarBlockNext,
0, // pStarBlockDone,
0, // pStarFreespace,
0, // pStarCompact,
0, // pStarPreRalloc,
0, // pStarPostRalloc,
0, // pStarFree,
0, // dereference_identity,
0, // pStarCompact,
0, // pStarCompactSlotIDs,
0, // pStarPreRalloc,
0, // pStarPostRalloc,
0, // pStarSplice,
0, // pStarFree,
0, // dereference_identity,
0, // pStarLoaded,
0, // pStarFlushed
0, // pStarCleanup

View file

@ -191,15 +191,15 @@ extern int stasis_log_type;
extern size_t stasis_log_in_memory_max_entries;
extern char * stasis_log_file_name;
extern const char * stasis_log_file_name;
extern int stasis_log_file_mode;
extern int stasis_log_file_permissions;
extern int stasis_log_dir_permissions;
extern int stasis_log_softcommit;
extern char * stasis_store_file_name;
extern char * stasis_store_file_1_name;
extern char * stasis_store_file_2_name;
extern const char * stasis_store_file_name;
extern const char * stasis_store_file_1_name;
extern const char * stasis_store_file_2_name;
/**