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

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

?? name.c

?? FAT文件系統(tǒng)源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// This source code is licensed under Microsoft Shared Source License
// Version 1.0 for Windows CE.
// For a copy of the license visit http://go.microsoft.com/fwlink/?LinkId=3223.
//
/*++


Module Name:

    name.c

Abstract:

    This file contains routines for manipulating FAT filenames.

Revision History:

--*/

#include "fatfs.h"

#define OEM_REPL_CHAR                   0x5F


/*  ChkSumName - compute 8.3 filename checksum
 *
 *  ENTRY
 *      pchOEM - pointer to 8.3 filename
 *
 *  EXIT
 *      8-bit checksum.  Note that it has to be computed the same way
 *      as all other LFN-enabled FAT file system implementations, because
 *      the checksum is stored on-disk.
 */

BYTE ChkSumName(const BYTE *pchOEM)
{
    int c;
    BYTE bSum = 0;

    for (c = 0 ; c < OEMNAMESIZE ; ++c) {
        bSum = (bSum>>1) | ((bSum&1)<<7);
        bSum += *pchOEM++;
    }
    return bSum;
}


/*  InitNumericTail - calculate starting position for numeric tail
 *
 *  This function calculates the 0-based index in the 8.3 (achOEM) name
 *  of where the tilde (~) should go when creating a numeric tail for the
 *  name.  The answer is always somewhere in the range 0-6, because the
 *  tilde is always followed by at least one digit (and as many as three).
 *
 *  Note that we are starting with the hopeful assumption that the tail
 *  will require only one digit.  If it requires two or three however, the
 *  code in CheckNumericTail and GenerateNumericTail may have to back up
 *  to insure the entire tail still fits within the 0-7 range.
 *
 *  ENTRY
 *      pdi - pointer to DIRINFO structure
 *
 *  EXIT
 *      None
 */

void InitNumericTail(PDIRINFO pdi)
{
    int i, iSpace, cSpaces;

    // We must walk forward through the single-byte character
    // string, counting how many sequential spaces we have encountered,
    // so that we can determine where the ideal spot for a numeric
    // tail would be.

    for (i=0,cSpaces=0; i<=6; i++) {
        if (cSpaces == 0)
            iSpace = i;
        if (IsDBCSLeadByte(pdi->di_achOEM[i])) {
            i++;
            cSpaces = 0;
            continue;
        }
        if (pdi->di_achOEM[i] != ' ') {
            cSpaces = 0;
            continue;
        }
        cSpaces++;
    }

    pdi->di_bNumericTail = (BYTE)iSpace;
}


/*  CheckNumericTail - check 8.3 name for numeric tail
 *
 *  This function examines the current directory entry, determines if
 *  it contains a numeric tail that could conflict with an auto-generated
 *  numeric tail, and flags it in our bit-array if so.
 *
 *  ENTRY
 *      pdi - pointer to DIRINFO structure
 *      pdwBitArray - pointer to numeric tail bit array
 *
 *  EXIT
 *      None
 */

void CheckNumericTail(PDIRINFO pdi, PDWORD pdwBitArray)
{
    int i, iTilde, cDigits;
    PCHAR pchComp;
    BYTE achComp[OEMNAMESIZE];

    ASSERT(pdi->di_bNumericTail <= 6);

    // We must walk forward through the single-byte character
    // string, and remember the position of the last tilde seen.

    iTilde = -1;
    for (i=0,pchComp=pdi->di_pde->de_name; i<=7; i++) {

        if (IsDBCSLeadByte(pchComp[i])) {
            i++;
            iTilde = -1;        // a DBCS char is never part of a tail
            continue;
        }

        if (pchComp[i] == '~') {
            if (i > pdi->di_bNumericTail || i < pdi->di_bNumericTail-2)
                iTilde = -1;    // this filename's tail is out of bounds
            else {
                iTilde = i;
                cDigits = 0;
            }
            continue;
        }

        // cDigits, if used, will be validated when we call pchtoi(),
        // so there's no need to verify this character really is a DIGIT.

        if (iTilde != -1 && pchComp[i] != ' ')
            cDigits++;
    }

    if (iTilde == -1 || cDigits == 0) {

        // This name doesn't have a tail, so if we've already seen
        // a match on the non-tail form, then we don't need to go any
        // further.

        if (TestBitArray(pdwBitArray, 0)) {
            DEBUGMSGBREAK(!memcmp(pdi->di_achOEM, pdi->di_pde->de_name, sizeof(pdi->di_achOEM)), (DBGTEXT("FATFS!CheckNumericTail: non-tail form already exists!\r\n")));
            return;
        }
        pchComp = pdi->di_achOEM;
        cDigits = 0;
    }
    else {

        // This name DOES have a tail...

        memcpy(achComp, pdi->di_achOEM, sizeof(achComp));
        memcpy(achComp+iTilde, pdi->di_pde->de_name+iTilde, cDigits+1);
        pchComp = achComp;

        // If the previous char is also a ~, then copy that as well
        if (iTilde && pdi->di_pde->de_name[iTilde-1] == '~') {
            achComp[iTilde-1] = '~';
        }        
    }

    if (memcmp(pchComp, pdi->di_pde->de_name, sizeof(achComp)) == 0) {

        int v = 0;

        if (cDigits) {

            // Note that pchtoi() is unlike a typical atoi() function
            // in that it doesn't simply return a converted integer
            // when it reaches the first non-numeric character;  if you
            // tell it there should be cDigits digits, it INSISTS on
            // that many digits.

            v = pchtoi(pchComp+iTilde+1, cDigits);

            // Check for "~0" (which we neither track nor generate)
            // and non-numeric sequences (which pchtoi returns as -1).

            if (v <= 0)
                return;
        }

        // The directory is inconsistent if we find the same numeric
        // tail more than once!

        DEBUGMSGBREAK(TestBitArray(pdwBitArray, v), (DBGTEXT("FATFS!CheckNumericTail: %d already exists!\r\n"), v));

        SetBitArray(pdwBitArray, v);
    }
}


/*  GenerateNumericTail - generate an 8.3 name with numeric tail
 *
 *  ENTRY
 *      pdi - pointer to DIRINFO structure
 *      pdwBitArray - pointer to numeric tail bit array
 *
 *  EXIT
 *      None
 *
 *  NOTES
 *      Bit 0 of pdwBitArray corresponds to the unmodified/truncated 8.3
 *      version of the long filename, and bits 1-N correspond to names with
 *      numeric tails "~1" through "~N".  A SET bit means that short name
 *      tail is in use, a CLEAR bit means it is available.
 */

void GenerateNumericTail(PDIRINFO pdi, PDWORD pdwBitArray)
{
    if (!(pdi->di_flags & DIRINFO_OEM)) {

        // Compare the number of SET bits to the TOTAL number of
        // available bits;  we add 1 to SET bits in case bit 0 is clear,
        // because we're not currently interested in using that case.

        if (pdwBitArray[1]+1 >= pdwBitArray[0]) {

            // All the possibilities are in use, so just zero achOEM.

            pdi->di_achOEM[0] = 0;
        }
        else {

            int v;

            // We know there's at least TWO clear bits (one of which may
            // be bit 0).  Find the next clear bit and create the corresponding
            // numeric tail.

            for (v=1; v < (int)pdwBitArray[0]; v++) {

                if (!TestBitArray(pdwBitArray, v)) {

                    int i = pdi->di_bNumericTail;

                    if (v > 9) {
                        if (v <= 99) {
                            if (i > 5)
                                i = 5;
                        }
                        else if (v <= 999) {
                            if (i > 4)
                                i = 4;
                        }
                        else {
                            DEBUGMSGBREAK(TRUE, (DBGTEXT("FATFS!GenerateNumericTail: bit array too large! (%d)\r\n"), pdwBitArray[0]));
                            break;
                        }
                    }

                    // Make sure the ~ is not part of a DBCS char
                    if (i && IsUsedAsLeadByte(pdi->di_achOEM, i-1)) {
                        pdi->di_achOEM[i-1] = '~';
                    }
                    pdi->di_achOEM[i] = '~';
                    itopch(v, &pdi->di_achOEM[i+1]);
                    break;
                }
            }
        }
    }
}

