Clean up signedness problems in Loggable ID treatment.
This commit is contained in:
parent
fed042950f
commit
3e86584ad3
|
@ -43,7 +43,7 @@ using std::max;
|
|||
|
||||
|
||||
FILE *Loggable::_fp;
|
||||
int Loggable::_log_id = 0;
|
||||
unsigned int Loggable::_log_id = 0;
|
||||
int Loggable::_level = 0;
|
||||
|
||||
off_t Loggable::_undo_offset = 0;
|
||||
|
@ -75,7 +75,7 @@ Loggable::ensure_size ( size_t n )
|
|||
|
||||
_loggables = (Loggable**) realloc( _loggables, sizeof( Loggable ** ) * _loggables_size );
|
||||
|
||||
for ( int i = os; i < _loggables_size; ++i )
|
||||
for ( unsigned int i = os; i < _loggables_size; ++i )
|
||||
_loggables[ i ] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ Loggable::block_end ( void )
|
|||
}
|
||||
|
||||
Loggable *
|
||||
Loggable::find ( int id )
|
||||
Loggable::find ( unsigned int id )
|
||||
{
|
||||
if ( id > _log_id )
|
||||
return NULL;
|
||||
|
@ -203,7 +203,7 @@ Loggable::close ( void )
|
|||
if ( ! snapshot( "snapshot" ) )
|
||||
WARNING( "Failed to create snapshot" );
|
||||
|
||||
for ( int i = 0; i < _log_id - 1; ++i )
|
||||
for ( unsigned int i = 0; i < _log_id - 1; ++i )
|
||||
{
|
||||
Loggable ** l = &_loggables[ i ];
|
||||
|
||||
|
@ -221,7 +221,7 @@ Loggable::close ( void )
|
|||
|
||||
/** must be called after construction in create() methods */
|
||||
void
|
||||
Loggable::update_id ( int id )
|
||||
Loggable::update_id ( unsigned int id )
|
||||
{
|
||||
/* make sure we're the last one */
|
||||
assert( _id == _log_id );
|
||||
|
@ -277,7 +277,7 @@ Loggable::escape ( const char *s )
|
|||
bool
|
||||
Loggable::do_this ( const char *s, bool reverse )
|
||||
{
|
||||
int id = 0;
|
||||
unsigned int id = 0;
|
||||
|
||||
if ( ! ( sscanf( s, "%*s %X ", &id ) > 0 ) )
|
||||
return false;
|
||||
|
@ -397,8 +397,8 @@ Loggable::undo ( void )
|
|||
void
|
||||
Loggable::compact_ids ( void )
|
||||
{
|
||||
int id = 0;
|
||||
for ( int i = 0; i < _log_id; ++i )
|
||||
unsigned int id = 0;
|
||||
for ( unsigned int i = 0; i < _log_id; ++i )
|
||||
if ( _loggables[ i ] )
|
||||
{
|
||||
++id;
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef void (snapshot_func)( void * );
|
|||
|
||||
class Log_Entry;
|
||||
class Loggable;
|
||||
typedef Loggable *(create_func)(Log_Entry &, int id);
|
||||
typedef Loggable *(create_func)(Log_Entry &, unsigned int id);
|
||||
|
||||
#define LOG_REGISTER_CREATE( class ) \
|
||||
Loggable::register_create( #class, & class ::create );
|
||||
|
@ -48,7 +48,7 @@ typedef Loggable *(create_func)(Log_Entry &, int id);
|
|||
|
||||
#define LOG_CREATE_FUNC( class ) \
|
||||
static Loggable * \
|
||||
create ( Log_Entry &e, int id ) \
|
||||
create ( Log_Entry &e, unsigned int id ) \
|
||||
{ \
|
||||
class *r = new class; \
|
||||
r->update_id( id ); \
|
||||
|
@ -66,7 +66,7 @@ class Loggable
|
|||
{
|
||||
|
||||
static FILE *_fp;
|
||||
static int _log_id;
|
||||
static unsigned int _log_id;
|
||||
static int _level;
|
||||
|
||||
static off_t _undo_offset;
|
||||
|
@ -86,7 +86,7 @@ class Loggable
|
|||
|
||||
private:
|
||||
|
||||
int _id;
|
||||
unsigned int _id;
|
||||
|
||||
Log_Entry *_old_state;
|
||||
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
static void progress_callback ( progress_func *p, void *arg ) { _progress_callback = p; _progress_callback_arg = arg;}
|
||||
static const char *escape ( const char *s );
|
||||
|
||||
int id ( void ) const { return _id; }
|
||||
unsigned int id ( void ) const { return _id; }
|
||||
|
||||
static bool open ( const char *filename );
|
||||
static bool close ( void );
|
||||
|
@ -144,14 +144,14 @@ public:
|
|||
static void block_start ( void );
|
||||
static void block_end ( void );
|
||||
|
||||
static Loggable * find ( int id );
|
||||
static Loggable * find ( unsigned int id );
|
||||
|
||||
Loggable ( bool loggable=true )
|
||||
{
|
||||
init( loggable );
|
||||
}
|
||||
|
||||
void update_id ( int id );
|
||||
void update_id ( unsigned int id );
|
||||
|
||||
virtual ~Loggable ( )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue