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

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

?? cfs_tool.c

?? 基于nucleus實時操作系統的webserver源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/************************************************************************
*                                                                          
*    CopyrIght (c)  1993 - 2001 Accelerated Technology, Inc.               
*                                                                          
* PROPRIETARY RIGHTS of Accelerated Technology are involved in the subject 
* matter of this material.  All manufacturing, reproduction, use and sales 
* rights pertaining to this subject matter are governed by the license     
* agreement.  The recipient of this software implicity accepts the terms   
* of the license.                                                          
*                                                                          
*************************************************************************/

/************************************************************************
*                                                                       
* FILE NAME                                             VERSION          
*                                                                       
*       cfs_tool.c - Compression File System Tool         1.5      
*                                                                       
* COMPONENT                                                             
*         
*       Nucleus WebServ                                                             
*                                                                       
* DESCRIPTION                                                           
*                                                                       
*       This file holds functions that are used in the process of        
*       compressing and decompressing files.                             
*                                                                       
* DATA STRUCTURES                                                       
*                                                                       
*       Totals                          A global array to hold the       
*                                       cumulative totals.               
*                                                                       
* FUNCTIONS                                                             
*                                                                       
*       CFS_Compress                    Compresses a file in memory or   
*                                       magnetic media.
*       CFS_Decompress                  Decompresses a file in memory or 
*                                       magnetic media.                  
*       CFS_Fatal_Error                 Prints an Error message to a     
*                                       file.                            
*       CFS_Close_Output_Bit_File       Closes Output Bit File.          
*       CFS_Compress_File               Compresses Input Bit File.       
*       CFS_Open_Input_Bit_File         Open Input Bit file.             
*       CFS_Open_Output_Bit_File        Open the Output Bit file.        
*       CFS_Expand_File                 Expand compressed file.          
*       CFS_Build_Model                 Builds the compressed file model.
*       CFS_Init_Arithmetic_Encoder     Initializes the state of the     
*                                       Arithmetic Encoder.              
*       CFS_Convert_Int_To_Symbol       Converts an integer count into a 
*                                       symbol structure.                
*       CFS_Encode_Symbol               Encodes a symbol for file        
*                                       compression.                     
*       CFS_Flush_Arithmetic_Encoder    Flushes Arithmetic encoder.      
*       CFS_Output_Bits                 Outputs a bit based on a count   
*                                       and a specific code.             
*       CFS_Input_Counts                Reads the number of counts from  
*                                       the input file builds the table  
*                                       of cumulative counts.            
*       CFS_Init_Arithmetic_Decoder     Initializes the state of the     
*                                       Arithmetic Decoder.              
*       CFS_Get_Symbol_Scale            Retrieves symbol scale.          
*       CFS_Get_Current_Count           Retrieves current Count.         
*       CFS_Convert_Symbol_To_Int       Converts symbol to integer.      
*       CFS_Remove_Symbol_From_Stream   Removes a charcter from the input
*                                       stream.                          
*       CFS_Buf_Putc                    Puts a character in a buffer.    
*       CFS_Count_Bytes                 Counts number of bytes.          
*       CFS_Scale_Counts                Scales the number of byte counts.
*       CFS_Output_Counts               Outputs the byte counts.         
*       CFS_Build_Totals                Builds the table of cumulative   
*                                       totals.                          
*       CFS_Buf_Getc                    Gets a character from the input  
*                                       bit_file.                        
*       CFS_Input_Bit                   Reads a bit from an input file   
*                                       stream.                          
*       CFS_Input_Bits                  Inputs a bit based on a count.   
*       CFS_Output_Bit                  Outputs a Specific bit in the    
*                                       file stream.                     
*                                                                       
* DEPENDENCIES                                                          
*                                                                       
*       nu_websrv.h           
*                                                                       
************************************************************************/

#include "webserv/inc/nu_websr.h"

#ifdef WS_FILE_COMPRESSION
 
/*
 * Internal function prototypes.
 */
static VOID            CFS_Compress_File( WS_BIT_FILE * buf_input, WS_BIT_FILE * buf_output );
static VOID            CFS_Expand_File( WS_BIT_FILE *buf_input, WS_BIT_FILE *buf_output );
static VOID            CFS_Open_Input_Bit_File( WS_BIT_FILE *name,CHAR * buf, INT32 length );
static VOID            CFS_Open_Output_Bit_File( WS_BIT_FILE *name, CHAR * buf );
static VOID            CFS_Output_Bit( WS_BIT_FILE *bit_file, INT bit );
static VOID            CFS_Output_Bits( WS_BIT_FILE *bit_file, UINT32 code, INT count );
static INT             CFS_Input_Bit( WS_BIT_FILE *bit_file );
static VOID            CFS_Close_Output_Bit_File( WS_BIT_FILE *bit_file );
static INT             CFS_Buf_Getc( WS_BIT_FILE *bitfile );
static INT             CFS_Buf_Putc( unsigned int out, WS_BIT_FILE *bitfile );
static VOID            CFS_Build_Model( WS_BIT_FILE *input, WS_BIT_FILE *output );
static VOID            CFS_Scale_Counts( UINT32 counts[], UINT8 scaled_counts[] );
static VOID            CFS_Build_Totals( UINT8 scaled_counts[] );
static VOID            CFS_Count_Bytes( WS_BIT_FILE *input, UINT32 counts[] );
static VOID            CFS_Output_Counts( WS_BIT_FILE *output, UINT8 scaled_counts[] );
static VOID            CFS_Input_Counts( WS_BIT_FILE *input );
static VOID            CFS_Convert_Int_To_Symbol( INT symbol, WS_SYMBOL *s );
static VOID            CFS_Get_Symbol_Scale( WS_SYMBOL *s );
static INT             CFS_Convert_Symbol_To_Int( INT count, WS_SYMBOL *s );
static VOID            CFS_Init_Arithmetic_Encoder( VOID );
static VOID            CFS_Encode_Symbol( WS_BIT_FILE *stream, WS_SYMBOL *s );
static VOID            CFS_Flush_Arithmetic_Encoder( WS_BIT_FILE *stream );
static INT16           CFS_Get_Current_Count( WS_SYMBOL *s );
static VOID            CFS_Init_Arithmetic_Decoder( WS_BIT_FILE *stream );
static VOID            CFS_Remove_Symbol_From_Stream( WS_BIT_FILE *stream, WS_SYMBOL *s );
static VOID            CFS_Fatal_Error( CHAR *s);

#define CFS_END_OF_STREAM 256
#define CFS_PACIFIER_COUNT 2047

#ifndef SEEK_SET
#define SEEK_SET 0
#endif

/*
 * These four variables define the current state of the arithmetic
 * coder/decoder.  
 */
static UINT16 CFS_Code;                     /* The present input code value     */
static UINT16 CFS_Low;                      /* Start of the current code range  */
static UINT16 CFS_High;                     /* End of the current code range    */
static INT32 CFS_Underflow_Bits;            /* Number of underflow bits pending */

static INT16 CFS_Totals[258];               /* The cumulative totals */

/************************************************************************
*                                                                       
* FUNCTION                                                              
*                                                                       
*      CFS_Compress                                                      
*                                                                       
* DESCRIPTION                                                           
*                                                                       
*      Function used to compress an html, gif, jpeg, or text files. This
*      function compresses the files for the in memory file system and  
*      os dependent file system.                                        
*                                                                       
* INPUTS                                                                
*                                                                       
*      *inbuf                   Pointer to the input buffer where the       
*                               file is coming from. Usually     
*                               memory.                          
*      length                   The length of the data to be     
*                               compressed.                      
*      mode                     Flag that idicates whether       
*                               Not Output or Output             
*      *outbuf                  Pointer to the output buffer where the      
*                               the memory is to be stored.      
*                                                                       
* OUTPUTS                                                               
*                                                                       
*      out.length+1             Pointer to next position to be   
*                               compressed.                      
*
************************************************************************/
INT32 CFS_Compress( INT mode, CHAR *inbuf, CHAR *outbuf, INT32 length )
{
    WS_BIT_FILE out;
    WS_BIT_FILE in;

    CFS_Open_Output_Bit_File( &out, outbuf );
    out.mode = mode;
    CFS_Open_Input_Bit_File( &in, inbuf, length );

    CFS_Compress_File( &in, &out );
    CFS_Close_Output_Bit_File( &out );

    return( out.length + 1 );
}

