Пример #1
0
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);
		}
	}
}
Пример #2
0
void RT_MSG::Paste(void * toThisMemory)
{
	if(GetLength()>0)
	{
		memcpy(toThisMemory,GetDataAddress(),GetLength());
	}
}
Пример #3
0
void RT_MSG::Copy(const void* fromThisMemory)
{
	if(GetLength()>0)
	{
		memcpy(GetDataAddress(),fromThisMemory,GetLength());
	}
}
Пример #4
0
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);
	}
}
Пример #5
0
void RT_MSG::Copy(const void * fromThisMemory, const unsigned int dataLength)
{
	SetLength(dataLength);
	if(dataLength > 0)
	{
		memcpy(GetDataAddress(),fromThisMemory,dataLength);
	}
}
Пример #6
0
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);
	}
}
Пример #7
0
		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);
			}
		}
Пример #8
0
		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);

		}
Пример #9
0
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);
	}
}
Пример #10
0
/**
 *	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;
}
Пример #11
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));
		}
Пример #12
0
		void MSG_BASE::Paste(void * toThisMemory) const
		{
			// no need to check if length is zero
			memcpy(toThisMemory, GetDataAddress(), GetLength());
		}
Пример #13
0
		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);
		}
Пример #14
0
		void MSG_BASE::Copy(const void * fromThisMemory)
		{
			memcpy(GetDataAddress(), fromThisMemory, GetLength());
		}
Пример #15
0
		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
		}