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 | 415 | static inline int short2long_name(char* dest,const char* src) |
| 416 | 416 | { |
| 417 | 417 | int i; |
| 418 | + int len; | |
| 418 | 419 | for(i=0;i<129 && src[i];i++) { |
| 419 | 420 | dest[2*i]=src[i]; |
| 420 | 421 | dest[2*i+1]=0; |
| 421 | 422 | } |
| 423 | + len=2*i; | |
| 422 | 424 | dest[2*i]=dest[2*i+1]=0; |
| 423 | 425 | for(i=2*i+2;(i%26);i++) |
| 424 | 426 | dest[i]=0xff; |
| 425 | - return i; | |
| 427 | + return len; | |
| 426 | 428 | } |
| 427 | 429 | |
| 428 | 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 | 441 | entry->begin=0; |
| 440 | 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 | 445 | int offset=(i%26); |
| 444 | 446 | if(offset<10) offset=1+offset; |
| 445 | 447 | else if(offset<22) offset=14+offset-10; | ... | ... |