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

📄 chxuuid.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 4 页
字号:
                           if (LEFT_BRACKET == chCom)                     lpPtrFormat = (LPSTR)lpPtrScan ;                              lpStart = lpPointer ;                  while ((!nWidthSet || nWidth--) &&                         ((szTable[ ch >> 3 ] ^ bReject) & (1 << (ch & 7))))                  {                     if (!bSuppress)                     {                        *(LPSTR)lpPointer = (char) ch ;                        ++((LPSTR&)lpPointer) ;                     }                     else                        // just indicate a match                        ++((LPSTR&)lpStart) ;                     ch = INC() ;                  }                  UN_INC( ch )  ;                  // make sure something has been match and, if assignment                  // is not suppressed, null-terminate output string if                  // chCom != c                  if (lpStart != lpPointer)                  {                     if (!bSuppress)                     {                        nCount++ ;                        if ('c' != chCom)                           // NULL terminate strings                           *(LPSTR) lpPointer = NULL ;                     }                  }                  else                     goto ErrorReturn ;                  break ;               case 'i':                  chCom = 'd' ;  // use 'd' as default                        case 'x':                  if ('-' == ch)                  {                     ++bNegative ;                     goto XIncWidth ;                  }                  else if ('+' == ch)                  {XIncWidth:                     if (!--nWidth && nWidthSet)                        ++bDoneFlag ;                     else                        ch = INC() ;                  }                  if ('0' == ch)                  {                     if ('x' == ((char) (ch = INC())) || 'X' == (char) ch)                     {                        ch = INC() ;                        chCom = 'x' ;                     }                     else                     {                        // scanning a hex number that starts with 0                        // push back the character currently in ch                        // and restore the 0                           UN_INC( ch ) ;                        ch = '0' ;                     }                  }                  goto GetNum ;                  case 'p':                  // ALL pointers are FAR                  if (!bCoerceShort)                  {                     ++bLongOne ;                     chCom = 'F' ;  // indicates FAR                  }                  case 'o':               case 'u':               case 'd':                  if ('-' == ch)                  {                     ++bNegative ;                     goto dIncWidth ;                  }                  else if ('+' == ch)                  {dIncWidth:                     if (!--nWidth && nWidthSet)                        ++bDoneFlag ;                     else                        ch = INC() ;                  }GetNum:                  while (!bDoneFlag)                  {                     if ('x' == chCom || 'p' == chCom || 'F' == chCom)                     {                        if (isxdigit(ch))                        {                           dwNumber = (dwNumber << 4) ;                           ch = HEXTODEC( ch ) ;                        }                        else if ('F' == chCom)                        {                           if (nStarted)                           {                              if (':' == ch)                              {                                 wHoldSeg = LOWORD( dwNumber ) ;                                 dwNumber = 0 ;                                 nStarted = -1 ;                                 chCom = 'p' ; // switch to offset                                 ch = '0' ; // don't add ':'                              }                              else                              {                                 nStarted = 0 ;                                 ++bDoneFlag ;                              }                           }                           else                              ++bDoneFlag ;                        }                        else                           ++bDoneFlag ;                     }                     else if (isdigit( ch ))                     {                        if ('o' == chCom)                        {                           if ('8' > ch)                              dwNumber = (dwNumber << 3) ;                           else                              ++bDoneFlag ;                        }                        else                           // 'd' == chCom                           dwNumber = MUL10( dwNumber ) ;                     }                      else                        ++bDoneFlag ;                     if (!bDoneFlag)                     {                        ++nStarted ;                        dwNumber += ch - '0' ;                        if (nWidthSet && !--nWidth)                           ++bDoneFlag ;                        else                           ch = INC() ;                     }                     else                        UN_INC( ch ) ;                  } // end of while                     if ('p' == chCom && bLongOne)                     dwNumber = (dwNumber & (DWORD) 0x0000FFFF) |                                 ((DWORD) wHoldSeg) << 16 ;#if _WIN16   #pragma warning(disable : 4146) #endif                     if (bNegative)                     dwNumber = -dwNumber ;#if _WIN16   #pragma warning(default : 4146) #endif                  if ('F' == chCom)                     nStarted = 0 ;                  if (nStarted)                  {                     if (!bSuppress)                     {                        ++nCount ;AssignNum:                        if (bLongOne)                           *(DWORD FAR *)lpPointer = dwNumber ;                        else                           *(WORD FAR *)lpPointer = LOWORD( dwNumber ) ;                     }                  }                  else                     goto ErrorReturn ;                     break ;                  case 'n':                  dwNumber = nCharCount ;                  goto AssignNum ;                  default:                  if ((char)*lpPtrFormat != ch)                  {                     UN_INC( ch ) ;                     goto ErrorReturn ;                  }                  else                     bMatch-- ;                     if (!bSuppress)                     // ALL pointers are FAR pointers                     --lpArgList ;               } // end of switch            bMatch++ ;         } // end of while         else         {            UN_INC( ch ) ;            goto ErrorReturn ;         }         ++lpPtrFormat ;      }      else      {         // ('%' != *lpPtrFormat)         if ((char) *lpPtrFormat++ != (ch = INC()))         {            UN_INC( ch ) ;            goto ErrorReturn ;         }      }   } // end while (*lpPtrFormat)ErrorReturn:   wva_end(lpParms);   return nCount ;} /* end of wsscanf() */#endif	// _WIN16 /* * Internal structure of universal unique IDs (UUIDs). * * There are three "variants" of UUIDs that this code knows about.  The * variant #0 is what was defined in the 1989 HP/Apollo Network Computing * Architecture (NCA) specification and implemented in NCS 1.x and DECrpc * v1.  Variant #1 is what was defined for the joint HP/DEC specification * for the OSF (in DEC's "UID Architecture Functional Specification Version * X1.0.4") and implemented in NCS 2.0, DECrpc v2, and OSF 1.0 DCE RPC. * Variant #2 is defined by Microsoft. * * This code creates only variant #1 UUIDs. *  * The three UUID variants can exist on the same wire because they have * distinct values in the 3 MSB bits of octet 8 (see table below).  Do * NOT confuse the version number with these 3 bits.  (Note the distinct * use of the terms "version" and "variant".) Variant #0 had no version * field in it.  Changes to variant #1 (should any ever need to be made) * can be accomodated using the current form's 4 bit version field. *  * The UUID record structure MUST NOT contain padding between fields. * The total size = 128 bits. * * To minimize confusion about bit assignment within octets, the UUID * record definition is defined only in terms of fields that are integral * numbers of octets. * * Depending on the network data representation, the multi-octet unsigned * integer fields are subject to byte swapping when communicated between * dissimilar endian machines.  Note that all three UUID variants have * the same record structure; this allows this byte swapping to occur. * (The ways in which the contents of the fields are generated can and * do vary.) * * The following information applies to variant #1 UUIDs: * * The lowest addressed octet contains the global/local bit and the * unicast/multicast bit, and is the first octet of the address transmitted * on an 802.3 LAN. * *  NOTE:  In the PN version the node field may not be the 802.3 NIC ID *	But is a machine ID generated on construction if not specified. *	The method for generating the machine ID may vary and is documented *	in the GenerateMachineID method. * * The adjusted time stamp is split into three fields, and the clockSeq * is split into two fields. * * |<------------------------- 32 bits -------------------------->| * * +--------------------------------------------------------------+ * |                     low 32 bits of time                      |  0-3  .time_low * +-------------------------------+------------------------------- * |     mid 16 bits of time       |  4-5               .time_mid * +-------+-----------------------+ * | vers. |   hi 12 bits of time  |  6-7               .time_hi_and_version * +-------+-------+---------------+ * |Res|  clkSeqHi |  8                                 .clock_seq_hi_and_reserved * +---------------+ * |   clkSeqLow   |  9                                 .clock_seq_low * +---------------+----------...-----+ * |            node ID               |  8-16           .node * +--------------------------...-----+ * * -------------------------------------------------------------------------- * * The structure layout of all three UUID variants is fixed for all time. * I.e., the layout consists of a 32 bit int, 2 16 bit ints, and 8 8 * bit ints.  The current form version field does NOT determine/affect * the layout.  This enables us to do certain operations safely on the * variants of UUIDs without regard to variant; this increases the utility * of this code even as the version number changes (i.e., this code does * NOT need to check the version field). * * The "Res" field in the octet #8 is the so-called "reserved" bit-field * and determines whether or not the uuid is a old, current or other * UUID as follows: * *      MS-bit  2MS-bit  3MS-bit      Variant *      --------------------------------------------- *         0       x        x       0 (NCS 1.5) *         1       0        x       1 (DCE 1.0 RPC) *         1       1        0       2 (Microsoft) *         1       1        1       unspecified * *  NOTE:   To identify the PN version from other versions we use the  *	111 unspecified variant. * * -------------------------------------------------------------------------- * *//**************************************************************************** * * global data declarations * ****************************************************************************/static const uuid_tt uuid_g_nil_uuid = { 0, 0, 0, 0, 0, 0 };static const uuid_tt uuid_nil = { 0, 0, 0, 0, 0, 0 };/* * Check the reserved bits to make sure the UUID is of the known structure. *//* * defines for time calculations */#ifndef UUID_C_100NS_PER_SEC#define UUID_C_100NS_PER_SEC            10000000#endif#ifndef UUID_C_100NS_PER_MSEC#define UUID_C_100NS_PER_MSEC           10000#endif#define HX_GET_PID()			0xC0C0 /* * UADD_UVLW_2_UVLW - macro to add two unsigned 64-bit long integers *                      (ie. add two unsigned 'very' long words) * * Important note: It is important that this macro accommodate (and it does) *                 invocations where one of the addends is also the sum. * * This macro was snarfed from the DTSS group and was originally: * * UTCadd - macro to add two UTC times * * add lo and high order longword separately, using sign bits of the low-order * longwords to determine carry.  sign bits are tested before addition in two * cases - where sign bits match. when the addend sign bits differ the sign of * the result is also tested: * *        sign            sign *      addend 1        addend 2        carry? * *          1               1            TRUE

⌨️ 快捷键说明

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