VirtualBox

Changeset 44102 in vbox


Ignore:
Timestamp:
Dec 12, 2012 9:36:49 AM (12 years ago)
Author:
vboxsync
Message:

HostServices/Dnd: avoid floating point arithmetics here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/DragAndDrop/dndmanager.cpp

    r42261 r44102  
    514514
    515515    /* Advance progress info */
    516     if (pSelf->m_pfnProgressCallback)
    517         return pSelf->m_pfnProgressCallback(100.0 / pSelf->m_cbAll * pSelf->m_cbTransfered, DragAndDropSvc::DND_PROGRESS_RUNNING, pSelf->m_pvProgressUser);
    518     else
    519         return VINF_SUCCESS;
     516    int rc = VINF_SUCCESS;
     517    if (   pSelf->m_pfnProgressCallback
     518        && pSelf->m_cbAll)
     519        rc = pSelf->m_pfnProgressCallback((uint64_t)pSelf->m_cbTransfered * 100 / pSelf->m_cbAll,
     520                                          DragAndDropSvc::DND_PROGRESS_RUNNING, pSelf->m_pvProgressUser);
     521
     522    return rc;
    520523}
    521524
     
    740743        /* Create a new cancel message to inform the guest. */
    741744        m_pCurMsg = new DnDHGCancelMessage();
    742         m_pfnProgressCallback(100.0, DragAndDropSvc::DND_PROGRESS_CANCELLED, m_pvProgressUser);
     745        m_pfnProgressCallback(100, DragAndDropSvc::DND_PROGRESS_CANCELLED, m_pvProgressUser);
    743746    }
    744747
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette