Changeset 521 for trunk/boot


Ignore:
Timestamp:
Aug 30, 2018, 6:39:41 PM (6 years ago)
Author:
viala@…
Message:

[boot] Add const qualifier where it's possible.

Fix some gcc warning of "const qualifier discarded" warning.
Because litterals string are of type 'const char *'.

Location:
trunk/boot/tsar_mips32
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/boot/tsar_mips32/boot_fat32.c

    r519 r521  
    401401 * @ returns 0 on success, -1 on error.                                     *
    402402 ****************************************************************************/
    403 static int get_path_component(char*      pathname,
    404                               char*      path_component,
    405                               uint32_t * nb_read)
     403static int get_path_component( const char * pathname,
     404                               char       * path_component,
     405                               uint32_t  * nb_read)
    406406{
    407407    uint32_t pathname_offset;   // index used to scan the LFN entry
     
    585585 * @ returns 0 on success, -1 on error.                                     *
    586586 ****************************************************************************/
    587 static int fat_file_search(char*    pathname,
    588                            uint32_t* first_cluster,
    589                            uint32_t* file_size)
     587static int fat_file_search( const char * pathname,
     588                            uint32_t   * first_cluster,
     589                            uint32_t   * file_size)
    590590{
    591591    char       path_comp[PATH_MAX_SIZE];    // Buffer for a path component
     
    886886
    887887///////////////////////////////////////
    888 int boot_fat32_load( char*    pathname,
    889                      uint32_t buff_addr,
    890                      uint32_t buff_size )
     888int boot_fat32_load( const char * pathname,
     889                     uint32_t     buff_addr,
     890                     uint32_t     buff_size )
    891891{
    892892    uint32_t cur_cluster;
  • trunk/boot/tsar_mips32/boot_fat32.h

    r474 r521  
    361361 * @ returns 0 on success, -1 on error.                                     *
    362362 ****************************************************************************/
    363 int boot_fat32_load( char*    pathname,
    364                      uint32_t buff_addr,
    365                      uint32_t buff_size );
     363int boot_fat32_load( const char * pathname,
     364                     uint32_t     buff_addr,
     365                     uint32_t     buff_size );
    366366
    367367#endif // BOOT_FAT32_H
  • trunk/boot/tsar_mips32/boot_tty_driver.c

    r457 r521  
    7474
    7575//////////////////////////////////
    76 int boot_tty_write( char    * buf,
    77                     uint32_t  nbytes )
     76int boot_tty_write( const char * buf,
     77                    uint32_t     nbytes )
    7878{
    7979    uint32_t nb_printed;
  • trunk/boot/tsar_mips32/boot_tty_driver.h

    r457 r521  
    7070 * @ returns 0 on success, -1 on error.     
    7171 ****************************************************************************/
    72 int boot_tty_write( char    * buf,
    73                     uint32_t  nbytes );
     72int boot_tty_write( const char * buf,
     73                    uint32_t     nbytes );
    7474
    7575#endif // BOOT_TTY_DRIVER_H
  • trunk/boot/tsar_mips32/boot_utils.c

    r474 r521  
    282282
    283283///////////////////////////////////////
    284 void boot_strcpy(char* dest, char* src)
     284void boot_strcpy( char * dest, const char * src)
    285285{
    286286    /* Checking if the arguments are correct. */
     
    294294
    295295/////////////////////////////
    296 uint32_t boot_strlen(char* s)
     296uint32_t boot_strlen( const char * s )
    297297{
    298298    uint32_t res = 0;   /* Length of the string (in bytes).             */
     
    309309
    310310///////////////////////////////////
    311 int boot_strcmp(char* s1, char* s2)
     311int boot_strcmp( const char * s1, const char * s2 )
    312312{
    313313    if ((s1 == NULL) || (s2 == NULL))
     
    333333
    334334/////////////////////////
    335 void boot_puts(char* str)
     335void boot_puts( const char * str )
    336336{
    337337    boot_tty_write(str, boot_strlen(str));
     
    340340   
    341341///////////////////////////////////////
    342 void boot_printf( char * format , ... )
     342void boot_printf( const char * format , ... )
    343343{
    344344    va_list args;
  • trunk/boot/tsar_mips32/boot_utils.h

    r474 r521  
    150150 * @ dest   : pointer to the destination string.
    151151 ****************************************************************************/
    152 void boot_strcpy(char* dest, char* src);
     152void boot_strcpy( char* dest, const char * src );
    153153
    154154/****************************************************************************
     
    158158 * @ returns the number of bytes in the string.
    159159 ****************************************************************************/
    160 uint32_t boot_strlen(char* s);
     160uint32_t boot_strlen( const char * s );
    161161
    162162/****************************************************************************
     
    166166 * @ returns 0 if these 2 strings match, 1 otherwise.
    167167 ****************************************************************************/
    168 int boot_strcmp(char* s1, char* s2);
     168int boot_strcmp( const char * s1, const char * s2 );
    169169
    170170/****************************************************************************
     
    177177 * @ str    : pointer to the string to be printed on the boot TTY terminal.
    178178 ****************************************************************************/
    179 void boot_puts(char* str);
     179void boot_puts( const char* str );
    180180
    181181/****************************************************************************
     
    200200 *  - %s : NUL terminated string. 
    201201 ****************************************************************************/
    202 void boot_printf(char* format, ...);
     202void boot_printf( const char* format, ... );
    203203
    204204/****************************************************************************
Note: See TracChangeset for help on using the changeset viewer.