1. 程式人生 > >開發中遇到的問題(2015-10-16)

開發中遇到的問題(2015-10-16)

Issue 64: (Error -- Type mismatch (assignment) (int = pointer))
int getSocketFd(int iTypeint *pSocketFdint *pTransType)
{
    switch(iType)
    {
        case MTD_TYPE_UDP_ID_CARD_READER://身份證讀卡器
            {
                *pSocketFd = &gi4SocketFd_IdCard; =》*pTransType = MTD_TYPE_UDP_ID_CARD_READER;
            }             break;         case MTD_TYPE_UDP_POS://POS讀卡器             {                 *pSocketFd = &gi4SocketFd_Pos; =》 pSocketFd = &gi4SocketFd_Pos;                 *pTransType = MTD_TYPE_UDP_POS;             }             break;         case MTD_TYPE_UDP_CAN_BUS://CAN_BUS讀卡器
            {                 *pSocketFd = &gi4SocketFd_CanBus; =》 SocketFd = &gi4SocketFd_CanBus;                 *pTransType = MTD_TYPE_UDP_CAN_BUS;             }             break;         default:             PRERR("default: ERR iType=%d"iType);             break;     } }

Issue 64: (Error -- Type mismatch (assignment) (ptrs to signed/unsigned))


int getUdpPackData(char* ptrRecvBuff/*UDP資料地址*/
				   unsigned int iStartOffset/*開始位置*/
				   unsigned int MaxRecvBuff/*已經接收到的UDP資料包大小*/
				   unsigned int MaxCount/*每包最多字元數*/
				   char* ptrPackData/*返回資料的地址*/
{
	/*臨時變數*/
	unsigned int iTempStart;
	unsigned char* ptrGet;
	unsigned char* ptrPut;
	unsigned char chChar1chChar2;
	int iTrueRecvCount = 0; /*還原轉義後的資料位元組數*/
	unsigned char u1HeadTailFlag = 0; /*查詢包頭標誌 0沒有/1有包頭/2有包尾 */
 
	iTempStart = iStartOffset/*開始位置*/
	ptrGet = ptrRecvBuff;=》ptrGet = (unsigned char*)ptrRecvBuff;
	ptrPut = ptrPackData;=》ptrPut = (unsigned char*)ptrPackData;

Issue 64: (Error -- Type mismatch (arg. no. 4) (unsigned char * = unsigned int))

void vPrtSmartDevModuleRunLog(charptrFunctionNameint iLineNocharpszTitleunsigned charpusMsgunsigned int uiMsgLencharlogFilecharlogFileBak);
vPrtSmartDevModuleRunLog(__FUNCTION__, __LINE__, "Err: ping : create socket error"strlen("Err: ping : create socket error"), 0, CardModuleLogCardModuleLogBak);=>改正vPrtSmartDevModuleRunLog(__FUNCTION__, __LINE__, "Err: ping : create socket error"NULL,                                      0, CardModuleLogCardModuleLogBak);

Issue 64: (Error -- Type mismatch (arg. no. 3) (unsigned int = pointer))

	memcpy(&g_SCardrReadBuffer.aSOneCardDate[u1Block].SCardDate.au1Date[0], &card.u1aBlockData[offset], len<g_SCardrReadBuffer.aSOneCardDate[u1Block].SCardDate.au1Date ? len : g_SCardrReadBuffer.aSOneCardDate[u1Block].SCardDate.au1Date);
=>改正	
	memcpy(&g_SCardrReadBuffer.aSOneCardDate[u1Block].SCardDate.au1Date[0], &card.u1aBlockData[offset], len<sizeof(g_SCardrReadBuffer.aSOneCardDate[u1Block].SCardDate.au1Date) ? len : sizeof(g_SCardrReadBuffer.aSOneCardDate[u1Block].SCardDate.au1Date));
	

Issue 64: (Error -- Type mismatch (arg. no. 1) (struct _IO_FILE * = int))

	int fd = NULL;
	int offset = 0;
	if (fseek(fdoffsetSEEK_SET) == -1)//移動到開頭
	=》
	if (lseek(fdoffsetSEEK_SET) == -1)//移動到開頭
	{
		_printf("GetUintFromFp:File FP Error!\r\n");
		close(fd);
		return DEF_FAIL_1;
	}

Issue 19: (Error -- Useless Declaration)

extern int8 rf_antenna_sta(ucharpc_src_bufuchar flag);/*天線開關 */;

=》

extern int8 rf_antenna_sta(ucharpc_src_bufuchar flag);/*天線開關 */

Issue 64: (Error -- Type mismatch (assignment) (ptrs to void/nonvoid))

p0XFE=memchr(pcu1Hex,0xfe,u2DataLenMax);//當第一次遇到字元ch時停止查詢。如果成功,返回指向字元ch的指標;否則返回NULL。

=》

p0XFE=(char*)memchr(pcu1Hex,0xfe,u2DataLenMax);//當第一次遇到字元ch時停止查詢。如果成功,返回指向字元ch的指標;否則返回NULL。