Commit 1e080d5dbb8bcd496101c9a31e51d110cb734b83
1 parent
3b4aa426
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
Showing
1 changed file
with
4 additions
and
2 deletions
block-vvfat.c
| @@ -415,14 +415,16 @@ static void init_mbr(BDRVVVFATState* s) | @@ -415,14 +415,16 @@ static void init_mbr(BDRVVVFATState* s) | ||
| 415 | static inline int short2long_name(char* dest,const char* src) | 415 | static inline int short2long_name(char* dest,const char* src) |
| 416 | { | 416 | { |
| 417 | int i; | 417 | int i; |
| 418 | + int len; | ||
| 418 | for(i=0;i<129 && src[i];i++) { | 419 | for(i=0;i<129 && src[i];i++) { |
| 419 | dest[2*i]=src[i]; | 420 | dest[2*i]=src[i]; |
| 420 | dest[2*i+1]=0; | 421 | dest[2*i+1]=0; |
| 421 | } | 422 | } |
| 423 | + len=2*i; | ||
| 422 | dest[2*i]=dest[2*i+1]=0; | 424 | dest[2*i]=dest[2*i+1]=0; |
| 423 | for(i=2*i+2;(i%26);i++) | 425 | for(i=2*i+2;(i%26);i++) |
| 424 | dest[i]=0xff; | 426 | dest[i]=0xff; |
| 425 | - return i; | 427 | + return len; |
| 426 | } | 428 | } |
| 427 | 429 | ||
| 428 | static inline direntry_t* create_long_filename(BDRVVVFATState* s,const char* filename) | 430 | 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 | @@ -439,7 +441,7 @@ static inline direntry_t* create_long_filename(BDRVVVFATState* s,const char* fil | ||
| 439 | entry->begin=0; | 441 | entry->begin=0; |
| 440 | entry->name[0]=(number_of_entries-i)|(i==0?0x40:0); | 442 | entry->name[0]=(number_of_entries-i)|(i==0?0x40:0); |
| 441 | } | 443 | } |
| 442 | - for(i=0;i<length;i++) { | 444 | + for(i=0;i<26*number_of_entries;i++) { |
| 443 | int offset=(i%26); | 445 | int offset=(i%26); |
| 444 | if(offset<10) offset=1+offset; | 446 | if(offset<10) offset=1+offset; |
| 445 | else if(offset<22) offset=14+offset-10; | 447 | else if(offset<22) offset=14+offset-10; |