UInt16 OpenPrefsDatabase(void) { JMPalmPrefs = DmOpenDatabaseByTypeCreator(JMPalmPrefsType, JMPalmAppID, dmModeReadWrite); // the database doesn't exist if (!JMPalmPrefs) { MemHandle foo; UInt16 position = 1; if (DmCreateDatabase(0, JMPalmPrefsName, JMPalmAppID, JMPalmPrefsType, false)) return true; JMPalmPrefs = DmOpenDatabaseByTypeCreator(JMPalmPrefsType, JMPalmAppID, dmModeReadWrite); ResetHeader(); // create dummy record foo = DmNewRecord(JMPalmPrefs, &position, sizeof(headerdata)); DmReleaseRecord(JMPalmPrefs, position, true); WriteHeader(); // Do some special handling for the first run of the application HandleFirstRun(); } return false; }
CFileLayer::CFileLayer(char* pName) : CBaseLayer(pName) { ResetHeader(); m_ackReady = FALSE; BooleanErr = TRUE; RecEnd = FALSE; }
ARPLayer::ARPLayer(char* pName) : CBaseLayer(pName) { ResetHeader(); ARPTable.InitHashTable(23); }
// Read the header data UInt16 ReadHeader(void) { UInt16 err; MemHandle headerMH = NULL; MemPtr headerMP = NULL; headerdata* foo; err = false; headerMH = DmGetRecord(JMPalmPrefs, 0); if (headerMH != NULL) headerMP = MemHandleLock(headerMH); foo = (headerdata*)headerMP; // copy the object if (foo != NULL) { memcpy(&hd, foo, sizeof(headerdata)); // Header version incompatible? if (hd.version <= INCOMPATIBILITY_LEVEL) { FrmCustomAlert(ErrorMessageForm, "Installation error: You must"\ " delete old JMPalm versions before installing"\ " this version. Please delete and reinstall.", 0, 0); err = true; } else if (hd.version < CURRENT_SETTINGS_VERSION) { FrmCustomAlert(ErrorMessageForm, "New (incompatible) version of "\ "JMPalm installed, "\ "your settings are lost!", 0, 0); drawSplash(); ResetHeader(); } } if (headerMH != NULL) { MemHandleUnlock(headerMH); DmReleaseRecord(JMPalmPrefs, 0, true); } return err; }
CEthernetLayer::CEthernetLayer( char* pName ) : CBaseLayer( pName ) { ResetHeader( ) ; }
CIPLayer::CIPLayer( char* pName ) : CBaseLayer( pName ) { ResetHeader( ); }
CChatAppLayer::CChatAppLayer( char* pName ) : CBaseLayer( pName ), mp_Dlg( NULL ) { ResetHeader( ) ; }
CARPLayer::CARPLayer(char* pName) : CBaseLayer( pName ), ARP_REQUEST(0x100), ARP_REPLY(0x200) // bigendian 으로 가기때문에 이렇게 설정. { ResetHeader(); }
BinaryMessage& BinaryMessage::operator=(const BinaryMessage& rvalue) { data_ = rvalue.data_; ResetHeader(); return *this; }
BinaryMessage::BinaryMessage(const BinaryMessage& other) : Message(MessageType::BINARY) { data_ = other.data_; ResetHeader(); }
BinaryMessage::BinaryMessage(const char* data, uint32_t length, bool has_hdr) : Message(MessageType::BINARY) { AssignData(data, length, has_hdr); ResetHeader(); }
BinaryMessage::BinaryMessage(const std::string& data, bool has_hdr) : Message(MessageType::BINARY) { AssignData(data.data(), data.size(), has_hdr); ResetHeader(); }
CARPLayer::CARPLayer(char* pName) : CBaseLayer( pName ), ARP_REQUEST(0x100), ARP_REPLY(0x200) { ResetHeader(); }