[Wepg-devel] pcond/src PalmAppInfo.C,1.1.1.1,1.2 wepgsync.C,1.1.1.1,1.2 GenErr.h,1.1.1.1,NONE HostUs
Brought to you by:
leonvs
Update of /cvsroot/wepg/pcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30803/src Modified Files: PalmAppInfo.C wepgsync.C Removed Files: GenErr.h HostUser.C HostUser.h PalmAppInfo.h PalmDB.C PalmDB.h wepgstruct.h Log Message: ok --- HostUser.h DELETED --- Index: wepgsync.C =================================================================== RCS file: /cvsroot/wepg/pcond/src/wepgsync.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** wepgsync.C 28 Nov 2003 17:36:13 -0000 1.1.1.1 --- wepgsync.C 3 Aug 2004 17:15:49 -0000 1.2 *************** *** 21,25 **** #include "PalmAppInfo.h" #include "wepgutil.h" ! #include "GenErr.h" #include <time.h> --- 21,26 ---- #include "PalmAppInfo.h" #include "wepgutil.h" ! #include "RecIDList.h" ! #include "TimeThreshold.h" #include <time.h> *************** *** 64,249 **** - class RecIdList - { - public: - RecIdList(); - ~RecIdList(); - - long load( int pilot_socket, PalmDB& palmdb ); - - int getLength() const { return m_length; } - - recordid_t getId( int index ) const; - - bool contains( recordid_t id ) const; - - protected: - int m_length; - recordid_t* m_ids; - }; - - - RecIdList::RecIdList() - { - m_length = 0; - m_ids = NULL; - } - - - RecIdList::~RecIdList() - { - if ( m_ids != NULL ) - delete[] m_ids; - } - - - long - RecIdList::load( int pilot_socket, PalmDB& palmdb ) - { - long retval; - - int numrecs = 0; - retval = dlp_ReadOpenDBInfo( - pilot_socket, - palmdb.getHandle(), - &numrecs ); - if ( retval < 0 ) { - errprintf( "ReadOpenDBInfo failed, %li\n", retval ); - return retval; - } - - m_length = numrecs; - if ( m_length == 0 ) - return 0; - if ( m_ids != NULL ) - delete[] m_ids; - - m_ids = new recordid_t[ m_length ]; - if ( m_ids == NULL ) { - errprintf( "out of mem\n" ); - return 1; - } - - int total = 0; - while (total < m_length) { - int count = 0; - retval = dlp_ReadRecordIDList( - pilot_socket, - palmdb.getHandle(), - 0, // sort - total, // start - m_length - total, //max - m_ids + total, - &count ); - if ( retval < 0 ) { - errprintf( "ReadRecordIDList failed, %li\n", retval ); - return retval; - } - total += count; - - if (count == 0) { - errprintf( "ReadRecordIDList, got %i out of %i\n", count, m_length); - return 1; - } - } - return 0; - } - - - recordid_t - RecIdList::getId( int index ) const - { - if ( (index < 0) || (index >= m_length) ) - return 0; - return m_ids[ index ]; - } - - - bool - RecIdList::contains( recordid_t id ) const - { - for ( int i=0; i<m_length; i++ ) - if ( id == getId( i ) ) - return true; - return false; - } - - - /////////////////////////////////////////////////////////////////////////////// - - - class TimeThreshold - { - public: - TimeThreshold( HostUser& hostuser ); - - const char* getPast() const { return m_pastStr; } - const char* getFuture() const { return m_futureStr; } - - protected: - - char m_pastStr[32]; - char m_futureStr[32]; - - private: - void printTime( struct tm* t, char* dst ); - - }; - - - TimeThreshold::TimeThreshold( HostUser& hostuser ) - { - int enddayGMT_hour = hostuser.getDayEndHourGMT(); - int enddayGMT_min = hostuser.getDayEndMinuteGMT(); - - time_t nowtime; - struct tm nowgmt; - struct tm thresholdgmt; - - //win32 _tzset(); - - time( &nowtime ); - - nowgmt = *gmtime( &nowtime ); - thresholdgmt = nowgmt; - - - thresholdgmt.tm_hour = enddayGMT_hour; - thresholdgmt.tm_min = enddayGMT_min; - thresholdgmt.tm_sec = 0; - - time_t thresholdgmt_time = mktime( &thresholdgmt ); - - if ( difftime( thresholdgmt_time, nowtime ) >= 0.0 ) { - thresholdgmt_time -= 60*60*24; // go back a day - thresholdgmt = *gmtime( &thresholdgmt_time ); - } - - printTime( &thresholdgmt, m_pastStr ); - - thresholdgmt_time += 60*60*24; - thresholdgmt = *gmtime( &thresholdgmt_time ); - - printTime( &thresholdgmt, m_futureStr ); - } - - - void - TimeThreshold::printTime( struct tm* t, char* dst ) - { - sprintf( dst, "%04i-%02i-%02i %02i:%02i:%02i", - t->tm_year + 1900, - t->tm_mon+1, - t->tm_mday, - t->tm_hour, - t->tm_min, - t->tm_sec - ); - } - - - /////////////////////////////////////////////////////////////////////////////// - - static void swapToPalm( WepgDBPackedRec* pac ) --- 65,68 ---- *************** *** 484,488 **** if ( uLen < strlen(buf)+1 ) ! return GEN_ERR_BUFFER_TOO_SMALL; strcpy( userid, buf ); --- 303,307 ---- if ( uLen < strlen(buf)+1 ) ! return -1; strcpy( userid, buf ); *************** *** 610,614 **** logprintf("wepg: archiving old recs\n"); ! RecIdList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) --- 429,433 ---- logprintf("wepg: archiving old recs\n"); ! RecIDList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) *************** *** 713,717 **** { int retval; ! RecIdList idlist; logprintf("wepg: remoteRecSanityCheck\n"); --- 532,536 ---- { int retval; ! RecIDList idlist; logprintf("wepg: remoteRecSanityCheck\n"); *************** *** 777,781 **** int retval; ! RecIdList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) --- 596,600 ---- int retval; ! RecIDList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) *************** *** 974,978 **** ) ) { errprintf( "connect to db failed\n%s\n\n",mysql_error(&mysql) ); ! return GEN_ERR_UNABLE_TO_OPEN_FILE; } --- 793,797 ---- ) ) { errprintf( "connect to db failed\n%s\n\n",mysql_error(&mysql) ); ! return -1; } --- PalmAppInfo.h DELETED --- --- PalmDB.C DELETED --- --- HostUser.C DELETED --- --- GenErr.h DELETED --- --- PalmDB.h DELETED --- Index: PalmAppInfo.C =================================================================== RCS file: /cvsroot/wepg/pcond/src/PalmAppInfo.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PalmAppInfo.C 28 Nov 2003 17:36:13 -0000 1.1.1.1 --- PalmAppInfo.C 3 Aug 2004 17:15:49 -0000 1.2 *************** *** 18,22 **** #include "PalmAppInfo.h" #include "wepgutil.h" - #include "GenErr.h" #include "wepginc.h" #include <stdlib.h> --- 18,21 ---- *************** *** 216,219 **** --- 215,219 ---- m_storage.day_end_hour = hostuser.getDayEndHour(); m_storage.day_end_min = hostuser.getDayEndMinute(); + m_storage.load_ahead = hostuser.getLoadAhead(); return 0; --- wepgstruct.h DELETED --- |