00001 #ifdef _WINDOWS
00002 #include <string.h>
00003 #endif
00004 #include "Navigation.h"
00005
00006 void CNavigation::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
00007 {
00008 len = srclen+sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE);
00009 data = new unsigned char[len];
00010 unsigned char* p = data;
00011 memcpy(p, src, srclen);
00012 p += srclen;
00013 memcpy(p, &historystart, sizeof(size_t));
00014 p += sizeof(size_t);
00015 memcpy(p, &historyend, sizeof(size_t));
00016 p += sizeof(size_t);
00017 memcpy(p, &historycurrent, sizeof(size_t));
00018 p += sizeof(size_t);
00019 memcpy(p, history, sizeof(size_t)*NAVIGATION_HISTORY_SIZE);
00020 }
00021
00022 void CNavigation::putSaveData(unsigned char*& src, unsigned short& srclen)
00023 {
00024 if (srclen >= sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE))
00025 {
00026 unsigned char* p = src;
00027 memcpy(&historystart, p, sizeof(size_t));
00028 p += sizeof(size_t);
00029 memcpy(&historyend, p, sizeof(size_t));
00030 p += sizeof(size_t);
00031 memcpy(&historycurrent, p, sizeof(size_t));
00032 p += sizeof(size_t);
00033 memcpy(history, p, sizeof(size_t)*NAVIGATION_HISTORY_SIZE);
00034 src = p + sizeof(size_t)*NAVIGATION_HISTORY_SIZE;
00035 srclen -= sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE);
00036 }
00037
00038
00039
00040
00041
00042
00043 }