void AuxGroupMember::BuildPacket(unsigned char *buffer, long &index)
{
	AddFlags(Flags, sizeof(Flags), buffer, index);

	if (Flags[0] & 0x10)	//ExtendedFlags[1] & 0x01
	{
		AddString(buffer, Data->Name, index);
	}

	if (Flags[0] & 0x20)	//ExtendedFlags[1] & 0x02
	{
		AddData(buffer, Data->GameID, index);
	}

	if (Flags[0] & 0x40)	//ExtendedFlags[1] & 0x04
	{
		AddData(buffer, Data->Formation, index);
	}

	if (Flags[0] & 0x80)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, Data->Position, index);
	}

	memset(Flags,0,sizeof(Flags));
}
Exemplo n.º 2
0
Arquivo: Ini.cpp Projeto: CrazyPro/ape
//以普通方式写一整数
bool Ini::Write(char *index, char *name, int num)
{
	//__ENTER_FUNCTION

	char string[32];
	sprintf(string, "%d", num);

	int n=FindIndex(index);
	if( n == -1 )	//新建索引
	{
		AddIndex(index);
		n=FindIndex(index);
		n=GotoLastLine(index);
		AddData(n, name, string);	//在当前位置n加一个数据
		return true;
	}

	//存在索引
	int m=FindData(n, name);
	if( m==-1 )		//新建数据
	{
		n=GotoLastLine(index);
		AddData(n, name, string);	//在当前位置n加一个数据
		return true;
	}

	//存在数据
	ModityData(n, name, string);	//修改一个数据

	return true;

	//__LEAVE_FUNCTION

//	return 0 ;
}
Exemplo n.º 3
0
void AuxElement::BuildExtendedPacket(unsigned char *buffer, long &index)
{
	AddFlags(ExtendedFlags, sizeof(ExtendedFlags), buffer, index);

	if (ExtendedFlags[0] & 0x10)	//ExtendedFlags[1] & 0x02
	{
		AddString(buffer, Data->SourceEntity, index);
	}

	if (ExtendedFlags[0] & 0x20)	//ExtendedFlags[1] & 0x04
	{
		AddString(buffer, Data->SourceObject, index);
	}

	if (ExtendedFlags[0] & 0x40)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, Data->Magnitude, index);
	}

	if (ExtendedFlags[0] & 0x80)	//ExtendedFlags[1] & 0x10
	{
		AddData(buffer, char(Data->IsActive), index);
	}

	if (ExtendedFlags[1] & 0x01)	//ExtendedFlags[1] & 0x20
	{
		AddData(buffer, Data->ExpirationTime, index);
	}
}
Exemplo n.º 4
0
void CBCGPMSMoneyDemoView::FillGrid ()
{
	ASSERT_VALID (this);

	m_wndGrid.InsertColumn (0, _T(""), 0);
	m_wndGrid.InsertColumn (1, _T("Quarter"), 185);
	m_wndGrid.InsertColumn (2, _T("Amount"), 80);
	m_wndGrid.InsertColumn (3, _T("Change"), 80);

	m_wndGrid.SetColumnAlign (0, HDF_RIGHT);
	m_wndGrid.SetColumnAlign (2, HDF_RIGHT);
	m_wndGrid.SetColumnAlign (3, HDF_RIGHT);
	m_wndGrid.SetHeaderAlign (2, HDF_RIGHT);
	m_wndGrid.SetHeaderAlign (3, HDF_RIGHT);
	m_wndGrid.SetColumnLocked (0);

	AddData (_T("I"), _T("$2,554.00"), 0.0021);
	AddData (_T("II"), _T("$2,370.00"), -0.0052);
	AddData (_T("III"), _T("$1,825.00"), -0.027);
	AddData (_T("IV"), _T("$4,778.00"), 0.0911);

	CBCGPGridRow* pRow5 = m_wndGrid.CreateRow (m_wndGrid.GetColumnCount ());
	
	pRow5->GetItem (0)->SetValue (_T("Total:"));
	pRow5->GetItem (2)->SetValue (_T("$ 1,1527.00"));

	m_wndGrid.AddRow (pRow5);

	m_wndGrid.MergeRange (CBCGPGridRange (0, 4, 1, 4));
	m_wndGrid.MergeRange (CBCGPGridRange (2, 4, 3, 4));

	m_wndGrid.EnableHeader (TRUE, 0);
	m_wndGrid.EnableColumnAutoSize (TRUE);
	m_wndGrid.SetReadOnly (TRUE);
}
Exemplo n.º 5
0
BOOL CIOCPBuffer::CreatePackage(BYTE Type, UINT iFilesize,UINT iBufferSize, const BYTE *const pData)
{
	UINT nBufLen=iBufferSize;
	if(iBufferSize<(MAXIMUMPACKAGESIZE-MINIMUMPACKAGESIZE-1-sizeof(UINT)))
	{
		// Perpare Package. 
		// Empty the Buffer..
		EmptyUsed();
		
		// Add one to the size header for the Type byte. .  
		nBufLen++;

		// Add The bytes for the iFilesize data. 
		nBufLen+=sizeof(UINT);

		// Add The Header
		AddData(nBufLen);
		
		// Add the Type. 
		AddData(Type);
		
		//Add the size data
		AddData(iFilesize);

		// Add the Buffer. 
		if(iBufferSize>0)
		AddData(pData,iBufferSize);
	return TRUE;
	}
	return FALSE;
}
Exemplo n.º 6
0
    void StringParser(const std::string& inStr, 
                      const std::string& inSeparator, 
                      Utils::ManagedList<std::string>& outData,
                      bool removeEmpty)
    {
        outData.Clear();

        //if no separator, return full input string
        if (inSeparator.empty()) 
        {
            AddData(inStr, outData, removeEmpty);
            return;
        }

        // if separtor exists, parse string 
        size_t prev = 0;
        while (true)
        {
            size_t next = inStr.find(inSeparator, prev);// inStr.find_first_of(inSeparator, prev);

            // copy symbols after last separator || 
            // copy all string if separator's not found
            if (next == string::npos)  
            {
                AddData(inStr.substr(prev), outData, removeEmpty);
                break;
            }

            AddData(inStr.substr(prev, (next - prev)), outData, removeEmpty);

            prev = next + inSeparator.size();
        }
    }
