Fix number_of_entries for filename of length [13] (Tristan Gingold).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3842 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
balrog 2007-12-24 13:26:04 +00:00
parent 3b4aa426a9
commit 1e080d5dbb

View File

@ -415,14 +415,16 @@ static void init_mbr(BDRVVVFATState* s)
static inline int short2long_name(char* dest,const char* src) static inline int short2long_name(char* dest,const char* src)
{ {
int i; int i;
int len;
for(i=0;i<129 && src[i];i++) { for(i=0;i<129 && src[i];i++) {
dest[2*i]=src[i]; dest[2*i]=src[i];
dest[2*i+1]=0; dest[2*i+1]=0;
} }
len=2*i;
dest[2*i]=dest[2*i+1]=0; dest[2*i]=dest[2*i+1]=0;
for(i=2*i+2;(i%26);i++) for(i=2*i+2;(i%26);i++)
dest[i]=0xff; dest[i]=0xff;
return i; return len;
} }
static inline direntry_t* create_long_filename(BDRVVVFATState* s,const char* filename) static inline direntry_t* create_long_filename(BDRVVVFATState* s,const char* filename)
@ -439,7 +441,7 @@ static inline direntry_t* create_long_filename(BDRVVVFATState* s,const char* fil
entry->begin=0; entry->begin=0;
entry->name[0]=(number_of_entries-i)|(i==0?0x40:0); entry->name[0]=(number_of_entries-i)|(i==0?0x40:0);
} }
for(i=0;i<length;i++) { for(i=0;i<26*number_of_entries;i++) {
int offset=(i%26); int offset=(i%26);
if(offset<10) offset=1+offset; if(offset<10) offset=1+offset;
else if(offset<22) offset=14+offset-10; else if(offset<22) offset=14+offset-10;