CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

CRCPIPE.CPP (6349B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header: /CounterStrike/CRCPIPE.CPP 1     3/03/97 10:24a Joe_bostic $ */
     17 /***********************************************************************************************
     18  ***              C O N F I D E N T I A L  ---  W E S T W O O D  S T U D I O S               ***
     19  ***********************************************************************************************
     20  *                                                                                             *
     21  *                 Project Name : Command & Conquer                                            *
     22  *                                                                                             *
     23  *                    File Name : CRCPIPE.CPP                                                  *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : 06/30/96                                                     *
     28  *                                                                                             *
     29  *                  Last Update : July 3, 1996 [JLB]                                           *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  *   CRCPipe::Result -- Fetches the current CRC of the data.                                   *
     34  *   CRCPipe::Put -- Retrieves the data bytes specified and calculates CRC on it.              *
     35  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     36 
     37 
     38 #include "crcpipe.h"
     39 
     40 
     41 /***********************************************************************************************
     42  * CRCPipe::Put -- Retrieves the data bytes specified and calculates CRC on it.                *
     43  *                                                                                             *
     44  *    This routine will fetch the number of bytes requested from the straw. The data is        *
     45  *    not modified by this straw segment, but it is examined by the CRC engine in order to     *
     46  *    keep an accurate CRC of the data that passes through this routine.                       *
     47  *                                                                                             *
     48  * INPUT:   source   -- Pointer to the buffer that will hold the data requested.               *
     49  *                                                                                             *
     50  *          length   -- The number of bytes requested.                                         *
     51  *                                                                                             *
     52  * OUTPUT:  Returns with the actual number of bytes stored into the buffer. If this number is  *
     53  *          less than the number requested, then this indicates that the data stream has been  *
     54  *          exhausted.                                                                         *
     55  *                                                                                             *
     56  * WARNINGS:   none                                                                            *
     57  *                                                                                             *
     58  * HISTORY:                                                                                    *
     59  *   07/03/1996 JLB : Created.                                                                 *
     60  *=============================================================================================*/
     61 int CRCPipe::Put(void const * source, int slen)
     62 {
     63 	CRC(source, slen);
     64 	return(Pipe::Put(source, slen));
     65 }
     66 
     67 
     68 /***********************************************************************************************
     69  * CRCPipe::Result -- Fetches the current CRC of the data.                                     *
     70  *                                                                                             *
     71  *    This routine will return the CRC of the data that has passed through the pipe up to      *
     72  *    this time.                                                                               *
     73  *                                                                                             *
     74  * INPUT:   none                                                                               *
     75  *                                                                                             *
     76  * OUTPUT:  Returns with the CRC value.                                                        *
     77  *                                                                                             *
     78  * WARNINGS:   none                                                                            *
     79  *                                                                                             *
     80  * HISTORY:                                                                                    *
     81  *   07/03/1996 JLB : Created.                                                                 *
     82  *=============================================================================================*/
     83 long CRCPipe::Result(void) const
     84 {
     85 	return(CRC());
     86 }
     87