/************************************************************************
*                                                                       
* FUNCTION                                                              
*                                                                       
*       CFS_Decompress                                                    
*                                                                       
* DESCRIPTION                                                           
*                                                                       
*       Function to decompress files resident in the file system.                                        
*                                                                       
* INPUTS                                                                
*                                                                       
*       *req                    Pointer to Request structure that
*                               holds all information pertaining 
*                               to  the HTTP request.            
*       *inbuf                  Pointer to the input buffer to be 
*                               decompressed. 
*       *outbuf                 Pointer to the output buffer of 
*                               decompressed file.                            
*       ilen                    Length of the input buffer.      
*       olen                    Length of the output buffer.     
*                                                                       
* OUTPUTS                                                               
*                                                                       
*       NU_SUCCESS
*                                                                       
***********************************************************************/
INT CFS_Decompress(WS_REQUEST *req, CHAR *inbuf, CHAR *outbuf, INT32 inlen)
{
    WS_BIT_FILE in;
    WS_BIT_FILE out;

#ifdef NU_WEBSERV_DEBUG 
    printf( "CFS_Decompress(%x %x %d) \n", inbuf, outbuf, inlen );
#endif

    CFS_Open_Output_Bit_File( &out, outbuf );
    CFS_Open_Input_Bit_File( &in, inbuf, inlen );

    out.fd = req;
    out.mode = WS_NET_OUTPUT | WS_DONT_OUTPUT;
    out.length = 0;

    CFS_Expand_File( &in, &out );
    CFS_Close_Output_Bit_File( &out );

    return(NU_SUCCESS);
}

