git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35539
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#define wx_reinterpret_cast(t, x) ((t)(x))
#endif
#define wx_reinterpret_cast(t, x) ((t)(x))
#endif
+/*
+ This one is a wx invention: like static cast but used when we intentionally
+ truncate from a larger to smaller type, static_cast<> can't be used for it
+ as it results in warnings when using some compilers (SGI mipspro for example)
+ */
+#define wx_truncate_cast(t, x) ((t)(x))
+
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) wx_const_cast(className *, obj)
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) wx_const_cast(className *, obj)
const regmatch_t& match = m_Matches[index];
const regmatch_t& match = m_Matches[index];
+ // we need the casts because rm_so can be a 64 bit quantity
+ *start = wx_truncate_cast(size_t, match.rm_so);
- *len = match.rm_eo - match.rm_so;
+ *len = wx_truncate_cast(size_t, match.rm_eo - match.rm_so);
return wxInvalidOffset;
}
return wxInvalidOffset;
}
- if ( ofs < 0 || wx_static_cast(size_t, ofs) > m_len )
+ if ( ofs < 0 || ofs > wx_static_cast(wxFileOffset, m_len) )
- m_pos = wx_static_cast(size_t, ofs);
+ // FIXME: this can't be right
+ m_pos = wx_truncate_cast(size_t, ofs);
- wxFileOffset len = fileWave.Length();
+ wxFileOffset lenOrig = fileWave.Length();
+ if ( lenOrig == wxInvalidOffset )
+ return false;
+
+ size_t len = wx_truncate_cast(size_t, lenOrig);
wxUint8 *data = new wxUint8[len];
if (fileWave.Read(data, len) != len)
{
wxUint8 *data = new wxUint8[len];
if (fileWave.Read(data, len) != len)
{