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

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

?? encoding.cpp

?? PGP8.0源碼 請認真閱讀您的文件包然后寫出其具體功能
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
 *  Functions to encode and decode using BASE64 or Quoted-Printable
 *  Also a transfer-encoding header line parser
 *
 *  Filename: encoding.cpp
 *
 *  Last Edited: Friday, August 30, 1996
 *
 *  Author: Scott Manjourides
 *
 *  Portions adopted from code originally written by Stever Dorner.
 *  Copyright 1995, 1996 QUALCOMM Inc.
 *
 *  Send comments and questions to <emsapi-info@qualcomm.com>
 */

/*	$Id: ENCODING.CPP,v 1.1 1999/10/05 16:29:26 dgal Exp $	*/

#include <windows.h>
#include "ems-win.h"

#include "encoding.h"
#include "rfc822.h"    
#include "string.h" 
#include "ctype.h"   
#include "stdlib.h"

/* ========================================================================= */

#define safefree(p) { if (p) { free(p); (p) = NULL; } }

/* ========================================================================= */

/* Local util functions */
static char *newline_copy(char *dst);
static int newline_test(const char prev, const char curr);
static int hex2dec(const char ch);

/*****************************************************************************/
/*                                B A S E 6 4                                */
/*****************************************************************************/

/* Base64 encoder/decoder ported from Macintosh source by Myra Callen */

#define SKIP (-1)
#define FAIL (-2)
#define PAD  (-3)

#define kNewLine			"\015\012"
#define kNewLineLength (2)

#define ABS(x)   ((x)<0 ? -(x) : (x))

static char *g64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static short g64DecodeArr[] = 
{
	FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,SKIP,SKIP,FAIL,FAIL,SKIP,FAIL,FAIL,	/* 0 */
	FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,	/* 1 */
	SKIP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L,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,	/* E */
	FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,	/* F */
  /* 0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F  */
};

/*
 * Bit extracting macros
 */
#define Bot2(b) ((b)&0x3)
#define Bot4(b) ((b)&0xf)
#define Bot6(b) ((b)&0x3f)
#define Top2(b) Bot2((b)>>6)
#define Top4(b) Bot4((b)>>4)
#define Top6(b) Bot6((b)>>2)

/*
 * the decoder
 */
#define EncodeThree64(bin,b64,bpl)	EncodeThreeFour(bin,b64,bpl,g64EncodeChars)

#define EncodeThreeFour(bin,b64,bpl,vector)                     \
	do                                                          \
	{                                                           \
		if ((bpl)==68)                                          \
		{                                                       \
			(b64) = newline_copy(b64);                          \
			(bpl) = 0;                                          \
		}                                                       \
		(bpl) += 4;                                             \
		*(b64)++ = vector[Top6((bin)[0])];                      \
		*(b64)++ = vector[Bot2((bin)[0])<<4 | Top4((bin)[1])];  \
		*(b64)++ = vector[Bot4((bin)[1])<<2 | Top2((bin)[2])];  \
		*(b64)++ = vector[Bot6((bin)[2])];                      \
	}                                                           \
	while (0)

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

/*
 *  Convert binary data to base64
 *
 *  Args:
 *   binPtr     [IN]     the binary data (or NULL to close encoder)
 *   binLen     [IN]     the length of the binary data
 *   sixFourPtr [IN]     pointer to buffer for the base64 data
 *   e64        [IN/OUT] state; caller must preserve
 *
 *  Returns: The length of the base64 data
 */
long Encode64(
	char *binPtr,
	long binLen,
	char *sixFourPtr,
	Enc64Ptr e64)
{
	char *binSpot;									/* the byte currently being decoded */
	char *sixFourSpot = sixFourPtr;	/* the spot to which to copy the encoded chars */
	short bpl;
	char *end;											/* end of integral decoding */

	bpl = e64->bytesOnLine;	/* in inner loop; want local copy */
	
	if (binLen)
	{
		
		/*
		 * do we have any stuff left from last time?
		 */
		if (e64->partialCount)
		{
			short needMore = 3 - e64->partialCount;
			if (binLen >= needMore)
			{
				/*
				 * we can encode some bytes
				 */
				memcpy(e64->partial+e64->partialCount,binPtr,needMore);
				binLen -= needMore;
				binPtr += needMore;
				EncodeThree64(e64->partial,sixFourSpot,bpl);
				e64->partialCount = 0;
			}
			/*
			 * if we don't have enough bytes to complete the leftovers, we
			 * obviously don't have 3 bytes.  So the encoding code will fall
			 * through to the point where we copy the leftovers to the partial
			 * buffer.  As long as we're careful to append and not copy blindly,
			 * we'll be fine.
			 */
		}
		
		/*
		 * we encode the integral multiples of three
		 */
		end = binPtr + 3*(binLen/3);
		for (binSpot = binPtr; binSpot < end; binSpot += 3)
		{
			EncodeThree64(binSpot,sixFourSpot,bpl);
			/* *sixFourLen = sixFourSpot - sixFourPtr; */
		}
		
		/*
		 * now, copy the leftovers to the partial buffer
		 */
		binLen = binLen % 3;
		if (binLen)
		{
			memcpy(e64->partial+e64->partialCount,binSpot,binLen);
			e64->partialCount += (short)binLen;
		}
	}
	else
	{
		/*
		 * we've been called to cleanup the leftovers
		 */
		if (e64->partialCount)
		{
			if (e64->partialCount<2) e64->partial[1] = 0;
			e64->partial[2] = 0;
			EncodeThree64(e64->partial,sixFourSpot,bpl);
			
			/*
			 * now, replace the unneeded bytes with ='s
			 */
			sixFourSpot[-1] = '=';
			if (e64->partialCount==1) sixFourSpot[-2] = '=';
		}
	}

	e64->bytesOnLine = bpl;	/* copy back to state buffer */

	return (sixFourSpot - sixFourPtr);
}

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

/*
 *  Convert base64 data to binary
 *
 *  Args:
 *   sixFourPtr [IN]     the base64 data (or nil to close decoder)
 *   sixFourLen [IN]     the length of the base64 data
 *   binPtr     [IN]     pointer to buffer to hold binary data
 *   d64        [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 Decode64(
	char *sixFourPtr,
	long sixFourLen,
	char *binPtr,
	Dec64Ptr d64,
	long *decErrCnt)
{
	short 	decode;													/* the decoded short */
	unsigned char 		c;															/* the decoded byte */
	/* we separate the short & the byte to the compiler can worry about byteorder */
	char *end = sixFourPtr + sixFourLen;	/* stop decoding here */
	char *binSpot = binPtr;								/* current output character */
	short 	decoderState;		/* which of 4 bytes are we seeing now? */
	long 		invalCount;			/* how many bad chars found this time around? */
	long 		padCount;				/* how many pad chars found so far? */
	unsigned char 		partial;				/* partially decoded byte from/for last/next time */
	short wasCR;
	char *sixFourStartPtr;
	
	/*
	 * fetch state from caller's buffer
	 */
	decoderState = d64->decoderState;
	invalCount = 0;	/* we'll add the invalCount to the buffer later */
	padCount = d64->padCount;
	partial = d64->partial;
	wasCR = d64->wasCR;
	
	if (sixFourLen)
	{
		sixFourStartPtr = sixFourPtr;
		for (;sixFourPtr<end;sixFourPtr++)
		{
			switch(decode=g64DecodeArr[*sixFourPtr])
			{
				case SKIP: break;									/* skip whitespace */
				case FAIL: invalCount++; break;		/* count invalid characters */
				case PAD: padCount++; break;			/* count pad characters */
				default:
					/*
					 * found a non-pad character, so if we had previously found a pad,
					 * that pad was an error
				 	*/
					if (padCount) {invalCount+=padCount;padCount=0;}
					
					/*
					 * extract the right bits
					 */
					c = (char) decode;
					switch (decoderState)
					{
						case 0:
							partial = c<<2;
							decoderState++;
							break;
						case 1:
							*binSpot++ = partial|Top4(c);
							partial = Bot4(c)<<4;
							decoderState++;
							break;
						case 2:
							*binSpot++ = partial|Top6(c);
							partial = Bot2(c)<<6;
							decoderState++;
							break;
						case 3:
							*binSpot++ = partial|c;
							decoderState=0;
							break;
					} /* switch decoderState */
			} /* switch decode */
		} /* for sixFourPtr */
	} /* if sixFourLen */
	else
	{
		/*
		 * all done.  Did all end up evenly?
		 */
		switch (decoderState)
		{
			case 0:
				invalCount += padCount;		/* came out evenly, so should be no pads */
				break;
			case 1:
				invalCount++;							/* data missing */
				invalCount += padCount;		/* since data missing; should be no pads */
				break;
			case 2:
				invalCount += ABS(padCount-2);	/* need exactly 2 pads */
				break;
			case 3:
				invalCount += ABS(padCount-1);	/* need exactly 1 pad */
				break;
		}
	}
	
	/*
	 * save state in caller's buffer
	 */
	d64->decoderState = decoderState;
	d64->invalCount += invalCount;
	d64->padCount = padCount;
	d64->partial = partial;
	d64->wasCR = wasCR;

	*decErrCnt = invalCount;

	return (binSpot - binPtr);
}

/*****************************************************************************/
/*                      Q U O T E D - P R I N T A B L E                      */
/*****************************************************************************/

/* ------------------------------------------------------------------------- */
/* NOTE: To handle BINARY data, you must always quote newline characters,    */
/*   this implementation assumes TEXT data and thus does not encode newlines */
/* ------------------------------------------------------------------------- */

/*
 *  Convert binary data to quoted-printable
 *
 *  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)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99国产精品久久| 在线电影欧美成精品| 欧美日韩视频不卡| 国产视频在线观看一区二区三区| 亚洲欧美日韩国产手机在线 | 日本强好片久久久久久aaa| 国产·精品毛片| 在线成人免费观看| 亚洲美腿欧美偷拍| 不卡高清视频专区| 精品免费视频.| 午夜精品影院在线观看| 91偷拍与自偷拍精品| 欧美激情一区二区在线| 久久99久久99精品免视看婷婷 | 色婷婷av一区| 久久九九全国免费| 久久福利资源站| 欧美三片在线视频观看| 一区二区三区在线不卡| 99久久精品国产一区| 久久久久九九视频| 韩国理伦片一区二区三区在线播放| 日本电影欧美片| 亚洲靠逼com| 北条麻妃国产九九精品视频| 中文字幕第一区| 国产一区二区三区蝌蚪| 久久综合色综合88| 极品尤物av久久免费看| 欧美一级欧美三级| 青青草国产精品97视觉盛宴| 欧美日韩成人在线一区| 亚洲一区二区三区视频在线 | 麻豆精品在线播放| 欧美日韩精品一区二区在线播放| 亚洲乱码中文字幕| 一本一道久久a久久精品| 国产精品久久久久天堂| 国产一区二区导航在线播放| 精品久久久久久综合日本欧美| 日韩电影免费在线| 日韩欧美国产一二三区| 日韩vs国产vs欧美| 欧美电影免费观看高清完整版在线观看 | 久久视频一区二区| 韩国成人福利片在线播放| 久久综合九色综合久久久精品综合| 日韩国产精品久久| 日韩欧美电影一区| 国产成人免费视频网站| 国产性色一区二区| 99久久婷婷国产综合精品| 亚洲欧洲一区二区在线播放| 一本到不卡精品视频在线观看| 综合久久久久久| 欧美在线你懂的| 视频在线观看一区| 精品99一区二区三区| av一区二区三区| 亚洲不卡av一区二区三区| 91精品国产综合久久香蕉的特点| 久久精工是国产品牌吗| 国产精品毛片高清在线完整版| 日本道精品一区二区三区| 日本成人中文字幕| 国产精品久久久久aaaa| 在线免费观看日本欧美| 天堂久久久久va久久久久| 欧美一区午夜视频在线观看| 最新热久久免费视频| 亚洲国产精品久久人人爱蜜臀 | 精品国产欧美一区二区| 成人h动漫精品| 日本免费在线视频不卡一不卡二| 久久久精品国产免费观看同学| 中文字幕一区二区日韩精品绯色| 久久精品国产第一区二区三区| 欧美日韩国产系列| 婷婷综合久久一区二区三区| 91国产免费看| 亚洲成人激情自拍| 91精品国产高清一区二区三区| 麻豆国产精品官网| 久久久国产午夜精品| 国产精品亚洲一区二区三区在线| 2023国产精华国产精品| 成人激情小说乱人伦| 日韩伦理免费电影| 欧美亚洲国产一区在线观看网站| 亚洲一区免费视频| 日韩无一区二区| 国产尤物一区二区| 亚洲欧美在线aaa| 91久久国产最好的精华液| 肉丝袜脚交视频一区二区| 91精品国产综合久久久久| 国产一区二区三区四| 中文字幕精品一区二区三区精品| 色乱码一区二区三区88| 午夜精品福利在线| 久久综合九色综合97婷婷| 99精品视频中文字幕| 香蕉影视欧美成人| 欧美国产一区二区| 欧美三级在线看| 国产.精品.日韩.另类.中文.在线.播放| 亚洲欧美一区二区视频| 日韩一区二区三区视频| 成人av在线看| 日本欧美一区二区三区乱码| 亚洲欧洲av色图| 91精品国产综合久久久久久| 成人av在线播放网址| 丝袜美腿成人在线| 天堂影院一区二区| 中文字幕 久热精品 视频在线 | 色婷婷av一区二区| 国产一区二区精品久久| 亚洲一区在线电影| 国产精品网站一区| 欧美v日韩v国产v| 91成人国产精品| 懂色av一区二区三区蜜臀| 天天影视涩香欲综合网| 中文字幕一区二区三区不卡在线 | 国产精品国产三级国产| 日韩视频一区二区在线观看| 成人高清视频免费观看| 日产国产欧美视频一区精品 | 日韩国产成人精品| 中文字幕一区二区不卡| 久久先锋影音av鲁色资源网| 欧美高清激情brazzers| av电影在线不卡| 夫妻av一区二区| 国产在线精品一区在线观看麻豆| 日韩国产在线一| 亚洲免费成人av| 亚洲九九爱视频| 自拍偷拍欧美精品| 国产精品久99| 国产精品第一页第二页第三页| 久久视频一区二区| 精品国产青草久久久久福利| 欧美一区二区福利在线| 91麻豆精品国产91久久久资源速度| 在线观看网站黄不卡| 91麻豆国产精品久久| 99re这里只有精品视频首页| 福利一区二区在线| 成人精品免费网站| av成人动漫在线观看| 99视频国产精品| 91麻豆免费看| 欧美性高清videossexo| 欧美日韩你懂得| 欧美一卡二卡在线观看| 欧美一区二区三区不卡| 日韩视频免费直播| 精品区一区二区| 精品国产伦一区二区三区观看体验| 亚洲精品一区二区在线观看| 久久久综合视频| 国产精品成人在线观看| 一区二区三区精品| 天天综合天天做天天综合| 美女网站色91| 国产成人精品免费在线| 99久精品国产| 欧美日韩视频第一区| 日韩免费观看高清完整版| 久久久久国产精品厨房| 亚洲欧洲成人精品av97| 午夜激情一区二区三区| 麻豆91在线观看| 成人午夜激情视频| 欧美日韩亚洲国产综合| 久久亚洲私人国产精品va媚药| 国产精品国产三级国产普通话99| 亚洲综合激情小说| 奇米影视7777精品一区二区| 国产精品一区二区在线观看网站| 成人国产在线观看| 7777精品伊人久久久大香线蕉超级流畅 | 色综合中文字幕国产 | 亚洲精品国产一区二区三区四区在线| 亚洲精品乱码久久久久久久久| 日韩成人一级片| 成人午夜短视频| 欧美一区二区三区影视| 国产视频不卡一区| 亚洲午夜激情av| 国产另类ts人妖一区二区| 在线一区二区观看| 国产亚洲一区二区三区| 亚洲一区二区三区中文字幕| 国产精品亚洲综合一区在线观看| 欧美亚洲尤物久久| 亚洲国产岛国毛片在线|