Exemplo n.º 7
0
void AuxBuff::BuildExtendedPacket(unsigned char *buffer, long &index)
{
	AddFlags(ExtendedFlags, sizeof(ExtendedFlags), buffer, index);

	if (ExtendedFlags[0] & 0x10)	//ExtendedFlags[1] & 0x02
	{
		AddString(buffer, Data->BuffType, index);
	}

	if (ExtendedFlags[0] & 0x20)	//ExtendedFlags[1] & 0x04
	{
		AddString(buffer, Data->ScrubTypeName, index);
	}

	if (ExtendedFlags[0] & 0x40)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, char(Data->IsPermanent), index);
	}

	if (ExtendedFlags[0] & 0x80)	//ExtendedFlags[1] & 0x10
	{
		AddData(buffer, Data->BuffRemovalTime, index);
	}

	if (ExtendedFlags[1] & 0x01)	//ExtendedFlags[1] & 0x20
	{
		Elements.BuildExtendedPacket(buffer, index);
	}
	else if (ExtendedFlags[1] & 0x20)
	{
		AddData(buffer, char(0x05), index);
	}
}
Exemplo n.º 8
0
void AuxEffect::BuildPacket(unsigned char *buffer, long &index)
{
	AddFlags(Flags, sizeof(Flags), buffer, index);

	if (Flags[0] & 0x10)	//ExtendedFlags[1] & 0x01
	{
		AddData(buffer, Data->Range, index);
	}

	if (Flags[0] & 0x20)	//ExtendedFlags[1] & 0x02
	{
		AddData(buffer, Data->Usage, index);
	}

	if (Flags[0] & 0x40)	//ExtendedFlags[1] & 0x04
	{
		AddData(buffer, Data->Targets, index);
	}

	if (Flags[0] & 0x80)	//ExtendedFlags[1] & 0x08
	{
		AddData(buffer, Data->Validity, index);
	}

	memset(Flags,0,sizeof(Flags));
}
Exemplo n.º 9
0
HRESULT CSimpleDataObjectImpl::AddData(UINT cfFormat, HGLOBAL hData)
{
	// Remove existing entry
	CFormat* pFormat=FindFormat(cfFormat, TYMED_HGLOBAL);
	if (pFormat)
	{
		m_Formats.Remove(pFormat);
	}
	
	// Create a new format entry
	pFormat=new CFormat(cfFormat, hData);

	// Add it
	m_Formats.Add(pFormat);

	// Add emulated modes...
	if (cfFormat==CF_TEXT && !FindFormat(CF_UNICODETEXT, TYMED_HGLOBAL) && hData)
	{
		AddData(CF_UNICODETEXT, TYMED_HGLOBAL);
	}
	if (cfFormat==CF_UNICODETEXT && !FindFormat(CF_TEXT, TYMED_HGLOBAL) && hData)
	{
		AddData(CF_TEXT, TYMED_HGLOBAL);
	}

	return S_OK;
}
Exemplo n.º 10
0
/*
 * CreatePackage(BYTE Type,CString stxt)
 * Creates one package in the buffe. (Se below) 
 *
 * [SizeHeader|Type|...String..\0]
 */
