Skip to content

Commit

Permalink
no functional changes, just remove compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
postwait committed Feb 8, 2008
1 parent 102a1a9 commit e4b055a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion configure.in
Expand Up @@ -43,7 +43,7 @@ AC_FUNC_STRFTIME
# Checks for header files.
AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
ctype.h unistd.h time.h sys/stat.h)
ctype.h unistd.h time.h sys/stat.h sys/time.h unistd.h sys/mman.h)

AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
AC_TRY_COMPILE(
Expand Down
18 changes: 14 additions & 4 deletions jlog.c
Expand Up @@ -70,6 +70,12 @@

#include "jlog_config.h"
#include "jlog_private.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#if HAVE_DIRENT_H
#include <dirent.h>
#endif
Expand All @@ -82,6 +88,9 @@
#if HAVE_TIME_H
#include <time.h>
#endif
#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif

#define BUFFERED_INDICES 1024

Expand All @@ -104,7 +113,7 @@ int jlog_snprint_logid(char *b, int n, const jlog_id *id) {
int jlog_repair_datafile(jlog_ctx *ctx, u_int32_t log)
{
jlog_message_header hdr;
char *this, *next, *afternext, *mmap_end;
char *this, *next, *afternext = NULL, *mmap_end;
int i, invalid_count = 0;
struct {
off_t start, end;
Expand Down Expand Up @@ -247,12 +256,12 @@ int jlog_inspect_datafile(jlog_ctx *ctx, u_int32_t log)
i++;
if (hdr.reserved != 0) {
fprintf(stderr, "Message %d at [%ld] has invalid reserved value %u\n",
i, this - (char *)ctx->mmap_base, hdr.reserved);
i, (long int)(this - (char *)ctx->mmap_base), hdr.reserved);
return 1;
}

fprintf(stderr, "Message %d at [%ld] of (%lu+%u)", i,
this - (char *)ctx->mmap_base, sizeof(hdr), hdr.mlen);
(long int)(this - (char *)ctx->mmap_base), sizeof(hdr), hdr.mlen);

next = this + sizeof(hdr) + hdr.mlen;
if (next <= (char *)ctx->mmap_base) {
Expand All @@ -271,7 +280,8 @@ int jlog_inspect_datafile(jlog_ctx *ctx, u_int32_t log)
this = next;
}
if (this < mmap_end) {
fprintf(stderr, "%ld bytes of junk at the end\n", mmap_end - this);
fprintf(stderr, "%ld bytes of junk at the end\n",
(long int)(mmap_end - this));
return 1;
}

Expand Down
3 changes: 3 additions & 0 deletions jlog_config.h.in
Expand Up @@ -42,8 +42,11 @@
#undef HAVE_ERRNO_H
#undef HAVE_STRING_H
#undef HAVE_STDLIB_H
#undef HAVE_UNISTD_H
#undef HAVE_SYS_PARAM_H
#undef HAVE_SYS_MMAN_H
#undef HAVE_TIME_H
#undef HAVE_SYS_TIME_H
#undef HAVE_SYS_STAT_H
#undef HAVE_INT64_T
#undef HAVE_INTXX_T
Expand Down
3 changes: 3 additions & 0 deletions jlogctl.c
Expand Up @@ -34,6 +34,9 @@
#include "jlog_private.h"
#include "getopt_long.h"
#include <stdio.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
Expand Down
1 change: 1 addition & 0 deletions jthreadtest.c
Expand Up @@ -32,6 +32,7 @@

#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

#include "jlog_config.h"
#include "jlog.h"
Expand Down

0 comments on commit e4b055a

Please sign in to comment.