nsHttpChannel.cpp: warning C4244: 'argument' : conversion from 'double' to 'PRTime', possible loss of data

RESOLVED FIXED in mozilla14

Status

()

Core
Networking: HTTP
--
trivial
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: briansmith, Assigned: briansmith)

Tracking

Trunk
mozilla14
All
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

+++ 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.
Created attachment 607027 [details] [diff] [review]
Use explicit cast to avoid the warning
Assignee: nobody → bsmith
Status: NEW → ASSIGNED
Attachment #607027 - Flags: review?(cbiesinger)
Attachment #607027 - Flags: review?(cbiesinger) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/497086b1463c
Target Milestone: --- → mozilla14
http://hg.mozilla.org/mozilla-central/rev/497086b1463c
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.