BOOL CIOCPBuffer::CreatePackage(BYTE Type,CString stxt)
{
	UINT nBufLen = stxt.GetLength();	
	if(nBufLen<(MAXIMUMPACKAGESIZE-MINIMUMPACKAGESIZE-1)&&nBufLen>0)
	{
		// Perpare Package. 
		// Empty the Buffer..
		EmptyUsed();
		
		// Add one to the size header for the null termination byte.  
		nBufLen++;

		// Add one to the size header for the Type byte. .  
		nBufLen++;

		// Add The Header
		AddData(nBufLen);
		
		// Add the Type. 
		AddData(Type);
		
		// Add the string. 
		int length=stxt.GetLength();
		AddData((PBYTE) stxt.GetBuffer(length),length);


		// Null Teriminate (for Strings) 
		BYTE nullTerm='\0';
		AddData(nullTerm);
		return TRUE;
	}
	return FALSE;
}
Exemplo n.º 11
0
/*================================================================ 
* 函数名:    Write
* 参数:      [in] (char *index_name)当前索引名称
*             [in] (char *key_name)KEY名称
*             [in] (char *value_name)VALUE名称
* 功能描述:   以普通方式写一字符串数据
* 返回值:    成功则返回true, 否则返false
================================================================*/
bool CIni::Write(char *index_name, char *key_name, char *value_name)
{
	int data_pos = FindIndex(index_name);
	if (data_pos == ERROR_DATA_POS)	//新建索引
	{
		AddIndex(index_name);
		data_pos = FindIndex(index_name);
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, value_name);	//在当前位置n加一个数据
		return true;
	}

	//存在索引
	int data_pos2 = FindData(data_pos, key_name);
	if (data_pos2 == ERROR_DATA_POS)		//新建数据
	{
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, value_name);	//在当前位置n加一个数据
		return true;
	}

	//存在数据
	ModityData(data_pos, key_name, value_name);	//修改一个数据

	return true;
}
 hkvMsgAssetProcessed(bool thumbnailCreated, bool dependenciesDetermined)
 : Message(MSG_ASSET_PROCESSED),
   m_thumbnailCreated(thumbnailCreated), m_dependenciesDetermined(dependenciesDetermined)
 {
   AddData(&m_thumbnailCreated, sizeof(bool));
   AddData(&m_dependenciesDetermined, sizeof(bool));
 }
