48#define LFN_ID_START 0x40
49#define LFN_ID_SLOTMASK 0x1f
51#define CHARS_PER_LFN 13
61 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
62 '8',
'9',
'A',
'B',
'C',
'D',
'E',
'F',
63 'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
64 'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
65 'W',
'X',
'Y',
'Z',
'a',
'b',
'c',
'd',
66 'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
67 'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
68 'u',
'v',
'w',
'x',
'y',
'z',
'+',
'-'
72#define UNICODE_CONVERTABLE(cl,ch) (ch == 0 && (cl < 0x80 || cl >= 0xa0))
75#define UNTIL_0 INT_MAX
79static char *
cnv_unicode(
const unsigned char *uni,
int maxlen,
int use_q);
84#define CNV_THIS_PART(lfn) \
86 unsigned char __part_uni[CHARS_PER_LFN*2]; \
87 copy_lfn_part( __part_uni, lfn ); \
88 cnv_unicode( __part_uni, CHARS_PER_LFN, 0 ); \
101#define CNV_PARTS_SO_FAR() \
102 (cnv_unicode( lfn_unicode+(lfn_slot*CHARS_PER_LFN*2), \
103 lfn_parts*CHARS_PER_LFN, 0 ))
105#define BYTES_TO_WCHAR(cl,ch) ((wchar_t)((unsigned)(cl) + ((unsigned)(ch) << 8)))
108 wchar_t wstr[] = {
x, 0 };
114 wchar_t wstr[] = {
x, 0 };
116 if (
size != (
size_t) - 1)
124static char *
cnv_unicode(
const unsigned char *uni,
int maxlen,
int use_q)
126 const unsigned char *
up;
127 unsigned char *
out, *
cp;
131 for (
len = 0,
up = uni; (
up - uni) / 2 < maxlen && (
up[0] ||
up[1]);
142 for (
up = uni; (
up - uni) / 2 < maxlen && (
up[0] ||
up[1]);
up += 2) {
193 for (
sum = 0,
i = 0;
i < 11;
i++)
224 die(
"lfn_add_slot called with non-LFN directory entry");
237 printf(
"A new long file name starts within an old one.\n");
241 printf(
" It could be that the LFN start bit is wrong here\n"
242 " if \"%s\" seems to match \"%s\".\n", part1, part2);
248 printf(
"1: Delete previous LFN\n2: Leave it as it is.\n");
250 printf(
"3: Clear start bit and concatenate LFNs\n");
252 printf(
" Not auto-correcting this.\n");
254 switch (
get_key(can_clear ?
"123" :
"12",
"?")) {
262 lfn->
id &= ~LFN_ID_START;
264 sizeof(lfn->
id), &lfn->
id);
280 printf(
"Long filename fragment \"%s\" found outside a LFN "
281 "sequence.\n (Maybe the start bit is missing on the "
282 "last fragment)\n", part);
285 printf(
"1: Delete fragment\n2: Leave it as it is.\n"
286 "3: Set start bit\n");
288 printf(
" Not auto-correcting this.\n");
303 sizeof(lfn->
id), &lfn->
id);
318 printf(
"Unexpected long filename sequence number "
323 printf(
" It could be that just the number is wrong\n"
324 " if \"%s\" seems to match \"%s\".\n", part1, part2);
331 (
"1: Delete LFN\n2: Leave it as it is (and ignore LFN so far)\n");
333 printf(
"3: Correct sequence number\n");
335 printf(
" Not auto-correcting this.\n");
352 sizeof(lfn->
id), &lfn->
id);
361 printf(
"Checksum in long filename part wrong "
362 "(%02x vs. expected %02x).\n",
365 printf(
"1: Delete LFN\n2: Leave it as it is.\n"
366 "3: Correct checksum\n");
368 printf(
" Not auto-correcting this.\n");
397 printf(
"Reserved field in VFAT long filename slot is not 0 "
400 printf(
"1: Fix.\n2: Leave it.\n");
402 printf(
"Auto-setting to 0.\n");
410 printf(
"Start cluster field in VFAT long filename slot is not 0 "
411 "(but 0x%04x).\n", lfn->
start);
413 printf(
"1: Fix.\n2: Leave it.\n");
415 printf(
"Auto-setting to 0.\n");
434 die(
"lfn_get called with LFN directory entry");
438 printf(
"lcase=%02x\n", de->lcase);
453 printf(
"Unfinished long file name \"%s\".\n"
454 " (Start may have been overwritten by %s)\n",
458 printf(
"1: Delete LFN\n2: Leave it as it is.\n"
459 "3: Fix numbering (truncates long name and attaches "
462 printf(
" Not auto-correcting this.\n");
484 sum = (((
sum & 1) << 7) | ((
sum & 0xfe) >> 1)) + de->name[
i];
491 printf(
"Wrong checksum for long file name \"%s\".\n"
492 " (Short name %s may have changed without updating the long name)\n",
496 printf(
"1: Delete LFN\n2: Leave it as it is.\n"
497 "3: Fix checksum (attaches to short name %s)\n",
short_name);
499 printf(
" Not auto-correcting this.\n");
536 printf(
"1: Delete.\n2: Leave it.\n");
542 printf(
" Auto-deleting.\n");
static const WCHAR empty[1]
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