aboutsummaryrefslogtreecommitdiff
path: root/block-vvfat.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-24 13:26:04 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-24 13:26:04 +0000
commit1e080d5dbb8bcd496101c9a31e51d110cb734b83 (patch)
tree0d598bd01e1520932b52d44c0377171df6d945e2 /block-vvfat.c
parent3b4aa426a92ecf449d6b3c8317f5e3fb1544cdef (diff)
downloadqemu-1e080d5dbb8bcd496101c9a31e51d110cb734b83.zip
qemu-1e080d5dbb8bcd496101c9a31e51d110cb734b83.tar.gz
qemu-1e080d5dbb8bcd496101c9a31e51d110cb734b83.tar.bz2
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
Diffstat (limited to 'block-vvfat.c')
-rw-r--r--block-vvfat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block-vvfat.c b/block-vvfat.c
index 708f031..873956d 100644
--- a/block-vvfat.c
+++ b/block-vvfat.c
@@ -415,14 +415,16 @@ static void init_mbr(BDRVVVFATState* s)
static inline int short2long_name(char* dest,const char* src)
{
int i;
+ int len;
for(i=0;i<129 && src[i];i++) {
dest[2*i]=src[i];
dest[2*i+1]=0;
}
+ len=2*i;
dest[2*i]=dest[2*i+1]=0;
for(i=2*i+2;(i%26);i++)
dest[i]=0xff;
- return i;
+ return len;
}
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->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);
if(offset<10) offset=1+offset;
else if(offset<22) offset=14+offset-10;