/************************************************************************
*                                                                       
* FUNCTION                                                              
*                                                                       
*       CFS_Compress_File                                                     
*                                                                       

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产99久久久久| 久久精品国产秦先生| 日本91福利区| 欧美日韩激情一区二区| 久久精品人人做人人爽人人| 亚洲一区二区偷拍精品| 欧美三级三级三级| 国产一区 二区| 尤物av一区二区| 日韩欧美国产1| 97aⅴ精品视频一二三区| 亚洲成人av电影在线| 日韩欧美一级在线播放| 欧美一级在线视频| 成人v精品蜜桃久久一区| 日产国产欧美视频一区精品| 中文字幕电影一区| 7777精品伊人久久久大香线蕉完整版| 丰满白嫩尤物一区二区| 成人黄色电影在线| 91久久久免费一区二区| 日本乱码高清不卡字幕| 久久精品欧美日韩精品| 欧美午夜片在线看| 国产一区二区视频在线播放| 99久久久精品| 欧美亚洲一区三区| 欧美一二三四在线| 在线观看av一区二区| 韩国一区二区三区| 蜜臀av一区二区在线观看| 亚洲大片一区二区三区| 久久电影网电视剧免费观看| 国产成人精品www牛牛影视| 极品美女销魂一区二区三区| 日本特黄久久久高潮| 国产99久久久国产精品| 欧美日韩一区二区三区不卡| 久久久噜噜噜久久人人看| 精品区一区二区| 欧美成人女星排名| 亚洲欧美日韩在线不卡| 日韩毛片视频在线看| 中国av一区二区三区| 久久久噜噜噜久噜久久综合| 亚洲午夜在线电影| 亚洲第一成人在线| 99免费精品在线观看| av高清不卡在线| 欧美三电影在线| 国产伦精品一区二区三区免费迷| 欧美高清在线一区二区| 亚洲成人在线免费| 色综合久久综合网97色综合| 国产美女精品一区二区三区| 日韩激情在线观看| 日韩福利视频导航| 91在线观看免费视频| 欧美在线小视频| 国产精品欧美久久久久无广告 | 99久久伊人久久99| 欧美一区二区三区小说| 一区二区三区欧美亚洲| 亚洲综合另类小说| 91免费版pro下载短视频| 久久久精品国产免费观看同学| 日韩高清不卡一区| 91麻豆精品国产91久久久资源速度| 亚洲嫩草精品久久| 91蜜桃视频在线| 亚洲视频免费在线观看| 成人h动漫精品| 波多野洁衣一区| 国产日韩欧美综合在线| 亚洲欧洲精品成人久久奇米网| 亚洲视频在线一区观看| 国产成人欧美日韩在线电影| 精品国产凹凸成av人导航| 国产欧美日韩另类一区| 国内成人免费视频| 久久综合九色综合久久久精品综合| 国产精品视频一二三区| 风流少妇一区二区| 国产精品久久久久久久久搜平片 | 精品一区二区三区久久久| 欧美一区二区免费观在线| 日本成人中文字幕| 日韩欧美一区在线观看| 国模一区二区三区白浆| 国产午夜精品一区二区 | 亚洲精品高清在线| 欧美亚洲一区三区| 老汉av免费一区二区三区| 精品久久久久久久久久久久包黑料| 国内精品视频一区二区三区八戒 | 成人涩涩免费视频| 欧美一级一级性生活免费录像| 日韩国产精品91| 欧美不卡一区二区| 成人理论电影网| 亚洲中国最大av网站| 日韩女优av电影| 丁香六月综合激情| 亚洲午夜在线电影| 亚洲精品一区二区三区精华液| 福利一区在线观看| 日韩在线卡一卡二| 国产日韩欧美电影| 欧美日韩中文国产| 国产精品一区二区无线| 欧美一区二区三区小说| 高清shemale亚洲人妖| 亚洲国产日产av| 亚洲精品一区二区三区在线观看 | 欧美男女性生活在线直播观看| 国内不卡的二区三区中文字幕| 亚洲桃色在线一区| 欧美一二三区精品| 91麻豆精东视频| 国产综合色视频| 亚洲一区二区三区中文字幕| 337p粉嫩大胆噜噜噜噜噜91av| 色播五月激情综合网| 国产乱对白刺激视频不卡| 亚洲成在人线在线播放| 中文字幕欧美激情| 欧美一区二区性放荡片| 91在线国内视频| 国产精品996| 三级精品在线观看| 一区二区三区精密机械公司| 久久久久久久久久美女| 日韩午夜在线影院| 欧美图区在线视频| av男人天堂一区| 国产精一区二区三区| 日韩高清电影一区| 亚洲精品成人悠悠色影视| 国产日韩欧美激情| 久久精品夜色噜噜亚洲a∨| 91精品久久久久久久91蜜桃| 91激情五月电影| 91网址在线看| 99久久伊人精品| gogo大胆日本视频一区| 国产91精品一区二区麻豆网站| 久久精品国产精品亚洲综合| 日韩在线一二三区| 奇米精品一区二区三区在线观看| 亚洲一二三四区| 一区二区三区加勒比av| 亚洲精品中文字幕在线观看| 中文字幕精品—区二区四季| 久久久国产午夜精品| 久久免费精品国产久精品久久久久| 91精品国产综合久久久久 | 美女视频黄免费的久久| 午夜精品福利在线| 久久久99精品久久| 久久久天堂av| 国产精品无遮挡| 国产精品国产a| 亚洲精品视频免费观看| 亚洲制服丝袜av| 亚洲成人动漫在线免费观看| 最新中文字幕一区二区三区| 久久se精品一区精品二区| 盗摄精品av一区二区三区| 国产69精品久久久久毛片 | 精品一区免费av| 91免费观看视频在线| 久久免费看少妇高潮| 日韩精品一二区| 欧美中文字幕一区二区三区| 精品国产乱码久久久久久图片 | 亚洲va欧美va人人爽| 亚洲色图丝袜美腿| 一区二区成人在线视频| 天天爽夜夜爽夜夜爽精品视频| 日韩在线一区二区三区| 狠狠色狠狠色综合| 不卡视频一二三四| 欧美专区日韩专区| 精品国内片67194| 欧美激情一区三区| 亚洲动漫第一页| 国产精品99久久久久久宅男| 91麻豆国产精品久久| 日韩一区二区免费电影| 中文字幕欧美激情| 奇米精品一区二区三区在线观看一 | 日韩电影在线免费| 国产精品888| 欧美久久久久久久久久| 国产激情91久久精品导航 | 国内精品嫩模私拍在线| 91福利在线看| 国产亚洲欧美激情| 日韩中文字幕一区二区三区| 不卡的电视剧免费网站有什么|