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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bintools.c

?? Open DMT Client C Source code
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
// ----------------------------------------------------------------------------// Copyright 2006-2007, Martin D. Flynn// All rights reserved// ----------------------------------------------------------------------------//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// // http://www.apache.org/licenses/LICENSE-2.0// // Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.//// ----------------------------------------------------------------------------// Description://  Binary encoding/decoding. //  Tools to encode/decode binary data.// ---// Change History://  2006/01/04  Martin D. Flynn//     -Initial release//  2007/01/28  Martin D. Flynn//     -WindowsCE port.//     -Added 'p' format to support "padded" strings.// ----------------------------------------------------------------------------#include "stdafx.h" // TARGET_WINCE#define SKIP_TRANSPORT_MEDIA_CHECK // only if TRANSPORT_MEDIA not used in this file #include "custom/defaults.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdarg.h>#include <ctype.h>#include "custom/log.h"#include "tools/stdtypes.h"#include "tools/strtools.h"#include "tools/gpstools.h"#include "tools/bintools.h"// ----------------------------------------------------------------------------/* initialize buffer */Buffer_t *binBuffer(Buffer_t *bf, UInt8 *data, UInt16 dataSize, BufferType_t type){    if (bf) {        BUFFER_TYPE(bf)         = type;        BUFFER_PTR(bf)          = data;        BUFFER_PTR_SIZE(bf)     = dataSize;        BUFFER_DATA_SIZE(bf)    = dataSize;        BUFFER_DATA_LENGTH(bf)  = (type == BUFFER_SOURCE)? dataSize : 0;        BUFFER_DATA(bf)         = data;    }    return bf;}/* reset buffer to initial state */void binResetBuffer(Buffer_t *bf){    if (bf) {        BUFFER_DATA(bf)= BUFFER_PTR(bf);        if (BUFFER_TYPE(bf) == BUFFER_SOURCE) {            BUFFER_DATA_LENGTH(bf) = (UInt16)BUFFER_PTR_SIZE(bf);            BUFFER_DATA_SIZE(bf)   = (UInt16)BUFFER_PTR_SIZE(bf);        } else        if (BUFFER_TYPE(bf) == BUFFER_DESTINATION) {            BUFFER_DATA_LENGTH(bf) = (UInt16)0;            BUFFER_DATA_SIZE(bf)   = (UInt16)BUFFER_PTR_SIZE(bf);        }    }}/* advance buffer pointer by 'len' bytes */void binAdvanceBuffer(Buffer_t *bf, int len){    // data is being removed from this buffer    if (bf && (len > 0)) {        BUFFER_DATA(bf) += len; // move pointer to next field        if (BUFFER_TYPE(bf) == BUFFER_SOURCE) {            // data is being removed from this buffer            // 'dataLen' is the number of bytes still available in buffer            if (len > BUFFER_DATA_LENGTH(bf)) { len = BUFFER_DATA_LENGTH(bf); }            BUFFER_DATA_LENGTH(bf) -= len; // remaining length is being decreased        } else        if (BUFFER_TYPE(bf) == BUFFER_DESTINATION) {            // data is being added to this buffer            // 'dataLen' is the number of bytes we've placed in the buffer            // 'dataSize' is the number of bytes we have left to place data            if (len > BUFFER_DATA_SIZE(bf)) { len = BUFFER_DATA_SIZE(bf); }            BUFFER_DATA_LENGTH(bf) += len; // length is being increased            BUFFER_DATA_SIZE(bf)   -= len; // remaining size is being decreased        }    }}// ----------------------------------------------------------------------------/* initialize buffer */FmtBuffer_t *binFmtBuffer(FmtBuffer_t *fb, UInt8 *data, UInt16 dataSize, char *fmt, UInt16 fmtSize){    if (fb) {        binBuffer((Buffer_t*)fb, data, dataSize, BUFFER_DESTINATION); // always destination        fb->fmtSize  = fmtSize;        fb->fmtLen   = 0;        fb->fmtPtr   = (UInt8*)fmt;        fb->fmt      = fmt;    }    return fb;}// ----------------------------------------------------------------------------void binAppendFmtField(FmtBuffer_t *fb, UInt16 len, char ch){    if (fb && fb->fmt && (fb->fmtSize >= 6)) {        sprintf(fb->fmt, "%%%d%c", len, ch);        int slen     = strlen(fb->fmt);        fb->fmt     += slen;        fb->fmtLen  += slen;        fb->fmtSize -= slen;    }}void binAppendFmt(FmtBuffer_t *fb, const char *fmt){    int fmtLen = strlen(fmt);    if (fb && fb->fmt && (fb->fmtSize >= fmtLen)) {        strcpy(fb->fmt, fmt);        fb->fmt     += fmtLen;        fb->fmtLen  += fmtLen;        fb->fmtSize -= fmtLen;    }}// ----------------------------------------------------------------------------/* advance buffer pointer by 'len' bytes */void binAdvanceFmtBuffer(FmtBuffer_t *fb, int len){    binAdvanceBuffer((Buffer_t*)fb, len);}// ----------------------------------------------------------------------------// return the minimum number of bytes that will accuately represent this value// The return value will be at-least 1, and at most 4int binGetMinimumInt32Size(UInt32 val, utBool isSigned){    UInt8 mask = (isSigned && (val & 0x80000000L))? 0xFF : 0x00;    int n;    for (n = 3; n >= 1; n--) { // <-- only look at the 3 most-significant bytes        UInt8 x = (UInt8)((val >> (n * 8)) & 0xFF);        if (x != mask) { break; }    }    // 'n' will be '0' if no 'mismatch' was found, thus returning '1'    return n + 1;}// ----------------------------------------------------------------------------/* encode 32-bit value into byte array (Big-Endian) */UInt8 *binEncodeInt32(UInt8 *buf, int cnt, UInt32 val, utBool signExtend){    // - This function places the least-significant bytes of the value 'val' into the    // byte array 'buf'. It is left to the developer to ensure that the size of the    // buffer is large enough to accomodate the value stored in 'val'.    // - 'signExtend' is needed only if 'cnt' is > 4.    if (buf && (cnt > 0)) {                /* fill excess space */        if (cnt > 4) {            UInt8 fill = (signExtend && (val & 0x80000000L))? 0xFF : 0x00;            memset(buf, cnt - 4, fill);            buf += cnt - 4;            cnt = 4;        }        /* copy in value */        int n;        for (n = cnt - 1; n >= 0; n--) {            buf[n] = (UInt8)(val & 0xFF);            val >>= 8;        }            }        return buf;}/* decode byte array into 32-bit value (Native-Endian) */UInt32 binDecodeInt32(const UInt8 *buf, int cnt, utBool signExtend){    // This function decodes the numeric value in 'buf' and returns the resulting    // value as a 32-bit unsigned integer.  If 'signExtend' is true, then sign    // extension will be performed and the returned value can be cast to a signed    // integer to obtain a signed value.    if (buf && (cnt > 0)) {        UInt32 val = (signExtend && (buf[0] & 0x80))? -1L : 0L;        int n;        for (n = 0; n < cnt; n++) {            val = (val << 8) | buf[n];        }        return val;    } else {        return 0L;    }}// ----------------------------------------------------------------------------// Binary format://      %<length><type>// Length://      0..X - fixed field length specifier//      *    - variable field length specifier (argument MUST be of type 'int')// Valid types://      i - signed integer (argument MUST be of type UInt32 or Int32)//      u - unsigned integer (argument MUST be of type UInt32 or Int32)//      x - unsigned integer (argument MUST be of type UInt32 or Int32)//      s - null terminated string (argument must be a pointer to a null-terminated string)//      b - fixed length binary (argument must be a pointer to a byte array)//      g - gps point (argument MUST be a pointer to a GPSShort_t structure)//      z - zero-filled field (no argument)// Example://      This will place the 2 LSBs of 'a', followed by at-most the first 5 bytes of 's'//      into the specified buffer://          binPrintf(buf, sizeof(buf), "%2u%*s", (UInt32)a, 5, s);// Notes://      - The compiler won't validate the format against the actual argument types as it//      does with the 'printf' and 'scanf' functions, so special care must be taken to//      insure that all numeric arguments are always specified as 32-bit variables, and //      lengths are specified as 16-bit variables.int binPrintf(UInt8 *buf, int bufSize, const char *fmt, ...){    va_list ap;    va_start(ap, fmt);    FmtBuffer_t bb,*fb=binFmtBuffer(&bb,buf,bufSize,(char*)0,0); // BUFFER_DESTINATION    int len = binFmtVPrintf(fb, fmt, ap);    va_end(ap);    return len;}int binBufPrintf(Buffer_t *buf, const char *fmt, ...){    if (buf && (BUFFER_TYPE(buf) == BUFFER_DESTINATION)) {        va_list ap;        va_start(ap, fmt);        FmtBuffer_t bb,*fb=binFmtBuffer(&bb,BUFFER_DATA(buf),BUFFER_DATA_SIZE(buf),(char*)0,0);        int len = binFmtVPrintf(fb, fmt, ap);        if (len >= 0) {            binAdvanceBuffer(buf, len);        }        va_end(ap);        return len;    } else {        logERROR(LOGSRC,"Buffer is not designated for BUFFER_DESTINATION\n");        return -1;    }}int binFmtPrintf(FmtBuffer_t *fb, const char *fmt, ...){    va_list ap;    va_start(ap, fmt);    int len = binFmtVPrintf(fb, fmt, ap);    va_end(ap);    return len;}int binVPrintf(UInt8 *buf, UInt16 bufSize, const char *fmt, va_list ap){    FmtBuffer_t bb, *fb = binFmtBuffer(&bb, buf, bufSize, (char*)0, 0);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av在线影院| 美女在线一区二区| 91视频在线看| 亚洲你懂的在线视频| 欧美怡红院视频| 青青草97国产精品免费观看 | 精品久久一区二区| 国内精品国产三级国产a久久| 欧美精品一区二区精品网| 国产成人久久精品77777最新版本| 欧美国产精品一区二区| 91麻豆蜜桃一区二区三区| 亚洲一二三级电影| 欧美一区二区三区在线观看视频 | 亚洲一区二区欧美| 在线综合亚洲欧美在线视频| 国产一区二区视频在线播放| 亚洲欧美在线aaa| 欧美美女喷水视频| 精品亚洲porn| 亚洲精品水蜜桃| 日韩色在线观看| 成人免费视频播放| 天堂资源在线中文精品| 久久影音资源网| 91久久精品午夜一区二区| 日韩电影在线观看网站| 国产欧美日韩在线观看| 欧美吞精做爰啪啪高潮| 狠狠色丁香婷综合久久| 亚洲一区二区三区四区五区黄| 精品国产亚洲一区二区三区在线观看| 波多野结衣的一区二区三区| 看片网站欧美日韩| 中文字幕一区二区日韩精品绯色| 欧美一区国产二区| 99久久精品国产导航| 毛片av一区二区三区| 亚洲美女免费视频| 欧美r级在线观看| 91福利精品第一导航| 黄色日韩三级电影| 亚洲成人av在线电影| 国产欧美日本一区二区三区| 在线观看91精品国产麻豆| 成人高清免费观看| 精品综合免费视频观看| 亚洲在线一区二区三区| 国产欧美一区二区精品婷婷 | 一本久道久久综合中文字幕| 久久99国产精品久久99果冻传媒| 亚洲黄网站在线观看| 国产精品免费丝袜| 精品国产一区二区三区不卡| 欧美精品一区二区三区蜜桃 | 欧美亚洲一区三区| 国产宾馆实践打屁股91| 免费av网站大全久久| 亚洲一线二线三线久久久| 国产精品三级在线观看| 久久久久久久综合| 欧美草草影院在线视频| 欧美丰满一区二区免费视频| 91精品办公室少妇高潮对白| 91免费视频观看| 成人免费看黄yyy456| 国产成a人亚洲精品| 国产最新精品精品你懂的| 美女视频一区在线观看| 午夜精品福利一区二区蜜股av| 亚洲男人电影天堂| 亚洲视频综合在线| 国产精品区一区二区三区| 国产亚洲欧美日韩在线一区| 久久久久久久久岛国免费| 精品伦理精品一区| 精品国产91久久久久久久妲己| 日韩三级.com| 精品电影一区二区| 精品国产3级a| 国产农村妇女毛片精品久久麻豆 | 91网站黄www| av网站免费线看精品| 成人h动漫精品一区二区| 国产精品88av| 成人开心网精品视频| 91猫先生在线| 欧美唯美清纯偷拍| 欧美一三区三区四区免费在线看| 欧美一区2区视频在线观看| 日韩一区二区麻豆国产| 精品欧美黑人一区二区三区| 久久日一线二线三线suv| 亚洲国产精品99久久久久久久久| 国产精品久久国产精麻豆99网站 | 久久综合九色综合欧美亚洲| 国产欧美精品在线观看| 亚洲精品老司机| 五月激情综合网| 精品一区二区在线看| 粉嫩嫩av羞羞动漫久久久| 不卡的av网站| 欧美日韩综合不卡| 欧美一区二区在线不卡| 国产日韩三级在线| 一区二区三区精品在线观看| 日韩av电影免费观看高清完整版在线观看| 久久99日本精品| caoporn国产一区二区| 欧美午夜片在线看| 精品国产一区二区三区av性色| 国产精品成人一区二区艾草 | 一本久道中文字幕精品亚洲嫩| 欧美日韩精品一区二区天天拍小说| 欧美成人高清电影在线| 国产精品久久久久影院色老大| 亚洲午夜激情网页| 韩国在线一区二区| 91久久线看在观草草青青| 日韩三级免费观看| 亚洲欧美偷拍卡通变态| 日本aⅴ亚洲精品中文乱码| 高清国产一区二区三区| 欧美在线看片a免费观看| 久久影院午夜论| 亚洲第一福利一区| 成人综合激情网| 欧美一区二区成人| 亚洲免费毛片网站| 国产福利一区在线| 欧美日韩成人在线| 亚洲三级视频在线观看| 精品系列免费在线观看| 欧美四级电影网| 中文字幕亚洲欧美在线不卡| 黑人巨大精品欧美黑白配亚洲| 欧美日本一区二区| 亚洲欧洲99久久| 国产麻豆91精品| 欧美一卡二卡在线观看| 亚洲一区二区精品久久av| 成人sese在线| 国产丝袜在线精品| 美女高潮久久久| 欧美日韩成人综合在线一区二区| 中文字幕亚洲视频| 岛国精品一区二区| 久久久久久久免费视频了| 狂野欧美性猛交blacked| 在线不卡a资源高清| 亚洲综合小说图片| 99久久夜色精品国产网站| 国产欧美日韩在线| 国产精品亚洲一区二区三区在线| 日韩免费高清电影| 天天操天天色综合| 欧美日韩你懂得| 亚洲国产视频网站| 在线视频国内自拍亚洲视频| 中文字幕一区免费在线观看| 国产不卡在线播放| 国产精品三级久久久久三级| 处破女av一区二区| 久久精品这里都是精品| 国产一区 二区| 26uuu国产电影一区二区| 国产一区二区影院| 国产日韩欧美综合一区| 丰满少妇久久久久久久| 国产精品乱人伦中文| 国产成人亚洲精品狼色在线| 国产婷婷一区二区| k8久久久一区二区三区| 亚洲欧洲成人自拍| 91麻豆国产福利在线观看| 亚洲欧美日韩一区| 欧美主播一区二区三区| 日韩在线一二三区| 日韩一级二级三级| 国产一区二区在线电影| 国产精品私房写真福利视频| 99天天综合性| 性欧美疯狂xxxxbbbb| 欧美一区二区精品| 国产一区二区0| 亚洲欧美日韩在线播放| 欧美另类一区二区三区| 日本成人在线网站| 国产偷国产偷亚洲高清人白洁 | 一区二区三区在线免费视频| 91成人免费在线| 视频在线观看一区二区三区| 精品国产91久久久久久久妲己| 成人免费观看视频| 一区二区三区四区视频精品免费| 欧美日韩精品久久久| 国产一区二区免费在线| 18成人在线观看| 欧美一区二区不卡视频| 成人免费视频一区|