Ticket #9290: 0001-Fix-GCC4.8-narrowing-conversion-warnings.patch

File 0001-Fix-GCC4.8-narrowing-conversion-warnings.patch, 6.1 KB (added by mt, 11 years ago)
  • src/add-ons/accelerants/intel_extreme/mode.cpp

    From 4cba7a70012320ab7e0df056afd2ce455bcf030e Mon Sep 17 00:00:00 2001
    From: Murai Takashi <tmurai01@gmail.com>
    Date: Sat, 4 May 2013 19:35:23 +0900
    Subject: [PATCH] Fix GCC4.8 narrowing conversion warnings
    
    ---
     src/add-ons/accelerants/intel_extreme/mode.cpp     |    2 +-
     .../bus_managers/firewire/firewire_module.cpp      |   30 ++++++++++++--------
     .../kernel/bus_managers/firewire/fwohci.cpp        |    2 +-
     .../drivers/network/usb_davicom/DavicomDevice.cpp  |    4 +--
     src/libs/gnu/xattr.cpp                             |    3 +-
     5 files changed, 24 insertions(+), 17 deletions(-)
    
    diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp
    index 2727a16..95d7608 100644
    a b sanitize_display_mode(display_mode& mode)  
    495495        gInfo->shared_info->pll_info.min_frequency,
    496496        gInfo->shared_info->pll_info.max_frequency,
    497497        // horizontal
    498         {olderCard ? 2 : 1, 0, 8160, 32, 8192, 0, 8192},
     498        {(uint16)(olderCard ? 2 : 1), 0, 8160, 32, 8192, 0, 8192},
    499499        {1, 1, 4092, 2, 63, 1, 4096}
    500500    };
    501501
  • src/add-ons/kernel/bus_managers/firewire/firewire_module.cpp

    diff --git a/src/add-ons/kernel/bus_managers/firewire/firewire_module.cpp b/src/add-ons/kernel/bus_managers/firewire/firewire_module.cpp
    index 6f6fbf3..e3d5461 100644
    a b struct supported_device supported_devices[] = {  
    4949    {FW_VENDORID_NEC, FW_DEVICE_UPD72873, "NEC uPD72873"},
    5050    {FW_VENDORID_NEC, FW_DEVICE_UPD72874, "NEC uPD72874"},
    5151    {FW_VENDORID_SIS, FW_DEVICE_7007, "SiS 7007"},
    52     {FW_VENDORID_TI, FW_DEVICE_TITSB22, "Texas Instruments TSB12LV22"},
    53     {FW_VENDORID_TI, FW_DEVICE_TITSB23, "Texas Instruments TSB12LV23"},
    54     {FW_VENDORID_TI, FW_DEVICE_TITSB26, "Texas Instruments TSB12LV26"},
    55     {FW_VENDORID_TI, FW_DEVICE_TITSB43, "Texas Instruments TSB43AA22"},
    56     {FW_VENDORID_TI, FW_DEVICE_TITSB43A, "Texas Instruments TSB43AB22/A"},
    57     {FW_VENDORID_TI, FW_DEVICE_TITSB43AB21, "Texas Instruments TSB43AB21/A/AI/A-EP"},
    58     {FW_VENDORID_TI, FW_DEVICE_TITSB43AB23, "Texas Instruments TSB43AB23"},
    59     {FW_VENDORID_TI, FW_DEVICE_TITSB82AA2, "Texas Instruments TSB82AA2"},
    60     {FW_VENDORID_TI, FW_DEVICE_TIPCI4450, "Texas Instruments PCI4450"},
    61     {FW_VENDORID_TI, FW_DEVICE_TIPCI4410A, "Texas Instruments PCI4410A"},
    62     {FW_VENDORID_TI, FW_DEVICE_TIPCI4451, "Texas Instruments PCI4451"},
     52    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB22, "Texas Instruments TSB12LV22"},
     53    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB23, "Texas Instruments TSB12LV23"},
     54    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB26, "Texas Instruments TSB12LV26"},
     55    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB43, "Texas Instruments TSB43AA22"},
     56    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB43A,
     57        "Texas Instruments TSB43AB22/A"},
     58    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB43AB21,
     59        "Texas Instruments TSB43AB21/A/AI/A-EP"},
     60    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB43AB23,
     61        "Texas Instruments TSB43AB23"},
     62    {FW_VENDORID_TI, (uint32)FW_DEVICE_TITSB82AA2,
     63        "Texas Instruments TSB82AA2"},
     64    {FW_VENDORID_TI, (uint32)FW_DEVICE_TIPCI4450,
     65        "Texas Instruments PCI4450"},
     66    {FW_VENDORID_TI, (uint32)FW_DEVICE_TIPCI4410A,
     67        "Texas Instruments PCI4410A"},
     68    {FW_VENDORID_TI, (uint32)FW_DEVICE_TIPCI4451, "Texas Instruments PCI4451"},
    6369    {FW_VENDORID_VIA, FW_DEVICE_VT6306, "VIA Fire II (VT6306)"},
    6470    {FW_VENDORID_RICOH, FW_DEVICE_R5C551, "Ricoh R5C551"},
    6571    {FW_VENDORID_RICOH, FW_DEVICE_R5C552, "Ricoh R5C552"},
    struct supported_device supported_devices[] = {  
    6975    {FW_VENDORID_INTEL, FW_DEVICE_82372FB, "Intel 82372FB"},
    7076    {FW_VENDORID_ADAPTEC, FW_DEVICE_AIC5800, "Adaptec AHA-894x/AIC-5800"},
    7177    {FW_VENDORID_SUN, FW_DEVICE_PCIO2FW, "Sun PCIO-2"},
    72     {FW_VENDORID_SONY, FW_DEVICE_CXD3222, "Sony i.LINK (CXD3222)"},
     78    {FW_VENDORID_SONY, (uint32)FW_DEVICE_CXD3222, "Sony i.LINK (CXD3222)"},
    7379    {0, 0, NULL}
    7480};
    7581
  • src/add-ons/kernel/bus_managers/firewire/fwohci.cpp

    diff --git a/src/add-ons/kernel/bus_managers/firewire/fwohci.cpp b/src/add-ons/kernel/bus_managers/firewire/fwohci.cpp
    index e79b1ae..d8a6301 100644
    a b char fwohcicode[32][0x20]={  
    8787
    8888#define MAX_SPEED 3
    8989extern const char *const linkspeed[];
    90 uint32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31};
     90uint32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, (uint32_t)(1 << 31)};
    9191
    9292static struct tcode_info tinfo[] = {
    9393/*      hdr_len block   flag    valid_response */
  • src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp

    diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp
    index 8cff098..7e61378 100644
    a b DavicomDevice::Write(const uint8 *buffer, size_t *numBytes)  
    350350        uint    countHigh   :8;
    351351    } __attribute__((__packed__));
    352352
    353     _TXHeader header = { length & 0xff, length >> 8 & 0xff };
     353    _TXHeader header = {(uint)(length & 0xff), (uint)(length >> 8 & 0xff)};
    354354
    355355    uint8 padding = 0;
    356356
    DavicomDevice::_WriteMII(uint8 reg, uint16 data)  
    11171117    }
    11181118
    11191119    // put the value to data register
    1120     uint8 values[] = { data & 0xff, ( data >> 8 ) & 0xff };
     1120    uint8 values[] = {(uint8)(data & 0xff), (uint8)(( data >> 8 ) & 0xff)};
    11211121    result = _WriteRegister(RegEPDRL, sizeof(uint16), values);
    11221122    if (result != B_OK) {
    11231123        TRACE_ALWAYS("Failed to put data %#x. Error:%#x\n", data, result);
  • src/libs/gnu/xattr.cpp

    diff --git a/src/libs/gnu/xattr.cpp b/src/libs/gnu/xattr.cpp
    index fadb573..c4adfbb 100644
    a b struct AttributeName {  
    4343            // printable, just use them as the type string, otherwise convert
    4444            // to hex
    4545            char typeString[9];
    46             uint8 typeBytes[4] = { type >> 24, type >> 16, type >> 8, type };
     46            uint8 typeBytes[4] = {(uint8)(type >> 24), (uint8)(type >> 16),
     47                (uint8)(type >> 8), (uint8)type };
    4748            if (isprint(typeBytes[0]) && isprint(typeBytes[1])
    4849                && isprint(typeBytes[2]) && isprint(typeBytes[3])) {
    4950                typeString[0] = typeBytes[0];