40#define LFN_ID_START 0x40
41#define LFN_ID_SLOTMASK 0x1f
43#define CHARS_PER_LFN 13
53 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
54 '8',
'9',
'A',
'B',
'C',
'D',
'E',
'F',
55 'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
56 'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
57 'W',
'X',
'Y',
'Z',
'a',
'b',
'c',
'd',
58 'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
59 'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
60 'u',
'v',
'w',
'x',
'y',
'z',
'+',
'-'
64#define UNICODE_CONVERTABLE(cl,ch) (ch == 0 && (cl < 0x80 || cl >= 0xa0))
67#define UNTIL_0 INT_MAX
71static char *
cnv_unicode(
const unsigned char *uni,
int maxlen,
int use_q);
76#define CNV_THIS_PART(lfn) \
78 unsigned char __part_uni[CHARS_PER_LFN*2]; \
79 copy_lfn_part( __part_uni, lfn ); \
80 cnv_unicode( __part_uni, CHARS_PER_LFN, 0 ); \
93#define CNV_PARTS_SO_FAR() \
94 (cnv_unicode( lfn_unicode+(lfn_slot*CHARS_PER_LFN*2), \
95 lfn_parts*CHARS_PER_LFN, 0 ))
97#define BYTES_TO_WCHAR(cl,ch) ((wchar_t)((unsigned)(cl) + ((unsigned)(ch) << 8)))
100 wchar_t wstr[] = {
x, 0 };
106 wchar_t wstr[] = {
x, 0 };
108 if (
size != (
size_t) - 1)
116static char *
cnv_unicode(
const unsigned char *uni,
int maxlen,
int use_q)
118 const unsigned char *
up;
119 unsigned char *
out, *
cp;
123 for (
len = 0,
up = uni; (
up - uni) / 2 < maxlen && (
up[0] ||
up[1]);
134 for (
up = uni; (
up - uni) / 2 < maxlen && (
up[0] ||
up[1]);
up += 2) {
185 for (
sum = 0,
i = 0;
i < 11;
i++)
216 die(
"lfn_add_slot called with non-LFN directory entry");
229 printf(
"A new long file name starts within an old one.\n");
233 printf(
" It could be that the LFN start bit is wrong here\n"
234 " if \"%s\" seems to match \"%s\".\n", part1, part2);
240 printf(
"1: Delete previous LFN\n2: Leave it as it is.\n");
242 printf(
"3: Clear start bit and concatenate LFNs\n");
244 printf(
" Not auto-correcting this.\n");
246 switch (
get_key(can_clear ?
"123" :
"12",
"?")) {
254 lfn->
id &= ~LFN_ID_START;
256 sizeof(lfn->
id), &lfn->
id);
272 printf(
"Long filename fragment \"%s\" found outside a LFN "
273 "sequence.\n (Maybe the start bit is missing on the "
274 "last fragment)\n", part);
277 printf(
"1: Delete fragment\n2: Leave it as it is.\n"
278 "3: Set start bit\n");
280 printf(
" Not auto-correcting this.\n");
295 sizeof(lfn->
id), &lfn->
id);
310 printf(
"Unexpected long filename sequence number "
315 printf(
" It could be that just the number is wrong\n"
316 " if \"%s\" seems to match \"%s\".\n", part1, part2);
323 (
"1: Delete LFN\n2: Leave it as it is (and ignore LFN so far)\n");
325 printf(
"3: Correct sequence number\n");
327 printf(
" Not auto-correcting this.\n");
344 sizeof(lfn->
id), &lfn->
id);
353 printf(
"Checksum in long filename part wrong "
354 "(%02x vs. expected %02x).\n",
357 printf(
"1: Delete LFN\n2: Leave it as it is.\n"
358 "3: Correct checksum\n");
360 printf(
" Not auto-correcting this.\n");
389 printf(
"Reserved field in VFAT long filename slot is not 0 "
392 printf(
"1: Fix.\n2: Leave it.\n");
394 printf(
"Auto-setting to 0.\n");
402 printf(
"Start cluster field in VFAT long filename slot is not 0 "
403 "(but 0x%04x).\n", lfn->
start);
405 printf(
"1: Fix.\n2: Leave it.\n");
407 printf(
"Auto-setting to 0.\n");
426 die(
"lfn_get called with LFN directory entry");
430 printf(
"lcase=%02x\n", de->lcase);
445 printf(
"Unfinished long file name \"%s\".\n"
446 " (Start may have been overwritten by %s)\n",
450 printf(
"1: Delete LFN\n2: Leave it as it is.\n"
451 "3: Fix numbering (truncates long name and attaches "
454 printf(
" Not auto-correcting this.\n");
476 sum = (((
sum & 1) << 7) | ((
sum & 0xfe) >> 1)) + de->name[
i];
483 printf(
"Wrong checksum for long file name \"%s\".\n"
484 " (Short name %s may have changed without updating the long name)\n",
488 printf(
"1: Delete LFN\n2: Leave it as it is.\n"
489 "3: Fix checksum (attaches to short name %s)\n",
short_name);
491 printf(
" Not auto-correcting this.\n");
528 printf(
"1: Delete.\n2: Leave it.\n");
534 printf(
" Auto-deleting.\n");
unsigned short int uint16_t
static const WCHAR empty[]
GLint GLint GLint GLint GLint x
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define CNV_PARTS_SO_FAR()
#define CNV_THIS_PART(lfn)
#define UNICODE_CONVERTABLE(cl, ch)
void lfn_add_slot(DIR_ENT *de, off_t dir_offset)
static unsigned char fat_uni2esc[64]
static size_t wctombs(char *dest, wchar_t x)
static size_t mbslen(wchar_t x)
unsigned char lfn_checksum
static void clear_lfn_slots(int start, int end)
void lfn_check_orphaned(void)
void lfn_fix_checksum(off_t from, off_t to, const char *short_name)
static void copy_lfn_part(unsigned char *dst, LFN_ENT *lfn)
char * lfn_get(DIR_ENT *de, off_t *lfn_offset)
#define BYTES_TO_WCHAR(cl, ch)
unsigned char * lfn_unicode
static char * cnv_unicode(const unsigned char *uni, int maxlen, int use_q)
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
static int sum(int x_, int y_)
#define offsetof(TYPE, MEMBER)
void * qalloc(void **root, int size)
char get_key(const char *valid, const char *prompt)
void fs_write(off_t pos, int size, void *data)
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out