Changeset 24608

Show
Ignore:
Timestamp:
03/27/08 09:46:52 (8 months ago)
Author:
axeld
Message:

* Fixed warnings due to the NULL change.
* Minor cleanup.

Location:
haiku/trunk/src/system/boot/loader
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/src/system/boot/loader/elf.cpp

    r15756 r24608  
    1 /*  
    2 ** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 
    3 ** Distributed under the terms of the Haiku License. 
    4 */ 
     1/* 
     2 * Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 
     3 * Distributed under the terms of the MIT License. 
     4 */ 
    55 
    66 
     
    5858                switch (d[i].d_tag) { 
    5959                        case DT_HASH: 
    60 //                              image->symhash = (uint32 *)(d[i].d_un.d_ptr + image->text_region.delta); 
    61                                 break; 
    6260                        case DT_STRTAB: 
    63 //                              image->strtab = (char *)(d[i].d_un.d_ptr + image->text_region.delta); 
    6461                                break; 
    6562                        case DT_SYMTAB: 
    66                                 image->syms = (struct Elf32_Sym *)(d[i].d_un.d_ptr + image->text_region.delta); 
     63                                image->syms = (struct Elf32_Sym *)(d[i].d_un.d_ptr 
     64                                        + image->text_region.delta); 
    6765                                break; 
    6866                        case DT_REL: 
    69                                 image->rel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + image->text_region.delta); 
     67                                image->rel = (struct Elf32_Rel *)(d[i].d_un.d_ptr 
     68                                        + image->text_region.delta); 
    7069                                break; 
    7170                        case DT_RELSZ: 
     
    7372                                break; 
    7473                        case DT_RELA: 
    75                                 image->rela = (struct Elf32_Rela *)(d[i].d_un.d_ptr + image->text_region.delta); 
     74                                image->rela = (struct Elf32_Rela *)(d[i].d_un.d_ptr 
     75                                        + image->text_region.delta); 
    7676                                break; 
    7777                        case DT_RELASZ: 
     
    7979                                break; 
    8080                        case DT_JMPREL: 
    81                                 image->pltrel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + image->text_region.delta); 
     81                                image->pltrel = (struct Elf32_Rel *)(d[i].d_un.d_ptr 
     82                                        + image->text_region.delta); 
    8283                                break; 
    8384                        case DT_PLTRELSZ: 
     
    9495 
    9596        // lets make sure we found all the required sections 
    96 //      if (!image->symhash || !image->syms || !image->strtab) 
    97         if (/* !image->symhash ||*/ !image->syms /*|| !image->strtab*/) 
     97        if (image->syms == NULL) 
    9898                return B_ERROR; 
    9999 
     
    141141 
    142142                        // read in symbol table 
    143                         symbolTable = (Elf32_Sym *)kernel_args_malloc(size = sectionHeaders[i].sh_size); 
     143                        symbolTable = (Elf32_Sym *)kernel_args_malloc( 
     144                                size = sectionHeaders[i].sh_size); 
    144145                        if (symbolTable == NULL) { 
    145146                                status = B_NO_MEMORY; 
     
    147148                        } 
    148149 
    149                         length = read_pos(fd, sectionHeaders[i].sh_offset, symbolTable, size); 
     150                        length = read_pos(fd, sectionHeaders[i].sh_offset, symbolTable, 
     151                                size); 
    150152                        if (length < size) { 
    151153                                TRACE(("error reading in symbol table\n")); 
     
    271273 
    272274                region->start = ROUNDOWN(header.p_vaddr, B_PAGE_SIZE); 
    273                 region->size = ROUNDUP(header.p_memsz + (header.p_vaddr % B_PAGE_SIZE), B_PAGE_SIZE); 
     275                region->size = ROUNDUP(header.p_memsz + (header.p_vaddr % B_PAGE_SIZE), 
     276                        B_PAGE_SIZE); 
    274277                region->delta = -region->start; 
    275278 
     
    339342 
    340343                length = read_pos(fd, header.p_offset, 
    341                         (void *)(region->start + (header.p_vaddr % B_PAGE_SIZE)), header.p_filesz); 
     344                        (void *)(region->start + (header.p_vaddr % B_PAGE_SIZE)), 
     345                        header.p_filesz); 
    342346                if (length < (ssize_t)header.p_filesz) { 
    343347                        status = B_BAD_DATA; 
     
    346350                } 
    347351 
    348                 // clear anything above the file size (that may also contain the BSS area) 
     352                // Clear anything above the file size (that may also contain the BSS 
     353                // area) 
    349354 
    350355                uint32 offset = (header.p_vaddr % B_PAGE_SIZE) + header.p_filesz; 
     
    371376 
    372377error2: 
    373         if (image->text_region.start != NULL) 
     378        if (image->text_region.start != 0) 
    374379                platform_free_region((void *)image->text_region.start, totalSize); 
    375380error1: 
  • haiku/trunk/src/system/boot/loader/vfs.cpp

    r21611 r24608  
    11/* 
    2  * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. 
     2 * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. 
    33 * Distributed under the terms of the MIT License. 
    44 */ 
     
    538538        } 
    539539 
    540         return NULL; 
     540        return B_ENTRY_NOT_FOUND; 
    541541} 
    542542