Exemplo n.º 13
0
/*================================================================ 
* 函数名:    Write
* 参数:      [in] (char *index_name)当前索引名称
*             [in] (char *key_name)KEY名称
*             [in] (int int_num)整型值
* 功能描述:   以普通方式写一整数
* 返回值:    成功则返回true, 否则返false
================================================================*/
bool CIni::Write(char *index_name, char *key_name, int int_num)
{
	char string[32];
	sprintf(string, "%d", int_num);

	int data_pos = FindIndex(index_name);
	if (data_pos == ERROR_DATA_POS)	//新建索引
	{
		AddIndex(index_name);
		data_pos = FindIndex(index_name);
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, string);	//在当前位置n加一个数据
		return true;
	}

	//存在索引
	int data_pos2 = FindData(data_pos, key_name);
	if (data_pos2 == ERROR_DATA_POS)		//新建数据
	{
		data_pos = GotoLastLine(index_name);
		AddData(data_pos, key_name, string);	//在当前位置n加一个数据
		return true;
	}

	//存在数据
	ModityData(data_pos, key_name, string);	//修改一个数据

	return true;
}
Exemplo n.º 14
0
bool SymbolMap::LoadNocashSym(const char *filename)
{
	lock_guard guard(lock_);
	FILE *f = File::OpenCFile(filename, "r");
	if (!f)
		return false;

	while (!feof(f)) {
		char line[256], value[256] = {0};
		char *p = fgets(line, 256, f);
		if (p == NULL)
			break;

		u32 address;
		if (sscanf(line, "%08X %s", &address, value) != 2)
			continue;
		if (address == 0 && strcmp(value, "0") == 0)
			continue;

		if (value[0] == '.') {
			// data directives
			char* s = strchr(value, ':');
			if (s != NULL) {
				*s = 0;

				u32 size = 0;
				if (sscanf(s + 1, "%04X", &size) != 1)
					continue;

				if (strcasecmp(value, ".byt") == 0) {
					AddData(address, size, DATATYPE_BYTE);
				} else if (strcasecmp(value, ".wrd") == 0) {
					AddData(address, size, DATATYPE_HALFWORD);
				} else if (strcasecmp(value, ".dbl") == 0) {
					AddData(address, size, DATATYPE_WORD);
				} else if (strcasecmp(value, ".asc") == 0) {
					AddData(address, size, DATATYPE_ASCII);
				}
			}
		} else {				// labels
			int size = 1;
			char* seperator = strchr(value,',');
			if (seperator != NULL) {
				*seperator = 0;
				sscanf(seperator+1,"%08X",&size);
			}

			if (size != 1) {
				AddFunction(value,address,size);
			} else {
				AddLabel(value,address);
			}
		}
	}

	fclose(f);
	return true;
}
Exemplo n.º 15
0
void HexAreaClipboardPasteProxy::DoInit()
{
	AddData(HAPAHCI_NEVER,             wxT("never"),               _("Never"),                         SharedPasterPtr(new HexAreaNerverHexPaster));
	AddData(HAPAHCI_ACCORDINGTOCOPIER, wxT("according_to_copier"), _("According To Copying Behavior"), SharedPasterPtr(new HexAreaAccordingToCopierHexPaster));
	AddData(HAPAHCI_IFPOSSIBLE,        wxT("if_possible"),         _("If Possible"),                   SharedPasterPtr(new HexAreaIfPossibleHexPaster));
	AddData(HAPAHCI_ALWAYS,            wxT("always"),              _("Always"),                        SharedPasterPtr(new HexAreaAlwaysHexPaster));

	SetDefault(HAPAHCI_NEVER, IndexToVal(HAPAHCI_NEVER));
}
Exemplo n.º 16
0
void HexAreaClipboardCopyProxy::DoInit()
{
	AddData(HACCI_RAWBYTES,           wxT("raw_bytes"),             _("Copy as Raw Bytes"),              SharedCopierPtr(new HexAreaRawBytesCopier));
	AddData(HACCI_REGULARTEXT,        wxT("regular_text"),          _("Copy as Regular Text"),           SharedCopierPtr(new HexAreaRegularTextCopier));
	AddData(HACCI_HEXSTRING,          wxT("hex_string"),            _("Copy as Hex String"),             SharedCopierPtr(new HexAreaHexStringCopier));
	AddData(HACCI_HEXSTRINGWITHSPACE, wxT("hex_string_with_space"), _("Copy as Hex String with Spaces"), SharedCopierPtr(new HexAreaHexStringWithSpaceCopier));

	SetDefault(HACCI_RAWBYTES, IndexToVal(HACCI_RAWBYTES));
}
Exemplo n.º 17
0
extern "C" int translate_plug_process(CLogRow* row, std::vector<int8_t> inputFields, std::map<int8_t, std::vector<std::string> >& outputData, std::string function) 
{
	uint32_t size=inputFields.size();
	uint32_t ret=0;
	//g_log->log_error("#############item num :<%d>\n", __FILE__, __LINE__,size);
	if(size <= 1) return 0;
	uint32_t partionNum = 0;
	#if 0
	CLogField*  timeField = row->getField(inputFields[0]);
	if(timeField==NULL)
	{
		return 0;
	}
	std::string sTime = timeField->getFieldValStr();
	CLogField* ipField = row->getField(inputFields[1]);
	if(ipField==NULL)
	{
		return 0;
	}
	std::string strIp = ipField->getFieldValStr();
	#endif
	
	for(uint32_t i=0;i<10;i++)
	{

		CLogField* stepField;
		stepField = row->getField(inputFields[i+2]);
		if(stepField==NULL)
		{
			//g_log->log_error("########can not get item:<%d>\n", __FILE__, __LINE__,i+2);
			continue;
		}
		int64_t usedSpace=stepField->_value.iVal;

		stepField = row->getField(inputFields[i+2+10]);
		if(stepField==NULL)
		{
			//g_log->log_error("########can not get item:<%d>\n", __FILE__, __LINE__,i+12);
			continue;
		}
		int64_t totalSpace=stepField->_value.iVal;
		if((usedSpace<0) || (totalSpace<0))
		{
			//g_log->log_error("########partion:<%d> is -1 \n", __FILE__, __LINE__,i);
			continue;
		}
		uint32_t ratio = (usedSpace*100)/totalSpace;

		AddData(0,i,outputData);
		AddData(1,usedSpace,outputData);
		AddData(2,totalSpace,outputData);
		AddData(3,ratio,outputData);
		partionNum++;
	}
	//g_log->log_error("########total partion:<%d> \n", __FILE__, __LINE__,partionNum);
	return partionNum;
}
Exemplo n.º 18
0
void AsmCode::GenerateData(vector<pair<string, int>>* s)
{
	for(vector<pair<string, int>>::iterator it = s->begin(); it != s->end(); ++it)
	{
		if (it->second == 1)
			AddData(it->first, asm_dd, "0");
		else
			AddData(it->first, asm_dd, IntToStr(it->second)+" dup(0)");
	}
}
Exemplo n.º 19
0
void UpdatePeriods::DoInit()
{
    time_t timemax = std::numeric_limits<time_t>::max();

    AddData(UP_DAILY,   wxT("daily"),   _("every day"),   time_t(3600*24));
    AddData(UP_WEEKLY,  wxT("weekly"),  _("every week"),  time_t(3600*24*7));
    AddData(UP_MONTHLY, wxT("monthly"), _("every month"), time_t(3600*24*30));
    AddData(UP_NEVER,   wxT("never"),   _("never"),       timemax);

    SetDefault(default_idx, default_peroid);
}
Exemplo n.º 20
0
/*
 * CreatePackage(BYTE Type,CString stxt)
 * Creates one package in the buffe. (Se below) 
 *
 * [SizeHeader|Type|...String..\0]
 */
