Ejemplo n.º 1
0
void SetKeyLayouts(char *Buffer)
{
	int index, j;
	index=0;
	
	for(j=0;j<(int)strlen(Buffer);j+=2)
		KeyLayouts[gOptions.KeyLayout][index++]=Hex2Char(Buffer+j)*16+Hex2Char(Buffer+j+1);
}
Ejemplo n.º 2
0
tstring Hex2Str(const tstring& strData)
{
	unsigned char c;
	tstring strRet = TEXT("");
	for(int i = 0; i < strData.size() / 2; i++)
	{
		c = Hex2Char(strData[i * 2]) * 16 + Hex2Char(strData[i * 2 + 1]);
		strRet += c;
	}

	return strRet;
}
Ejemplo n.º 3
0
// Function to convert string of chars to string of unsigned chars, eg "9E3D" -> 0x9E3D
// static
void Library::HexStr2CharStr(const char* pszHexStr, unsigned char* pucCharStr, int iSize)
{
	int i;
	unsigned char ch;
	for(i=0; i<iSize; i++)
	{
		Hex2Char(pszHexStr+2*i, ch);
		pucCharStr[i] = ch;
	}
}
Ejemplo n.º 4
0
//Function to convert string of chars to string of unsigned chars
void HexStr2CharStr(const char* pszHexStr, unsigned char* pucCharStr, unsigned long lSize)
{
    unsigned long i;
    unsigned char ch;
    for(i=0; i<lSize; i++)
    {
        Hex2Char(pszHexStr+2*i, ch);
        pucCharStr[i] = ch;
    }
}
Ejemplo n.º 5
0
void HexStr2CharStr(char *HexStr, char *CharStr)
{
	unsigned char *p = HexStr, *q = CharStr;


	while (*p) {
		if (*p & 0x80) {
			*q = *p;
			p++;
			q++;
			*q = *p;
		}
		else if (*p == '+') {
			*q = ' ';
		}
		else if (*p == '%') {
			p++;
/*
	 필요없는 듯 싶다.
			if (*p && *p == '%') {
				*q = *p;
			}
			else 
*/
			if (*p && *(p+1)) {
				*q = Hex2Char(*p, *(p+1));
				if (*q == 0) { // 바뀔 것이 아니다.
					*q++ = '%';
					continue; // % 다음부터 조사해야지..
				}
				p++;
			}
			else if (*p) { // exception
				*q++ = '%';
				*q = *p;
			}
			else { // *p == NULL일 때..
				*q++ = '%';
				break;
			}
		}
		else {
			*q = *p;
		}

		p++;
		q++;
	}
	
	*q = '\0';
}
Ejemplo n.º 6
0
//---------------------------------------------------------------------------
std::string URL_Encoded_Encode (const std::string& URL)
{
    string Result;
    string::size_type Pos;
    for (Pos=0; Pos<URL.size(); Pos++)
    {
        if ((URL[Pos]>='\x00' && URL[Pos]<='\x20')
         || URL[Pos]==','
         || URL[Pos]==';')
            Result+='%'+Hex2Char(URL[Pos]);
        else
            Result+=URL[Pos];
    }
    return Result;
}
Ejemplo n.º 7
0
/**************************************************************************//**
 * @brief  Memory protection fault second level exception handler.
 *****************************************************************************/
void MemManage_HandlerC( uint32_t *stack )
{
  static char text[ 80 ], s[ 5 ];
  uint32_t pc;

  pc = stack[6];                  /* Get stacked return address              */

  strcpy( text, "    MPU FAULT AT PC 0x" );
  s[ 0 ] = Hex2Char( pc >> 12 );
  s[ 1 ] = Hex2Char( pc >> 8 );
  s[ 2 ] = Hex2Char( pc >> 4  );
  s[ 3 ] = Hex2Char( pc );
  s[ 4 ] = '\0';
  strcat( text, s );
  strcat( text, "        " );
  ScrollText( text );

  SCB->CFSR |= 0xFF;              /* Clear all status bits in the            */
                                  /* MMFSR part of CFSR                      */
  __set_CONTROL( 0 );             /* Enter Priviledged state before exit     */
}
Ejemplo n.º 8
0
//---------------------------------------------------------------------------
std::string URL_Encoded_Encode (const std::string& URL)
{
    string Result;
    string::size_type Pos;
    for (Pos=0; Pos<URL.size(); Pos++)
    {
        if ((URL[Pos]>='\x00' && URL[Pos]<='\x20')
         || URL[Pos]=='\x7F'
         || URL[Pos]==' '
         || URL[Pos]=='<'
         || URL[Pos]=='>'
         || URL[Pos]=='#'
         || URL[Pos]=='%'
         || URL[Pos]=='\"'
         || URL[Pos]=='{'
         || URL[Pos]=='}'
         || URL[Pos]=='|'
         || URL[Pos]=='\\'
         || URL[Pos]=='^'
         || URL[Pos]=='['
         || URL[Pos]==']'
         || URL[Pos]=='`'
         /*|| URL[Pos]==';'
         || URL[Pos]=='/'
         || URL[Pos]=='?'
         || URL[Pos]==':'
         || URL[Pos]=='@'
         || URL[Pos]=='&'
         || URL[Pos]=='='
         || URL[Pos]=='+'
         || URL[Pos]=='$'
         || URL[Pos]==','*/)
            Result+='%'+Hex2Char((unsigned char)URL[Pos]);
        else
            Result+=URL[Pos];
    }
    return Result;
}
Ejemplo n.º 9
0
std::wstring URL_Encoded_Encode (const std::wstring& URL)
{
    wstring Result;
    wstring::size_type Pos;
    for (Pos=0; Pos<URL.size(); Pos++)
    {
        if (URL[Pos]<=L'\x20'
         || URL[Pos]==L'\x7F'
         || URL[Pos]==L' '
         || URL[Pos]==L'<'
         || URL[Pos]==L'>'
         || URL[Pos]==L'#'
         || URL[Pos]==L'%'
         || URL[Pos]==L'\"'
         || URL[Pos]==L'{'
         || URL[Pos]==L'}'
         || URL[Pos]==L'|'
         || URL[Pos]==L'\\'
         || URL[Pos]==L'^'
         || URL[Pos]==L'['
         || URL[Pos]==L']'
         || URL[Pos]==L'`'
         /*|| URL[Pos]==L';'
         || URL[Pos]==L'/'
         || URL[Pos]==L'?'
         || URL[Pos]==L':'
         || URL[Pos]==L'@'
         || URL[Pos]==L'&'
         || URL[Pos]==L'=L'
         || URL[Pos]==L'+'
         || URL[Pos]==L'$'
         || URL[Pos]==L','*/)
            Result+=L'%'+Hex2Char(URL[Pos]);
        else
            Result+=URL[Pos];
    }
    return Result;
}