亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? encoding.cpp

?? PGP—Pretty Good Privacy
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
 *
 *  Args:
 *   pBin     [IN]    the binary data (or NULL to close the encoder)
 *   nLen     [IN]    the length of the binary data (or 0 to close the encoder)
 *   pQP      [IN]    pointer to buffer for the quoted-printable data
 *   eQPstate [IN/OUT] state; caller must preserve
 *
 *  Returns: The length of the quoted-printable data
 */
long EncodeQP(
	char *pBin,
	long nLen,
	char *pQP,
	EncQPPtr eQPstate)
{
	/* These characters are legal to leave UNQUOTED, everything else must be 
		quoted */
	const char *gQPEncodeChars
	= "\t\n\r %&'()*+,-./0123456789:;<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghij"
	"klmnopqrstuvwxyz";

	/* The hex digits -- in order */
	const char *pHexArr = "0123456789ABCDEF";
	const char *pQPStart = pQP; /* Remember the start pos */
	char *pEnd, ch, cLastChar;
	int nLineChars, bEncode;

	/* Check if this call is to close the encoding */
	if ((pBin == NULL) || (nLen < 1))
	{
		/* If there is anything on the current line, cap it with an equal */
		/* This avoids having trailing whitespace that would be ignored */
		/* Newline is added for good measure, because we assume TEXT, this */
		/*  shouldn't be a problem */
		if ((eQPstate->nCurLineLen) > 0)
		{
			*pQP++ = '=';
			pQP = newline_copy(pQP);

			eQPstate->nCurLineLen = 0;
			return (pQP - pQPStart);
		}

		return (0);
	}

	/* Restore the state from the caller data */
	nLineChars = eQPstate->nCurLineLen;
	cLastChar = eQPstate->cLastChar;

	/* Loop through the binary data */
	for (pEnd = pBin + nLen; pBin < pEnd; pBin++)
	{
		/* Check if the binary character must be encoded */
		bEncode = (strchr(gQPEncodeChars, (ch = *pBin)) ? 0 : 1);

		/* Will this action put us past the 76 char limit? */
		if ((nLineChars + (bEncode ? 3 : 1)) > 76)
		{
			/* Cap the line, and add a newline */
			*pQP++ = '=';
			pQP = newline_copy(pQP);

			nLineChars = 0; /* Starting new line */
		}

		if (bEncode) /* Encode the character using hex (ie. "A" -> "=41") */
		{
			*pQP++ = '=';
			*pQP++ = pHexArr[(ch>>4) & 0xF];
			*pQP++ = pHexArr[ch & 0xF];
			
			nLineChars += 3;
		}
		else /* No encoding needed, just copy character over */
		{
			*pQP++ = ch;

			/* If we copied a newline, then we need to reset the line char
			count */
			if (newline_test(cLastChar, ch))
				nLineChars = 0;
			else
				nLineChars++;
		}

		/* Keep track of the last character */
		cLastChar = ch;
	}

	/* Save the state */
	eQPstate->nCurLineLen = nLineChars;
	eQPstate->cLastChar = cLastChar;

	/* Return the number of characters we but in the buffer */
	return (pQP - pQPStart);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/*
 *  Convert quoted printable data to binary
 *
 *  Args:
 *   pQP       [IN]   the quoted printable data (or NULL to close the decoder)
 *   nLen      [IN]   the length of the quoted printable data 
						(or 0 to close the decoder)
 *   pBin      [IN]   pointer to buffer to hold binary data
 *   dQPstate  [IN/OUT] pointer to decoder state; caller must preserve
 *   decErrCnt [OUT]    the number of decoding errors found
 *
 *  Returns: The length of the binary data
 */
long DecodeQP(
	char *pQP,
	long nLen,
	char *pBin,
	DecQPPtr dQPstate,
	long *decErrCnt)
{
	const char *pBinStart = pBin;
	char *pEnd, ch;
	
	/* Restore the state from the caller */
	QPStates CurState = dQPstate->CurState;
	char cLastChar = dQPstate->cLastChar;

	/* Check if this call is to close the decoding */
	if ((pQP == NULL) || (nLen < 1))
	{
		/* If the state is in the middle of doing something, then error */
		if ((CurState == qpEqual) || (CurState == qpEncoded))
		{
			(*decErrCnt)++;
			CurState = qpNormal;
		}

		return (0);
	}

	/* Loop through the QP data */
	for (pEnd = pQP + nLen; pQP < pEnd; pQP++)
	{
		/* Get the current character */
		ch = *pQP;

		/* What state are we in? */
		switch (CurState)
		{
			case qpNormal: /* Normal: copy everything until an 'equal' */
				if (ch == '=')
					CurState = qpEqual; /* Found an 'equal' char */
				else
					*pBin++ = ch;
			break;
					
			case qpEqual: /* qpEqual: Last char was an equal */
				if (isxdigit(ch))                     /* This char should be a 
														hex digit */
					CurState = qpEncoded;
				else if (newline_test(cLastChar, ch)) /* Or it could be a 
														newline */
					CurState = qpNormal;
				else if (isspace(ch))                 /* Or some whitespace
														before the newline */
					CurState = qpTrailingWhitespace;
				else
					CurState = qpError;               /* Otherwise, an error */
			break;
				
			case qpEncoded: /* qpEncoded: Last char was the first 
								hex digit of an encoding */
				if ((isxdigit(ch)) && (isxdigit(cLastChar)))
				{
					int left = hex2dec(cLastChar);
					int right = hex2dec(ch);
					int leftshift = left << 4;
					int final = leftshift | right;
					/* Decode the hex digits into a character */
					*pBin++ = final;
					CurState = qpNormal;
				}
				else
					CurState = qpError; /* This char is not a hex digit: 
											an error */
			break;

			case qpTrailingWhitespace: /* qpTrailingWhitespace: whitespace 
											is allowed after */
				                       /*  an equals and before the newline */
				if (newline_test(cLastChar, ch))
					CurState = qpNormal; /* When we find the newline, 
											don't copy it */
				else if (!isspace(ch))
					CurState = qpError; /* If we get to some char BEFORE
											a newline: an error */
			break;
		}

		if (CurState == qpError) /* Count the errors, reset to normal 
									state (keep trying) */
		{
			(*decErrCnt)++;
			CurState = qpNormal;
		}

		/* Keep track of the last character */
		cLastChar = ch;
	}

	/* Save the state for next time */
	dQPstate->CurState = CurState;
	dQPstate->cLastChar = cLastChar;

	/* Return the number of characters we but in the buffer */
	return (pBin - pBinStart);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/*
 *  Parse Content-Transer-Encoding header line
 *
 *  Args:
 *   src [IN] Valid Transfer-Encoding header.
 *
 *  Returns: enumerated integer 'TrEncType' type specifying CTE.
 */
TrEncType rfc822_parse_cte(const char *src)
{
	const char *kPrefixStr = "Content-Transfer-Encoding:";
	const unsigned int kPrefixStrLen = strlen(kPrefixStr);

	char *cp = (char *) src + kPrefixStrLen, *mechanism = NULL;
	TrEncType cte = CTE_Error;

	// Check prefix
	if (strnicmp(src, kPrefixStr, kPrefixStrLen) == 0)
	{
		// Get first token (skips whitespace/comments)
		mechanism = rfc822_extract_token(&cp);

		// If we got something
		if ((mechanism) && (strlen(mechanism) > 0))
		{
			if (stricmp(mechanism, "base64") == 0)
				cte = CTE_Base64;
			else if (stricmp(mechanism, "quoted-printable") == 0)
				cte = CTE_QP;
			else if (stricmp(mechanism, "7bit") == 0)
				cte = CTE_7bit;
			else if (stricmp(mechanism, "8bit") == 0)
				cte = CTE_8bit;
			else if (stricmp(mechanism, "binary") == 0)
				cte = CTE_Binary;
		}

		safefree(mechanism);
	}

	return (cte);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/*
 *  Create Content-Transer-Encoding header line
 *
 *  NOTE: The user of this function is responsible for freeing the
 *        returned string.
 *
 *  Args:
 *   mechanism [IN] Enumerated integer 'TrEncType' type specifying CTE.
 *
 *  Returns: Content tranfer encoding header line string.
 */
char *rfc822_make_cte(TrEncType mechanism)
{
	const char *kPrefix = "Content-Transfer-Encoding: ";
	char pBuf[40], *pCTE;

	switch (mechanism)
	{
		case CTE_Base64:	strcpy(pBuf, "base64");				break;
		case CTE_QP:		strcpy(pBuf, "quoted-printable");	break;
		case CTE_7bit:		strcpy(pBuf, "7bit");				break;
		case CTE_8bit:		strcpy(pBuf, "8bit");				break;
		case CTE_Binary:	strcpy(pBuf, "binary");				break;

		default:
			return (NULL);
	}

	pCTE = (char *) malloc(strlen(pBuf) + strlen(kPrefix) + 1);
	strcpy(pCTE, kPrefix);
	strcat(pCTE, pBuf);

	return (pCTE);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/*
 *  Finds and extracts the content transfer encoding header line from a full
 *  multi-lined header. All unfolding (removing newlines) is done before
 *  header line is returned.
 *
 *  NOTE: The user of this function is responsible for freeing the
 *        returned string.
 *
 *  Args:
 *   pFullHeader [IN] Pointer to a full RFC822 header, including newlines
 *
 *  Returns: Extracted header line string; dynamically allocated.
 */
char *rfc822_extract_cte(const char *pFullHeader)
{
	return rfc822_extract_header(pFullHeader, "Content-Transfer-Encoding:");
}

/* ========================================================================== */
/*                              LOCAL FUNCTIONS                               */
/* ========================================================================== */

/*  NEWLINE STUFF: Used locally to copy and test for newlines  */
static const char gNewlineCh1 = '\r';
static const char gNewlineCh2 = '\n';

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* Insert a newline, returning position after newline */
/* static */ char *newline_copy(char *dst)
{
	*dst++ = gNewlineCh1;
	*dst++ = gNewlineCh2;

	return dst;
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* Check if these two characters represent a newline */
/* static */ int newline_test(const char prev, const char curr)
{
	return ((prev == gNewlineCh1) && (curr == gNewlineCh2));
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* Convert a single HEX character-digit (0123456789ABCDEF) to the decimal */
/* value.  NOTE: This function assumes the character is a valid hex digit */
/* static */ int hex2dec(const char ch)
{
	if (isdigit(ch))
		return (ch -'0');

	return ((toupper(ch) - 'A') + 10);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av在线网| 美女视频一区在线观看| 亚洲国产三级在线| 理论片日本一区| 成人污污视频在线观看| 欧美日韩一区高清| 精品不卡在线视频| 亚洲少妇中出一区| 美女任你摸久久| 99精品国产一区二区三区不卡| 视频在线在亚洲| 国产超碰在线一区| 欧美性色综合网| 精品成人一区二区| 亚洲一区二区av在线| 久久99精品国产麻豆婷婷| 色综合网色综合| 精品国产乱码久久久久久久久 | 国产精品一区二区久激情瑜伽| jlzzjlzz亚洲日本少妇| 日韩一级大片在线观看| 中文字幕中文在线不卡住| 日韩av在线播放中文字幕| 不卡一卡二卡三乱码免费网站| 91精品国产综合久久久久久久久久 | 午夜精品久久久久影视| 国产福利不卡视频| 4438x亚洲最大成人网| 中文字幕日韩av资源站| 久久狠狠亚洲综合| 欧美性淫爽ww久久久久无| 久久久.com| 日韩中文字幕区一区有砖一区| hitomi一区二区三区精品| 日韩三级视频在线观看| 一区二区激情小说| www.久久精品| 国产欧美精品一区二区三区四区 | 7777精品伊人久久久大香线蕉最新版| 欧美精彩视频一区二区三区| 日本午夜精品视频在线观看| 欧洲色大大久久| 国产精品久久久久久久久免费桃花 | 99久久99久久综合| 久久久国产一区二区三区四区小说 | 不卡av免费在线观看| 精品久久久三级丝袜| 日韩国产一区二| 欧美三日本三级三级在线播放| 亚洲人午夜精品天堂一二香蕉| 国产精品自在欧美一区| 日韩欧美国产综合一区| 天天影视网天天综合色在线播放| 日本福利一区二区| 国产精品丝袜一区| 国产成人午夜视频| 欧美精品一区二区久久久| 日本不卡视频一二三区| 欧美日韩激情在线| 国产a久久麻豆| 精品国产一区二区三区av性色| 日本亚洲视频在线| 欧美一区日韩一区| 日韩精品一二三| 51精品视频一区二区三区| 亚洲国产欧美在线| 欧美丝袜丝交足nylons图片| 亚洲一级二级在线| 在线观看免费一区| 亚洲电影激情视频网站| 欧美性大战久久久久久久蜜臀| 一区二区三区不卡视频 | 日韩精品1区2区3区| 欧美日韩www| 日韩精品一区第一页| 91精品国产品国语在线不卡| 日韩电影一区二区三区| 91精品麻豆日日躁夜夜躁| 麻豆精品一区二区三区| 精品人在线二区三区| 九九视频精品免费| 国产欧美日韩综合精品一区二区| 豆国产96在线|亚洲| 中文字幕中文在线不卡住| 色综合久久综合网97色综合 | 国产精品二三区| 成人h精品动漫一区二区三区| 国产精品网站一区| 91啦中文在线观看| 亚洲国产va精品久久久不卡综合 | 热久久国产精品| 精品99久久久久久| 国产精品18久久久久久vr| 亚洲欧洲成人自拍| 精品视频1区2区| 久久精品国产亚洲高清剧情介绍| 国产三区在线成人av| 97久久精品人人爽人人爽蜜臀| 亚洲中国最大av网站| 日韩一区二区三区四区| 久88久久88久久久| 中文字幕视频一区二区三区久| 欧洲精品一区二区三区在线观看| 日韩av一级片| 欧美激情一二三区| 欧美亚洲日本国产| 国产专区综合网| 亚洲视频一区在线| 日韩一级精品视频在线观看| 欧美一区二区三区视频在线观看 | 国产欧美一区二区精品忘忧草| 91在线国产福利| 日本成人中文字幕在线视频| 国产亚洲精品bt天堂精选| 色综合中文综合网| 亚洲午夜久久久久久久久电影院| 精品欧美久久久| 91一区二区三区在线观看| 日本不卡的三区四区五区| 国产精品入口麻豆九色| 6080yy午夜一二三区久久| 懂色av一区二区三区免费看| 亚洲午夜激情网页| 国产欧美一区二区精品性色超碰| 欧美日韩黄色影视| 国产成人午夜精品5599| 五月婷婷久久丁香| 中文字幕一区二区在线播放| 欧美一区二区三区人| 成人综合婷婷国产精品久久蜜臀 | 欧美一区二区三区四区在线观看| 不卡一二三区首页| 久久国产尿小便嘘嘘| 一级特黄大欧美久久久| 久久午夜免费电影| 欧美日韩mp4| 91亚洲男人天堂| 国产高清一区日本| 日本欧美一区二区三区| 亚洲精品视频在线观看网站| 久久久影院官网| 欧美三级蜜桃2在线观看| 成人在线视频一区二区| 精品一区二区三区在线播放视频| 一区二区免费视频| 国产精品国产三级国产| 欧美精品一区二区在线播放| 欧美久久一区二区| 色94色欧美sute亚洲线路二| 成人高清视频在线观看| 久久99久国产精品黄毛片色诱| 亚洲一二三四在线| 中文字幕亚洲一区二区va在线| 久久一区二区三区四区| 欧美一级久久久久久久大片| 欧洲av在线精品| 91一区二区三区在线观看| 粉嫩aⅴ一区二区三区四区五区| 美日韩一区二区| 日韩经典中文字幕一区| 亚洲国产精品视频| 亚洲综合色网站| 一区二区三区日韩欧美精品| 国产精品福利在线播放| 欧美国产丝袜视频| 国产日本欧美一区二区| 久久免费电影网| 久久久美女毛片| 久久精品亚洲精品国产欧美kt∨ | 蜜臀av性久久久久蜜臀aⅴ | 日韩欧美国产午夜精品| 欧美一区二区三区免费在线看| 欧美日韩不卡一区| 欧美日韩卡一卡二| 欧美日韩一区不卡| 色激情天天射综合网| 在线亚洲一区二区| 91搞黄在线观看| 欧美三级中文字幕在线观看| 欧美色窝79yyyycom| 91福利国产精品| 欧美日韩aaaaa| 91精品婷婷国产综合久久竹菊| 91精品视频网| 欧美不卡一区二区三区四区| 精品欧美乱码久久久久久| 欧美精品一区二区高清在线观看 | 国产成人小视频| 成人免费看黄yyy456| 99久久久精品| 在线视频欧美精品| 欧美三日本三级三级在线播放| 欧美人妇做爰xxxⅹ性高电影| 欧美男人的天堂一二区| 日韩三级免费观看| 国产亚洲欧美中文| 中文字幕在线免费不卡| 亚洲午夜在线电影| 日本aⅴ精品一区二区三区 | 国产欧美日韩视频一区二区 |