mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
Merge remote-tracking branch 'origin/android_branch' into android_branch
This commit is contained in:
commit
7ecaf76b22
4 changed files with 30 additions and 20 deletions
|
@ -45,6 +45,7 @@ OBJ = $(patsubst %.cpp,%.o,$(SRC))
|
|||
LDFLAGS += -pthread -g $(STATIC)
|
||||
LDFLAGS += -L$(shell pg_config --libdir)
|
||||
LDFLAGS += $(shell pkg-config --libs glib-2.0)
|
||||
LDFLAGS += -lrt
|
||||
|
||||
CPPFLAGS += -DSPAWN_SELF -g -Wall
|
||||
CPPFLAGS += -I $(shell pg_config --includedir)
|
||||
|
|
|
@ -857,21 +857,19 @@ void
|
|||
CookieRef::send_stored_messages( HostID dest, const AddrInfo* addr )
|
||||
{
|
||||
logf( XW_LOGVERBOSE0, "%s(dest=%d)", __func__, dest );
|
||||
|
||||
assert( dest > 0 && dest <= 4 );
|
||||
if ( addr->isCurrent() ) {
|
||||
DBMgr* dbmgr = DBMgr::Get();
|
||||
const char* cname = ConnName();
|
||||
for ( ; ; ) {
|
||||
unsigned char buf[MAX_MSG_LEN];
|
||||
size_t buflen = sizeof(buf);
|
||||
int msgID;
|
||||
if ( !dbmgr->GetStoredMessage( cname, dest, buf, &buflen, &msgID )
|
||||
|| ! send_with_length( addr, dest, buf, buflen, true ) ) {
|
||||
break;
|
||||
}
|
||||
dbmgr->RemoveStoredMessages( &msgID, 1 );
|
||||
}
|
||||
|
||||
DBMgr* dbmgr = DBMgr::Get();
|
||||
const char* cname = ConnName();
|
||||
while ( addr->isCurrent() ) {
|
||||
unsigned char buf[MAX_MSG_LEN];
|
||||
size_t buflen = sizeof(buf);
|
||||
int msgID;
|
||||
if ( !dbmgr->GetStoredMessage( cname, dest, buf, &buflen, &msgID )
|
||||
|| ! send_with_length( addr, dest, buf, buflen, true ) ) {
|
||||
break;
|
||||
}
|
||||
dbmgr->RemoveStoredMessages( &msgID, 1 );
|
||||
}
|
||||
} /* send_stored_messages */
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ DBMgr::DBMgr()
|
|||
int tmp;
|
||||
RelayConfigs::GetConfigs()->GetValueFor( "USE_B64", &tmp );
|
||||
m_useB64 = tmp != 0;
|
||||
logf( XW_LOGINFO, "%s: m_useB64=%d", __func__, m_useB64 );
|
||||
|
||||
pthread_key_create( &m_conn_key, destr_function );
|
||||
|
||||
|
@ -1099,7 +1100,6 @@ DBMgr::getCountWhere( const char* table, string& test )
|
|||
assert( 1 == PQntuples( result ) );
|
||||
int count = atoi( PQgetvalue( result, 0, 0 ) );
|
||||
PQclear( result );
|
||||
logf( XW_LOGINFO, "%s(%s)=>%d", __func__, query.c_str(), count );
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
|
@ -203,13 +203,24 @@ parseRelayID( const unsigned char** const inp, const unsigned char* const end,
|
|||
if ( ok ) {
|
||||
strncpy( buf, (char*)*inp, connNameLen );
|
||||
buf[connNameLen] = '\0';
|
||||
*hid = atoi( hidp+1 );
|
||||
char* endptr;
|
||||
*hid = strtol( hidp + 1, &endptr, 10 );
|
||||
if ( '\n' == *endptr ) {
|
||||
++endptr;
|
||||
}
|
||||
*inp = (unsigned char*)endptr;
|
||||
|
||||
if ( *hid >= 0 && *hid <= 4 ) {
|
||||
if ( '\n' == *endptr ) {
|
||||
++endptr;
|
||||
}
|
||||
*inp = (unsigned char*)endptr;
|
||||
} else {
|
||||
ok = false;
|
||||
|
||||
int len = end - *inp;
|
||||
char buf[len+1];
|
||||
memcpy( buf, *inp, len);
|
||||
buf[len] = '\0';
|
||||
logf( XW_LOGERROR, "%s: got bad hid %d from str \"%s\"", __func__,
|
||||
*hid, buf );
|
||||
}
|
||||
}
|
||||
if ( !ok ) {
|
||||
logf( XW_LOGERROR, "%s failed", __func__ );
|
||||
|
|
Loading…
Add table
Reference in a new issue