BOOL CIOCPBuffer::CreatePackage(BYTE Type)
{
		// Perpare Package. 
		// Empty the Buffer..
		EmptyUsed();
		// Add one to the size header for the Type byte. .  
		UINT nBufLen=1;
		// Add The Header
		AddData(nBufLen);
		// Add the Type. 
		AddData(Type);
		return TRUE;
}
Exemplo n.º 21
0
int Gene::LoadGene(string InFilename) {
	if (InFilename.length() == 0) {
		InFilename = GetData("FILENAME",STRING);
		if (InFilename.length() == 0) {
			InFilename = GetData("DATABASE",STRING);
			if (InFilename.length() == 0) {
				return FAIL;
			}
		}
	}
	if (InFilename.length() == 0) {
		return FAIL; 
	}
	SetData("FILENAME",InFilename.data(),STRING);

	if (!FileExists(InFilename)) {
		InFilename = GetDatabaseDirectory(GetParameter("database"),"gene directory")+InFilename;
		if (!FileExists(InFilename)) {
			return FAIL;
		}
	}

	ifstream Input;
	if (!OpenInput(Input,InFilename)) {
		SetKill(true);
		return FAIL;
	}
	
	do {
		vector<string>* Strings = GetStringsFileline(Input,"\t");
		if (Strings->size() >= 2) {
			//I save the input headings so I can print out the same headings when it's time to save the file
			AddData("INPUT_HEADER",(*Strings)[0].data(),STRING);
			for (int i=1; i < int(Strings->size()); i++) {
				Interpreter((*Strings)[0],(*Strings)[i],true);
			}
		}
		delete Strings;
	} while(!Input.eof());

	if (GetData("DATABASE",STRING).length() == 0) {
		AddData("DATABASE",InFilename.data(),STRING);
	}
	if (MainData != NULL && MainData->GetData("DATABASE",STRING).length() > 0 && GetData("DATABASE",STRING).length() > 0) {
		AddData(MainData->GetData("DATABASE",STRING).data(),GetData("DATABASE",STRING).data(),DATABASE_LINK);
	}

	Input.close();
	return SUCCESS;
}
Exemplo n.º 22
0
int CDataFileWriter::AddDataSwapped(int Size, void *pData)
{
#if defined(CONF_ARCH_ENDIAN_BIG)
	void *pSwapped = mem_alloc(Size, 1); // temporary buffer that we use duing compression
	int Index;
	mem_copy(pSwapped, pData, Size);
	swap_endian(&pSwapped, sizeof(int), Size/sizeof(int));
	Index = AddData(Size, Swapped);
	mem_free(pSwapped);
	return Index;
#else
	return AddData(Size, pData);
#endif
}
Exemplo n.º 23
0
int CDataFileWriter::AddDataSwapped(int Size, void *pData)
{
	dbg_assert(Size%sizeof(int) == 0, "incorrect boundary");

#if defined(CONF_ARCH_ENDIAN_BIG)
	void *pSwapped = mem_alloc(Size, 1); // temporary buffer that we use during compression
	mem_copy(pSwapped, pData, Size);
	swap_endian(pSwapped, sizeof(int), Size/sizeof(int));
	int Index = AddData(Size, pSwapped);
	mem_free(pSwapped);
	return Index;
#else
	return AddData(Size, pData);
#endif
}
Exemplo n.º 24
0
Gene::Gene(string InFilename, Data* InData) {
	MainData = InData;

	if (InFilename.length() > 0) {
		AddData("DATABASE",InFilename.data(),STRING);
		AddData("FILENAME",InFilename.data(),STRING);
		if (GetParameter("Load genes").compare("1") == 0) {
			LoadGene(InFilename);
		}
	}

	GeneUseVariable = NULL;
	Next = NULL;
	Previous = NULL;
}
Exemplo n.º 25
0
int NetworkCommunication::loadData(QString datafile)
{
    QFile file(datafile);


    if (file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        qDebug() << "NetworkCommunication::LoadData: File " << datafile << "is open";
        ClearData();
        QTextStream in(&file);
        int counter=0;
        while(!in.atEnd()) {
            counter++;
            QString line = in.readLine();
            QStringList fields = line.split(" ",QString::SkipEmptyParts);
            if(fields.length() == 2)
            {
                AddData(fields[0].toDouble(),fields[1].toDouble());
            }
        }
        file.close();
        emit(updateUI());
        return(0);
    }
    else
    {
        qDebug() << "NetworkCommunication::LoadData: File " << datafile << " can not be opened";
        return(1);
    }



}
Exemplo n.º 26
0
_Use_decl_annotations_
HRESULT CDataBlockStore::AddString(LPCSTR pString, uint32_t *pOffset)
{
    size_t strSize = strlen(pString) + 1;
    assert( strSize <= 0xffffffff );
    return AddData(pString, (uint32_t)strSize, pOffset);
}
Exemplo n.º 27
0
/*
 * CheckForFax()
 *
 * Since FaxModems don't set carrier high, we have to deal with this problem
 * that Citadel isn't set up for.  This function is called when Citadel detects
 * something on the serial port while carrier is not high.  If it's a FAX call,
 * this function is responsible for dealing with it.
 */
