⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chxuuid.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 4 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: chxuuid.cpp,v 1.7.32.3 2004/07/09 01:48:15 hubbe Exp $ *  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. *  * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks.  You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL.  Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. *  * This file is part of the Helix DNA Technology. RealNetworks is the * developer and/or licensor of the Original Code and owns the * copyrights in the portions it created. *  * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. *  * Technology Compatibility Kit Test Suite(s) Location: *    http://www.helixcommunity.org/content/tck *  * Contributor(s): *  * ***** END LICENSE BLOCK ***** */////	CHXuuid class implementation//////  This code derives from uuid.c from OSF DCE source/* *  * (c) Copyright 1989 OPEN SOFTWARE FOUNDATION, INC. * (c) Copyright 1989 HEWLETT-PACKARD COMPANY * (c) Copyright 1989 DIGITAL EQUIPMENT CORPORATION * To anyone who acknowledges that this file is provided "AS IS" * without any express or implied warranty: *                 permission to use, copy, modify, and distribute this * file for any purpose is hereby granted without fee, provided that * the above copyright notices and this notice appears in all source * code copies, and that none of the names of Open Software * Foundation, Inc., Hewlett-Packard Company, or Digital Equipment * Corporation be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission.  Neither Open Software Foundation, Inc., Hewlett- * Packard Company, nor Digital Equipment Corporation makes any * representations about the suitability of this software for any * purpose. *  */ #include "hxtypes.h"#ifdef _WINDOWS#define WIN32_LEAN_AND_MEAN#include <windows.h>	// for HX_GET_TICK_COUNT#endif#include "hlxclib/string.h"// #include "hlxclib/stdio.h"#include "safestring.h"#include "hxstring.h"#include "hxresult.h"#include "hxassert.h"#include "hxrand.h"#include "chxuuid.h"#include "hxtick.h"#include "hxtime.h"#include "netbyte.h"#include "md5.h"#include <ctype.h>#if !defined(_VXWORKS) && !defined(_SYMBIAN) && !defined(_OPENWAVE)#include <memory.h>#endif#include <stdarg.h>#ifdef _WIN16#include <ctype.h>#include <memory.h>#endif#ifdef _WIN32#include <objbase.h>#endif#include "hxheap.h"#ifdef _DEBUG#undef HX_THIS_FILE		static const char HX_THIS_FILE[] = __FILE__;#endif#if defined(_WIN16)// global definitons (scope: wsscanf.c)#ifdef ALLOW_RANGE   char szSBrackSet[] = " \t-\r]" ;  // use range-style list#else   char szSBrackSet[] = "\t\n\v\f\r]" ;  // chars defined by isspace #endifchar szCBrackSet[] = "]" ;// constant definitions#define ALLOW_RANGE                        // allow "%[a-z]" - style                                            // scansets#define LEFT_BRACKET  ('[' | ('a' - 'A'))  // 'lowercase' version#define ASCII         32                   // # of bytes needed to                                            // hold 256 bits// macro definitions#define INC()            (++nCharCount, Inc( (LPSTR FAR *) &lpPtrBuffer ))#define UN_INC( chr )    (--nCharCount, UnInc( chr, (LPSTR FAR *) &lpPtrBuffer ))#define EAT_WHITE()      WhiteOut( (int FAR *) &nCharCount, (LPSTR FAR *) &lpPtrBuffer )#define HEXTODEC( chr )  HexToDec( chr )#define MUL10(x)         ( (((x)<<2) + (x))<<1 )typedef char _far *wva_list ;#define wva_start( ap, v )  (ap = (wva_list) &v + sizeof( v ))#define wva_arg( ap, t )    (((t _far *)(ap += sizeof( t )))[-1])#define wva_end( ap )       (ap = NULL)/************************************************************************ *  char NEAR HexToDec( char chChar ) * *  Description: *     HexToDec() convert hexadecimal to decimal equivalent. * ************************************************************************/char NEAR HexToDec( char chChar ){   return (isdigit( chChar ) ? chChar : (char) ((chChar & ~('a' - 'A')) - 'A' + 10 + '0')) ;} /* end of HexToDec() *//************************************************************************ *  char NEAR Inc( LPSTR FAR *lpPtrBuffer ) * *  Description: *     "Pops" a character from the buffer. * ************************************************************************/char NEAR Inc( LPSTR FAR *lpPtrBuffer ){   char  ch ;   ch = *((LPSTR) *lpPtrBuffer) ;   ((LPSTR&)(*lpPtrBuffer))++ ;   return ( ch ) ;} /* end of Inc() *//************************************************************************ *  VOID NEAR UnInc( char chChar, LPSTR FAR *lpPtrBuffer ) * *  Description: *     "Pushes" a characters back into the buffer. * ************************************************************************/VOID NEAR UnInc( char chChar, LPSTR FAR *lpPtrBuffer ){   ((LPSTR&)(*lpPtrBuffer))-- ;   *((LPSTR) *lpPtrBuffer) = chChar ;   } /* end of UnInc() *//************************************************************************ *  char NEAR WhiteOut( int *lpnCounter, LPSTR FAR *lpPtrBuffer ) * *  Description: *     Increments the string pointer while in white space. * ************************************************************************/char NEAR WhiteOut( int FAR *lpnCounter, LPSTR FAR *lpPtrBuffer ){   char  ch ;   while (isspace(ch = (++*lpnCounter, Inc( lpPtrBuffer )))) ;   return ( ch ) ;} /* end of WhiteOut() *//************************************************************************ *  int FAR _cdecl wsscanf( LPSTR lpBuffer, LPSTR lpFormat, *                          LPSTR lpParms, ... ) * *  Description: *     Replacement function for sscanf().   Useable in DLLs (all *     parameters are passed as FAR pointers. * ************************************************************************/int FAR _cdecl wsscanf( char* lpBuffer, char* lpFormat, ... ){   BYTE          bCoerceShort, bDoneFlag, bLongOne, bMatch, bNegative,                 bReject, bSuppress ;   BYTE FAR *    lpPtrScan ;   DWORD         dwNumber ;   LPSTR         lpPtrFormat, lpPtrBuffer ;   LPVOID FAR *  lpArgList;   LPVOID        lpPointer, lpStart ;   WORD          wHoldSeg ;   char          ch, chCom, chLast, chPrev, chRange, szTable[ ASCII ] ; /* Flawfinder: ignore */   int           nCount, nCharCount, nWidth, nWidthSet, nStarted ;   wva_list	 lpParms;      wva_start(lpParms, lpFormat);   lpArgList = (LPVOID FAR *) &lpParms ;   nCount = nCharCount = 0 ;   bMatch = FALSE ;   lpPtrFormat = lpFormat ;   lpPtrBuffer = lpBuffer ;   while (*lpPtrFormat)   {      if (isspace( *lpPtrFormat ))      {         UN_INC( EAT_WHITE() ) ;  // put first non-space char back         while (isspace(*++lpPtrFormat)) ;      }      if ('%' == *lpPtrFormat)      {         bCoerceShort = bDoneFlag = bLongOne = bNegative =         bReject = bSuppress = FALSE ;         nWidth = nWidthSet = nStarted = 0 ;         dwNumber = 0 ;         chPrev = 0 ;            while (!bDoneFlag)         {            if (isdigit( chCom = *++lpPtrFormat ))            {               ++nWidthSet ;               nWidth = MUL10( nWidth ) + (chCom - '0') ;            }            else               switch (chCom)               {                  case 'F':                  case 'N':                     // FAR is only type of pointer in DLLs                     break ;                     case 'h':                     ++bCoerceShort ;                     break ;                              case 'l':                     ++bLongOne ;                     break ;                     case '*':                     ++bSuppress ;                     break ;                     default:                     ++bDoneFlag ;                     break ;               }         }            if (!bSuppress)            /* ALL pointers are pushed as FAR */            lpPointer = (LPVOID) *lpArgList++ ;            bDoneFlag = FALSE ;            if ('n' != (chCom = (char)(*lpPtrFormat | ('a' - 'A'))))         {            if ('c' != chCom && LEFT_BRACKET != chCom)               ch = EAT_WHITE() ;            else               ch = INC() ;         }            if (!nWidthSet || nWidth)         {            switch (chCom)            {               case 'c':                  if (!nWidthSet)                  {                     ++nWidthSet ;                     ++nWidth ;                  }                  lpPtrScan = (BYTE FAR *) szCBrackSet  ;                  --bReject ;                  goto ScanIt2 ;                  case 's':                  lpPtrScan = (BYTE FAR *) szSBrackSet ;                  --bReject ;                  goto ScanIt2 ;                  case LEFT_BRACKET:                  lpPtrScan = (BYTE FAR *) (++lpPtrFormat) ;                  if ('^' == *lpPtrScan)                  {                     ++lpPtrScan ;                     --bReject ;                  }ScanIt2:                  _fmemset( szTable, 0, ASCII ) ;   #ifdef ALLOW_RANGE                  if (LEFT_BRACKET == chCom)                     if (']' == *lpPtrScan)                     {                        chPrev = ']' ;                        ++lpPtrScan ;                        szTable[ ']' >> 3 ] = 1 << (']' & 7 ) ;                     }                  while (']' != *lpPtrScan)                  {                     chRange = *lpPtrScan++ ;                     if ('-' != chRange || !chPrev || ']' == *lpPtrScan)                        szTable[(chPrev = chRange) >> 3] |= 1 << (chRange & 7) ;                     else                     {                        // handle a-z type set                        chRange = *lpPtrScan++ ;                        if (chPrev < chRange)                           chLast = chRange ;                        else                        {                           chLast = chPrev ;                           chPrev = chRange ;                        }                        for (chRange = chPrev; chRange <= chLast; ++chRange)                           szTable[chRange >> 3] |= 1 << (chRange & 7) ;                        chPrev = 0 ;                     }                  }#else                  if (LEFT_BRACKET == chCom)                     if (']'  == *lpPtrScan)                     {                        ++lpPtrScan;                        szTable[(chPrev = ']') >> 3] |= 1 << (']' & 7) ;                     }                  while (']' != *lpPtrScan)                     szTable[ *lpPtrScan >> 3] |= 1 << (*lpPtrScan & 7) ;#endif                  if (!*lpPtrScan)                     goto ErrorReturn ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -