using an unsigned int for something that requires at least 3 bytes

makes me uncomfortable.


svn:r5340
This commit is contained in:
Roger Dingledine 2005-11-01 06:15:48 +00:00
parent 40ecaf4857
commit 87e8e7b4fa
2 changed files with 18 additions and 18 deletions

View File

@ -184,7 +184,7 @@ format_msg(char *buf, size_t buf_len,
* message. The actual message is derived as from tor_snprintf(format,ap). * message. The actual message is derived as from tor_snprintf(format,ap).
*/ */
static void static void
logv(int severity, unsigned int domain, const char *funcname, const char *format, logv(int severity, uint32_t domain, const char *funcname, const char *format,
va_list ap) va_list ap)
{ {
char buf[10024]; char buf[10024];
@ -234,7 +234,7 @@ logv(int severity, unsigned int domain, const char *funcname, const char *format
/** Output a message to the log. */ /** Output a message to the log. */
void void
_log(int severity, unsigned int domain, const char *format, ...) _log(int severity, uint32_t domain, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
@ -245,7 +245,7 @@ _log(int severity, unsigned int domain, const char *format, ...)
/** Output a message to the log, prefixed with a function name <b>fn</b>. */ /** Output a message to the log, prefixed with a function name <b>fn</b>. */
#ifdef __GNUC__ #ifdef __GNUC__
void void
_log_fn(int severity, unsigned int domain, const char *fn, const char *format, ...) _log_fn(int severity, uint32_t domain, const char *fn, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
@ -255,7 +255,7 @@ _log_fn(int severity, unsigned int domain, const char *fn, const char *format, .
#else #else
const char *_log_fn_function_name=NULL; const char *_log_fn_function_name=NULL;
void void
_log_fn(int severity, unsigned int domain, const char *format, ...) _log_fn(int severity, uint32_t domain, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
@ -264,7 +264,7 @@ _log_fn(int severity, unsigned int domain, const char *format, ...)
_log_fn_function_name = NULL; _log_fn_function_name = NULL;
} }
void void
_debug(unsigned int domain, const char *format, ...) _debug(uint32_t domain, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
@ -273,7 +273,7 @@ _debug(unsigned int domain, const char *format, ...)
_log_fn_function_name = NULL; _log_fn_function_name = NULL;
} }
void void
_info(unsigned int domain, const char *format, ...) _info(uint32_t domain, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
@ -282,7 +282,7 @@ _info(unsigned int domain, const char *format, ...)
_log_fn_function_name = NULL; _log_fn_function_name = NULL;
} }
void void
_notice(unsigned int domain, const char *format, ...) _notice(uint32_t domain, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
@ -291,7 +291,7 @@ _notice(unsigned int domain, const char *format, ...)
_log_fn_function_name = NULL; _log_fn_function_name = NULL;
} }
void void
_warn(unsigned int domain, const char *format, ...) _warn(uint32_t domain, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);
@ -300,7 +300,7 @@ _warn(unsigned int domain, const char *format, ...)
_log_fn_function_name = NULL; _log_fn_function_name = NULL;
} }
void void
_err(unsigned int domain, const char *format, ...) _err(uint32_t domain, const char *format, ...)
{ {
va_list ap; va_list ap;
va_start(ap,format); va_start(ap,format);

View File

@ -90,7 +90,7 @@
/** Bandwidth accounting. */ /** Bandwidth accounting. */
#define LD_ACCT (1u<<17) #define LD_ACCT (1u<<17)
typedef void (*log_callback)(int severity, unsigned int domain, const char *msg); typedef void (*log_callback)(int severity, uint32_t domain, const char *msg);
int parse_log_level(const char *level); int parse_log_level(const char *level);
const char *log_level_to_string(int level); const char *log_level_to_string(int level);
@ -113,11 +113,11 @@ void change_callback_log_severity(int loglevelMin, int loglevelMax,
log_callback cb); log_callback cb);
/* Outputs a message to stdout */ /* Outputs a message to stdout */
void _log(int severity, unsigned int domain, const char *format, ...) CHECK_PRINTF(3,4); void _log(int severity, uint32_t domain, const char *format, ...) CHECK_PRINTF(3,4);
#define log _log /* hack it so we don't conflict with log() as much */ #define log _log /* hack it so we don't conflict with log() as much */
#ifdef __GNUC__ #ifdef __GNUC__
void _log_fn(int severity, unsigned int domain, void _log_fn(int severity, uint32_t domain,
const char *funcname, const char *format, ...) const char *funcname, const char *format, ...)
CHECK_PRINTF(4,5); CHECK_PRINTF(4,5);
/** Log a message at level <b>severity</b>, using a pretty-printed version /** Log a message at level <b>severity</b>, using a pretty-printed version
@ -137,12 +137,12 @@ void _log_fn(int severity, unsigned int domain,
#else /* ! defined(__GNUC__) */ #else /* ! defined(__GNUC__) */
void _log_fn(int severity, unsigned int domain, const char *format, ...); void _log_fn(int severity, uint32_t domain, const char *format, ...);
void _debug(unsigned int domain, const char *format, ...); void _debug(uint32_t domain, const char *format, ...);
void _info(unsigned int domain, const char *format, ...); void _info(uint32_t domain, const char *format, ...);
void _notice(unsigned int domain, const char *format, ...); void _notice(uint32_t domain, const char *format, ...);
void _warn(unsigned int domain, const char *format, ...); void _warn(uint32_t domain, const char *format, ...);
void _err(unsigned int domain, const char *format, ...); void _err(uint32_t domain, const char *format, ...);
#if defined(_MSC_VER) && _MSC_VER < 1300 #if defined(_MSC_VER) && _MSC_VER < 1300
/* MSVC 6 and earlier don't have __FUNCTION__, or even __LINE__. */ /* MSVC 6 and earlier don't have __FUNCTION__, or even __LINE__. */