Changeset 419


Ignore:
Timestamp:
Jan 18, 2018, 6:29:27 PM (7 years ago)
Author:
alain
Message:

Fis a bug in function get_name_from_short() in boot_fat32.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/bootloader_tsar/boot_fat32.c

    r23 r419  
    539539    uint32_t buffer_offset;     /* Index used to write to the buffer.   */
    540540
    541     /* Initializing the variables. */
    542541    entry_offset    = 0;
    543542    buffer_offset   = 0;
    544543
    545     /* Getting the file name. */
     544    // get the file name without suffix
    546545    while ((entry_offset < 8) && (entry[entry_offset] != ' '))
     546    {
    547547        buffer[buffer_offset++] = boot_to_lower(entry[entry_offset++]);
     548    }
     549
     550    // set entry to first suffix character
     551    entry_offset = 8;
     552
     553    if( entry[entry_offset] == ' ' )        // no suffix in name
     554    {
     555        // append the trailing NUL in buffer
     556        buffer[buffer_offset] = '\0';
     557    }
     558    else                                    // there is a suffix
     559    {
     560        // append the '.' in buffer   
     561        buffer[buffer_offset++] = '.';
     562
     563        // get the file extension
     564        while ((entry_offset < 11) && (entry[entry_offset] != ' '))
     565        {
     566            buffer[buffer_offset++] = boot_to_lower(entry[entry_offset++]);
     567        }
    548568   
    549     /* Appending the dot to the name buffer. */
    550     buffer[buffer_offset++] = '.';
    551 
    552     /* Getting the file extension. */
    553     while ((entry_offset < 11) && (entry[entry_offset] != ' '))
    554         buffer[buffer_offset++] = boot_to_lower(entry[entry_offset++]);
    555    
    556     /* Appending the trailing NUL to the buffer. */
    557     buffer[buffer_offset++] = '\0';
     569        // append the trailing NUL in buffer
     570        buffer[buffer_offset] = '\0';
     571    }
    558572       
    559573} // get_name_from_short()
     
    674688                    if (lfn_seq_elem_nr == 0) get_name_from_short(entry, name);
    675689
     690
     691#if DEBUG_BOOT_FAT32   
     692    boot_printf("\n[BOOT INFO] in %s : name = %s / entry = %s \n",
     693                __FUNCTION__ , name , entry );
     694#endif
     695
     696
     697
    676698                    // check if the full name is what we are looking for.
    677699                    if (boot_strcmp(name, path_comp) == 0)
Note: See TracChangeset for help on using the changeset viewer.