void
ParamTraits<Principal>::Write(Message* aMsg, const paramType& aParam) {
  bool isNull = !aParam.mPrincipal;
  WriteParam(aMsg, isNull);
  if (isNull) {
    return;
  }

  bool isSerialized = false;
  nsCString principalString;
  nsCOMPtr<nsISerializable> serializable = do_QueryInterface(aParam.mPrincipal);
  if (serializable) {
    nsresult rv = NS_SerializeToString(serializable, principalString);
    if (NS_SUCCEEDED(rv)) {
      isSerialized = true;
    }
  }

  if (!isSerialized) {
    MOZ_CRASH("Unable to serialize principal.");
    return;
  }

  WriteParam(aMsg, principalString);
}
void
nsSimpleNestedURI::Write(IPC::Message *aMsg)
{
    nsSimpleURI::Write(aMsg);

    IPC::URI uri(mInnerURI);
    WriteParam(aMsg, uri);
}
Example #3
0
void
StructuredCloneData::WriteIPCParams(Message* aMsg) const
{
  WriteParam(aMsg, mDataLength);

  if (mDataLength) {
    // Structured clone data must be 64-bit aligned.
    aMsg->WriteBytes(mData, mDataLength, sizeof(uint64_t));
  }
}
Example #4
0
void
StructuredCloneData::WriteIPCParams(IPC::Message* aMsg) const
{
  WriteParam(aMsg, DataLength());

  if (DataLength()) {
    // Structured clone data must be 64-bit aligned.
    aMsg->WriteBytes(Data(), DataLength(), sizeof(uint64_t));
  }
}
Example #5
0
void
ParamTraits<DxgiAdapterDesc>::Write(Message* aMsg, const paramType& aParam)
{
#if defined(XP_WIN)
  aMsg->WriteBytes(aParam.Description, sizeof(aParam.Description));
  WriteParam(aMsg, aParam.VendorId);
  WriteParam(aMsg, aParam.DeviceId);
  WriteParam(aMsg, aParam.SubSysId);
  WriteParam(aMsg, aParam.Revision);
  WriteParam(aMsg, aParam.DedicatedVideoMemory);
  WriteParam(aMsg, aParam.DedicatedSystemMemory);
  WriteParam(aMsg, aParam.SharedSystemMemory);
  WriteParam(aMsg, aParam.AdapterLuid.LowPart);
  WriteParam(aMsg, aParam.AdapterLuid.HighPart);
#endif
}
Example #6
0
/******************************************************************************
 函数名称:InitImportantParameter
 功能描述:初始化关键参数
 参数描述:
 参数名称:	输入/输出?	类型		描述

 返  回  值:FLOK(0)-写入成功
				 FLNOTOK(0xFF)-前100页全废
				PRI	-	主FLASH失效
				SLV	-	从FLASH失效

 作      者	:刘及华
 日      期:2004-09-02
 修改历史:
		日期		修改人		修改描述
		------		---------	-------------
******************************************************************************/
INT8U InitImportantParameter(void)
{
//	INT8U i = 0;

	ToggleWD();

	OS_ENTER_CRITICAL();
	(void)memset((void *)&DevStat, 0x00, sizeof(DevStat));			//参数全部初始化

	DevStat.err_occured = FALSE;
	DevStat.err_code = 0x0000;
	DevStat.id = 0x10;
	DevStat.mode = AUTO;
	DevStat.passwd = 0;

//  DevStat.MOD_REG.reg[0x0009] = 1000;
//  DevStat.MOD_REG.reg[0x000B] = 1000;
	//测试表
//	DevStat.MOD_REG.reg[0x0010] = 0xFFFF;
//	DevStat.MOD_REG.reg[0x0011] = 0x0000;
//	DevStat.MOD_REG.reg[0x0012] = 0xCBD9;
//	DevStat.MOD_REG.reg[0x0013] = 0x0082;
//	DevStat.MOD_REG.reg[0x0014] = 0xA5EC;
//	DevStat.MOD_REG.reg[0x0015] = 0x0104;
//	DevStat.MOD_REG.reg[0x0016] = 0x8837;
//	DevStat.MOD_REG.reg[0x0017] = 0x0186;

	OS_EXIT_CRITICAL();

	WriteParam();

	memset(PageBuf1, 0xFF, sizeof(PageBuf1));
//  FlashPageRead512(10, PageBuf1, 0);
//  memcpy((void *)&DevStat.reset_times, (void *)PageBuf1, sizeof(DevStat.reset_times));
	DevStat.reset_times = 0;
	memcpy((void *)PageBuf1, (void *)&DevStat.reset_times, sizeof(DevStat.reset_times));
	FlashPageWrite512(10, PageBuf1, 0);

	return ok;
}
Example #7
0
bool ProcRedirect(vector<pair<string,string> > &vt_param,string &errInfo)
{
	WriteParam(redirect,vt_param,"");

	string userName = GetValue(USERNAME,vt_param);
	string url = GetValue(URL,vt_param);

	if(!ValidateParamEmpty(userName.c_str()))
	{
		errInfo.append("ftpName not valid.");
		WriteLog(redirect,ERROR,"ftpName invalid");
		return false;
	}

	CVirtualHost *virtualHost;
	bool success = InitEnv(&virtualHost,userName,redirect);

	if(success)
	{
		if(url.empty())
		{
			string tmp = "";
			DeleteRedirect(tmp,virtualHost);
		}
		else
		{
			vector<string> vt_url;
			vector<string> vt_from;
			vector<string> vt_tmp;
			string to = "";
			SplitByComas(url,vt_url,';');
			int url_size = vt_url.size();
			for(int i = 0; i < url_size; i++)
			{
				to = "";
				vt_tmp.clear();
				SplitByComas(vt_url[i],vt_tmp,':');
				vt_from.clear();	
				SplitByComas(vt_tmp[0],vt_from);
				if(vt_tmp.size() > 1)
					to = vt_tmp[1];
				int size = vt_from.size();
				for(int k = 0; k < size; k++)
				{
					if(!to.empty())
						AddRedirect(vt_from[k],to,virtualHost);
					else
						DeleteRedirect(vt_from[k],virtualHost);
				}
			}
		}
	}
	if(success)
		success = virtualHost->SaveFile();

	if(success)
		WriteParam(redirect,vt_param,"success");
	else
	{
		errInfo.append("failed to process your resuest.");
		WriteParam(redirect,vt_param,"failed. write the config file failed.");
	}
	CVirtualHost::ReleaseVirtualHost(userName);
	return success;
}
Example #8
0
File: main.c Project: 12019/zibogas
// *****************************************************************
// 功能:		man_set_busnum
// 说明:		手动输入车号
// 入口参数:	
// 出口参数:	Null
// 作者:
// 返回值:		Null		
// *****************************************************************
void man_set_busnum(void)
{
	INT8U i = 0;
	INT8U input1[20];
	uchar  uckey;
	uint   uikey;
	uchar  ret;
	uchar  temp_uc[5];
//  if ( strcmp((void *)&DevStat.bus_number[0], "12345") == 0 )
//  {
//  	goto set_bus_number;
//  }

	EA_vCls();
	lcddisp(2, 1, (void *)"输入车号:           ");
	strcpy((void *)input1, "");

	for ( ;; )
	{
		i = EA_ucGetInputStr(2, 10, 20, EM_BIG_FONT | EM_MODE_CHAR | EM_ALIGN_LEFT | EM_SHOW_ORIGINALLY
							 , 5, 5, 0, (void *)input1); //刘及华,修改只能输入数字和字母
		if ( i == EM_SUCCESS )
			break;
		if ( i == EM_ABOLISH )
			return;      //do nothing
	}

	memcpy((void *)&CardInfo.bus_number[0], (void *)input1, 5);

	WriteParam();

	EA_ucSetInverse(EM_lcd_INVON);
	lcddisp(3, 1, (void *)"      输入成功      ");
	EA_ucSetInverse(EM_lcd_INVOFF);
	SleepMs(1500);

RESELECT:
	

	memcpy(temp_uc, &CardInfo.bus_number[0], 5);

	i = BlackName_Find((char *)temp_uc);	//白名单判断
	if ( i != ok )	 						//不是白名单
	{
		lcddisperr("该卡不在白名单中");
		Beeperr();
		return;
	}

	EA_vCls();
	EA_vDisplay(1, "车  号 :鲁C-%s", CardInfo.bus_number);

	lcddisp(4, 1, (void *)"     请刷员工卡     ");

	while(1)
	{
		if( CardInit() == ok )
			break;

		uckey = EA_ucKBHit();
		if ( uckey ==  EM_key_HIT )		 	//按下取消键
		{
			uikey = EA_uiInkey(0);
			if ( uikey == EM_key_CANCEL )   //按下取消键
			{
				return ;
			}
		}
	}

	ret = M1CardProcess();   //再检测员工卡
	if(ret == ok)
	{
		;
	}
	else
	{
		goto RESELECT;
	}

	return;
}
Example #9
0
File: main.c Project: 12019/zibogas
/******************************************************************************
 函数名称:TimeModify
 功能描述:要求输入时间,进行修改
 参数描述:
 参数名称:	输入/输出?	类型		描述
				
 返  回  值:无
				   
 作      者	:许岩
 日      期:2004-09-02
 修改历史:
		日期		修改人		修改描述
		------		---------	-------------
******************************************************************************/
void TimeModify(void)
{
	INT8U i = 0;
	INT8U input[50];
	INT8U buf[50];
	BUS_TIME ltime;


	for ( ;; )
	{
		EA_vCls();
//  	Get_Time(&ltime);
		EA_vDisp(1, 1, "当前生效时间:");
		sprintf((void *)buf, "       %02X:%02X        ", DevStat.effect_time.hour, DevStat.effect_time.minute);
		EA_vDisp(2, 1, (void *)buf);
		EA_vDisp(3, 1, "请输入新的时间:");
		(void)EA_ucClrKeyBuf();
		strcpy((void *)input, "");

		i = EA_ucGetInputStr(4, 8, 20, EM_BIG_FONT | EM_MODE_NUMBER | EM_ALIGN_LEFT | EM_SHOW_ORIGINALLY
		, 2, 2, 0, (void *)input);
		if ( i == EM_ABOLISH )
			return;
		if ( i != EM_SUCCESS )
			continue;
		
		i = EA_ucGetInputStr(4, 11, 20, EM_BIG_FONT | EM_MODE_NUMBER | EM_ALIGN_LEFT | EM_SHOW_ORIGINALLY
		, 2, 2, 0, (void *)input);
		if ( i == EM_ABOLISH )
			return;
		if ( i != EM_SUCCESS )
			continue;
		//  	sprintf(dbuf, "%s", input);
		//  	EA_vDisp(3, 1, dbuf);
		//  	sprintf(dbuf, "result:%02X", i);
		//  	EA_vDisp(4, 1, dbuf);

		ltime.hour = (ascii_to_hex(input[8]) << 4) | ascii_to_hex(input[9]);
		ltime.minute = (ascii_to_hex(input[11]) << 4) | ascii_to_hex(input[12]);

		if ( ltime.hour > 0x23 )       //小时应在0-23之间
			return ;


		
		if ( ltime.minute > 0x59 )                                   //分钟应在0-59之间
			return ;


		if ( (ltime.hour > 0x23) || (ltime.minute > 0x59) )
		{
			EA_vCls();
			EA_vDisp(4, 1, "时间格式错误");
			SleepMs(1500);
			continue;
		}

		DevStat.effect_time.hour = ltime.hour;
		DevStat.effect_time.minute = ltime.minute;
		WriteParam();

		EA_vCls();
		EA_vDisp(4, 1, "生效时间修改成功");
		SleepMs(1500);
		break;
	}
}