void CheckForFax()
{
	char c;
	NumToString *temp;

	if (MIReady()) {
		if ((c = Citinp()) == '\r' || c == '\n') {
			if ((temp = SearchList(&ResList, IdBuffer)) != NULL) {
				if (temp->num == R_FAX) {
					RunFax();
				}
				else {
					AddData(&ReceivedResults,
						strdup(IdBuffer), NULL, FALSE);
				}
			}
			memset(IdBuffer, 0, sizeof IdBuffer);
		}
		else if (c != '\n') {
			IdBuffer[strlen(IdBuffer)] = c;
			if (strlen(IdBuffer) >= BA_BUF_SIZE - 4) {
				memset(IdBuffer, 0, sizeof IdBuffer);
			}
		}
	}
}
Exemplo n.º 28
0
//显示增加子界面
void ShowAddDisplay(struct tagIndex *pInfo, int nInfoLen, int nBaseOffset)
{
    struct tagInfo *pEnterBuf = NULL;

    int nflag = 0;
    int nFree = 0;
    //接收返回值,如果是有效的索引再赋值给*pnLastIndex
    int nTmp = 0;

    //显示 输入联系人信息时的提示和保存输入信息
    EnterInfo(&pEnterBuf);
    
    nTmp = AddData(pInfo, nInfoLen, nBaseOffset, pEnterBuf);
    if (nTmp == -1)
    {
        ShowMsg("剩余空间不足!");
        return;
    }
    else if (nTmp == -2)
    {
        ShowMsg("剩余的连续空间不足,请运行碎片整理后重试!");
        return;
    }
    else if (nTmp == -3)
    {
        ShowMsg("添加失败!请重新启动电脑!");
        return;
    }    
    //释放输入联系人用的空间
    FreeEnterInfo(pEnterBuf);

    fflush(stdin); 
}
char* UDPClient::DeleteCharacter(long character_slot)
{
    fprintf(stderr,"\nSending Delete character.\n");

    //build packet structure.
    unsigned char data[128];
    int index = 0;
    memset (data, 0, 8);
    m_ticket_length = 0;
    m_global_account_rcv = false;
    m_ticket = 0;

	//data is character slot and account name
    AddData(data, ntohl(character_slot), index);
    AddDataLS(data, m_AccountName, index);

	m_ServerTCP->SendResponse(ENB_OPCODE_200D_DELETE_AVATAR, (unsigned char*)data, index);

	WaitForResponse();

	if (m_global_account_rcv)
    {
        fprintf(stderr,"\nReceived Avatar list.\n");
    }
    else
    {
        fprintf(stderr,"\nGlobal ERROR!!, server appears to be offline\n");
    }

    return m_ticket;
}
Exemplo n.º 30
0
int main(int argc,char* argv[])
{
	hashdata** ht;

	InitHashTable(&ht,N);

	const char* words[15] = {
		"ske","abs","mps","test","tt","total","smtp","mbsc",
		"adfads","asdfa","dfads","13413la","tt","linux","windows"
	};

	int i;
	for (i = 0; i < 15; i++)
	{
		AddData(ht,N,words[i]);
	}
	PrintHashTable(ht,N);

	for (i = 0; i < 15; i++)
	{
		DeleteData(ht,N,words[i]);
	}
	PrintHashTable(ht,N);

	DestroyHashTable(&ht,N);

	return 0;
}