/*  IsUsedAsLeadByte
 *
 *  NOTES
 *      The API IsDBCSLeadByte determines if the byte is in the valid
 *      character range to be a lead byte.  However, it can also be a trailing byte.  
 *      To determine if it is actually being used as a lead byte, count the 
 *      number of consecutive lead byte chars at the index going backwards 
 *      and if the number is odd, then it is actually a lead byte.
 */
BOOL IsUsedAsLeadByte (char string[], int index)
{
    DWORD dwDBCSBytes = 0;
    int i;

    for (i = index; i >= 0; i--) {
        if (IsDBCSLeadByte(string[i])) {
            dwDBCSBytes++;
        } else {
            break;
        }
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产成人高清精品| 在线观看欧美黄色| 99热99精品| 欧美一区二区精品在线| 国产精品天美传媒| 日韩电影免费一区| 91在线视频观看| 精品免费一区二区三区| 亚洲制服丝袜在线| 国产a久久麻豆| 日韩精品一区二区在线| 亚洲在线视频一区| 91网页版在线| 国产精品免费视频观看| 国产一区二区91| 91麻豆精品国产91| 一区二区激情小说| 成人国产亚洲欧美成人综合网| 欧美第一区第二区| 日韩影视精彩在线| 91高清视频在线| 中文字幕一区日韩精品欧美| 国产精品18久久久久久久久| 日韩欧美精品三级| 天天综合天天做天天综合| 色偷偷88欧美精品久久久| 亚洲国产精品精华液2区45| 老司机一区二区| 精品国产精品一区二区夜夜嗨| 午夜亚洲福利老司机| 欧美中文字幕一区| 亚洲夂夂婷婷色拍ww47| 在线观看av一区| 亚洲第一狼人社区| 欧美日韩高清一区| 午夜在线电影亚洲一区| 欧美日韩高清在线| 日韩高清一区二区| 日韩三级伦理片妻子的秘密按摩| 亚洲成人精品一区| 91精品国产色综合久久不卡电影| 日韩电影在线一区二区| 日韩写真欧美这视频| 青青草国产精品97视觉盛宴| av在线这里只有精品| 自拍视频在线观看一区二区| 99精品视频在线观看免费| 亚洲欧美成aⅴ人在线观看| 一本一本久久a久久精品综合麻豆| 亚洲免费av高清| 欧美日韩精品欧美日韩精品一| 午夜精品福利一区二区蜜股av| 欧美日韩视频第一区| 美女诱惑一区二区| 久久久精品免费免费| 成人app网站| 亚洲一二三四在线| 日韩午夜激情av| 国产盗摄视频一区二区三区| 亚洲人妖av一区二区| 欧美性大战久久久| 久久国产精品99久久久久久老狼| 国产欧美日韩在线视频| 色久综合一二码| 美洲天堂一区二卡三卡四卡视频| 欧美精品一区二区三区一线天视频| 国产成人免费网站| 亚洲最新视频在线观看| 精品国产免费人成在线观看| 白白色亚洲国产精品| 日韩一区欧美二区| 国产精品免费免费| 欧美日韩成人一区| 丰满亚洲少妇av| 日韩高清在线不卡| 综合激情成人伊人| 日韩免费观看高清完整版在线观看| 高清不卡一区二区| 婷婷夜色潮精品综合在线| 国产午夜精品理论片a级大结局| 91国产免费看| 国产成人精品在线看| 丝袜诱惑制服诱惑色一区在线观看| 久久精品视频一区| 欧美精品久久久久久久多人混战 | 欧美色手机在线观看| 精彩视频一区二区三区| 亚洲最新视频在线观看| 久久精品男人天堂av| 欧美精品99久久久**| 99re热视频精品| 国产精品一区二区x88av| 五月天一区二区三区| 亚洲欧美日韩综合aⅴ视频| 久久这里只精品最新地址| 欧美人与禽zozo性伦| 91蜜桃网址入口| aaa欧美日韩| caoporn国产一区二区| 激情久久五月天| 午夜精品福利视频网站| 亚洲一二三区不卡| 亚洲女人的天堂| 国产三级一区二区| 久久综合国产精品| 久久蜜臀中文字幕| 日韩精品专区在线影院观看| 欧美浪妇xxxx高跟鞋交| 欧美中文字幕不卡| 91久久线看在观草草青青| www.色综合.com| aaa欧美大片| 成人av一区二区三区| 国产99久久久国产精品免费看 | 欧美一激情一区二区三区| 欧美吞精做爰啪啪高潮| 欧美午夜不卡在线观看免费| 在线观看日韩电影| 欧美日韩综合一区| 欧美日韩一区小说| 欧美日本一道本在线视频| 精品视频一区二区三区免费| 欧美日韩久久一区二区| 在线不卡中文字幕| 欧美一级高清片| 亚洲精品一区二区在线观看| 久久久综合网站| 国产精品天干天干在观线| 中文字幕一区二区三区蜜月| 亚洲精品乱码久久久久久久久| 亚洲精品免费在线| 亚洲成人第一页| 蜜桃一区二区三区在线观看| 精品午夜久久福利影院| 国产精品一区二区黑丝| 99精品一区二区| 欧美一a一片一级一片| 3d成人动漫网站| 久久综合久久99| 自拍av一区二区三区| 亚洲大片一区二区三区| 久久99国产乱子伦精品免费| 成人黄色电影在线| 91成人网在线| 久久在线观看免费| 国产精品九色蝌蚪自拍| 亚洲成va人在线观看| 精品影院一区二区久久久| 粉嫩在线一区二区三区视频| 欧美午夜精品免费| 欧美老肥妇做.爰bbww视频| 日韩久久久久久| 亚洲欧洲性图库| 日本美女一区二区| 国产精品一二一区| 欧美三级电影精品| 久久久久久久久伊人| 亚洲黄色小说网站| 久久疯狂做爰流白浆xx| 97se亚洲国产综合在线| 欧美一区永久视频免费观看| 国产精品久久久久aaaa樱花 | 国产综合一区二区| 99国产麻豆精品| 日韩一级黄色片| 亚洲精品视频在线| 国内精品久久久久影院色| 欧美亚洲国产一区在线观看网站| 亚洲精品在线网站| 亚洲r级在线视频| 北条麻妃国产九九精品视频| 日韩欧美资源站| 亚洲小说春色综合另类电影| 成人av免费观看| 亚洲精品一区二区精华| 午夜电影一区二区| 色哟哟精品一区| 欧美经典一区二区三区| 毛片一区二区三区| 在线免费精品视频| 国产精品久久久久久久久晋中 | 国产激情视频一区二区在线观看| 欧美日产国产精品| 有坂深雪av一区二区精品| 国产精品99久久久久久久vr| 91精品久久久久久久99蜜桃 | 久久香蕉国产线看观看99| 成人免费毛片app| 日韩一二在线观看| 日韩高清不卡在线| 欧美日免费三级在线| 夜夜精品视频一区二区 | 成人综合在线观看| 美腿丝袜一区二区三区| 免费人成黄页网站在线一区二区| 91在线观看下载| 国产精品美日韩| 国产精品白丝jk白祙喷水网站| 日韩精品一区二区三区在线 | 国产精品黄色在线观看|