void RT_MSG::Paste(void * toThisMemory, const unsigned int dataLength) { if((dataLength>0)&&(GetLength()>0)) { if(dataLength > GetLength()) { memcpy(toThisMemory,GetDataAddress(),GetLength()); } else { memcpy(toThisMemory,GetDataAddress(),dataLength); } } }
void RT_MSG::Paste(void * toThisMemory) { if(GetLength()>0) { memcpy(toThisMemory,GetDataAddress(),GetLength()); } }
void RT_MSG::Copy(const void* fromThisMemory) { if(GetLength()>0) { memcpy(GetDataAddress(),fromThisMemory,GetLength()); } }
void RT_MSG::PasteAt(void * toThisMemory, const unsigned int dataLength,const unsigned int atThisPositionInMsg) { int actualLength=((atThisPositionInMsg + dataLength)> GetLength() ? (GetLength() - atThisPositionInMsg):dataLength); if(actualLength > 0) { memcpy(toThisMemory,&GetDataAddress()[atThisPositionInMsg],actualLength); } }
void RT_MSG::Copy(const void * fromThisMemory, const unsigned int dataLength) { SetLength(dataLength); if(dataLength > 0) { memcpy(GetDataAddress(),fromThisMemory,dataLength); } }
void RT_MSG::CopyMore(const void * fromThisMemory,unsigned int dataLength) { unsigned int pos = GetLength(); if(dataLength>0) { SetLength(GetLength()+dataLength); memcpy(&GetDataAddress()[pos],fromThisMemory,dataLength); } }
void MSG_BASE::CopyMore(const void * fromThisMemory, std::int32_t dataLength) { std::int32_t pos = GetLength(); if (dataLength > 0) { SetLength(GetLength() + dataLength); memcpy(GetDataAddress() + pos, fromThisMemory, dataLength); } }
void MSG_BASE::CopyAt(const void * fromThisMemory, std::int32_t dataLength, std::int32_t atThisPositionInMsg) { if ((dataLength + atThisPositionInMsg) > GetLength()) { SetLength(dataLength + atThisPositionInMsg); } //no need to check if length is 0 memcpy(&GetDataAddress()[atThisPositionInMsg], fromThisMemory, dataLength); }
void RT_MSG::CopyAt(const void* fromThisMemory,unsigned int dataLength,unsigned int atThisPositionInMsg) { if((dataLength+atThisPositionInMsg)>GetLength()) { SetLength(dataLength+atThisPositionInMsg); } if(dataLength>0) { memcpy(&GetDataAddress()[atThisPositionInMsg],fromThisMemory,dataLength); } }
/** * Finds the files in the directory that currently has focus. * * Parameters * llelement **head * This is the value of the current location of the head of the linked list. This * is only passed in here so we can pass it on to InsertIntoList. * llelement **tail * This is the value of the current location of the tail of the linked list. This * is only passed in here so we can pass it on to InsertIntoList. * * Returns * 0 if we successfully found all the files and added them to the list */ int FindFiles(llelement **head, llelement **tail) { int validatorInt = 0; char *name; void *p = NULL; fileData *pFileData = NULL; WIN32_FIND_DATA FindFileData; /* When we find a file, this is populated with that files data */ HANDLE hFind; /* Handle to the file */ hFind = FindFirstFile("*", &FindFileData); if (INVALID_HANDLE_VALUE == hFind) { printf ("FindFirstFile failed (%d)\n", GetLastError()); return -1; } do { p = AllocateSpace(sizeof(pFileData)); pFileData = (fileData*)GetDataAddress(p); pFileData->name = (char *)malloc(sizeof(FindFileData.cFileName)); strcpy_s(pFileData->name, MAX_BUFFER_SIZE, FindFileData.cFileName); /* Copy the filename into the struct we are going to insert */ validatorInt = InsertIntoList((llelement *)p, head, tail); /* Insert the file we found into the list */ if(0 != validatorInt) { printf("Could not store file in memory."); return -1; } } while (0 != FindNextFile(hFind, &FindFileData)); return 0; }
void MSG_BASE::PasteAt(void * toThisMemory, std::int32_t dataLength, std::int32_t atThisPositionInMsg) const { // no need to check memcpy(toThisMemory, &GetDataAddress()[atThisPositionInMsg], std::min(dataLength, GetLength() - atThisPositionInMsg)); }
void MSG_BASE::Paste(void * toThisMemory) const { // no need to check if length is zero memcpy(toThisMemory, GetDataAddress(), GetLength()); }
void MSG_BASE::Paste(void * toThisMemory, std::int32_t dataLength) const { // no need to check if length is zero memcpy(toThisMemory, GetDataAddress(), GetLength() < dataLength ? GetLength() : dataLength); }
void MSG_BASE::Copy(const void * fromThisMemory) { memcpy(GetDataAddress(), fromThisMemory, GetLength()); }
void MSG_BASE::Copy(const void * fromThisMemory, std::int32_t dataLength) { SetLength(dataLength); memcpy(GetDataAddress(), fromThisMemory, GetLength());//no need to check if length is 0 }