Last Comment Bug 736887 - nsHttpChannel.cpp: warning C4244: 'argument' : conversion from 'double' to 'PRTime', possible loss of data
: nsHttpChannel.cpp: warning C4244: 'argument' : conversion from 'double' to 'P...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Networking: HTTP (show other bugs)
: Trunk
: All Windows 7
: -- trivial (vote)
: mozilla14
Assigned To: Brian Smith (:briansmith, :bsmith, use NEEDINFO?)
:
: Patrick McManus [:mcmanus]
Mentors:
Depends on:
Blocks: 576006
  Show dependency treegraph
 
Reported: 2012-03-18 14:05 PDT by Brian Smith (:briansmith, :bsmith, use NEEDINFO?)
Modified: 2012-04-05 11:26 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Use explicit cast to avoid the warning (1.24 KB, patch)
2012-03-18 16:17 PDT, Brian Smith (:briansmith, :bsmith, use NEEDINFO?)
cbiesinger: review+
Details | Diff | Splinter Review

Description Brian Smith (:briansmith, :bsmith, use NEEDINFO?) 2012-03-18 14:05:58 PDT
+++ This bug was initially created as a clone of Bug #576006 +++

MSVC2010 complains with the warning in the summary. The code is:

  #define IMPL_TIMING_ATTR(name)                               \
  NS_IMETHODIMP                                                \
  nsHttpChannel::Get##name##Time(PRTime* _retval) {            \
    mozilla::TimeStamp stamp;                                  \
    Get##name(&stamp);                                         \
    if (stamp.IsNull()) {                                      \
        *_retval = 0;                                          \
        return NS_OK;                                          \
    }                                                          \
    *_retval = mChannelCreationTime +                          \
        (stamp - mChannelCreationTimestamp).ToSeconds() * 1e6; \
    return NS_OK;                                              \
  }

AFAICT, the simplest way to avoid the warning is to explicitly cast the expression ((stamp - mChannelCreationTimestamp).ToSeconds() * 1e6) to PRTime.
Comment 1 Brian Smith (:briansmith, :bsmith, use NEEDINFO?) 2012-03-18 16:17:43 PDT
Created attachment 607027 [details] [diff] [review]
Use explicit cast to avoid the warning
Comment 2 Brian Smith (:briansmith, :bsmith, use NEEDINFO?) 2012-04-04 19:21:13 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/497086b1463c

Note You need to log in before you can comment on or make changes to this bug.