summaryrefslogtreecommitdiff
path: root/gr-audio/lib
diff options
context:
space:
mode:
authorMichael Dickens <mlk@alum.mit.edu>2014-06-26 19:36:13 -0400
committerTom Rondeau <tom@trondeau.com>2014-06-27 09:09:12 -0400
commit369839f6feb596e372c8047e8282f91a07a89fa3 (patch)
tree757f12335987a4945db311ae597fbc429c3bd708 /gr-audio/lib
parentd2031803f9849261b26da2e8e99112a2e0205977 (diff)
gr-audio OSX: fix casting of Int32 to char[] to a memcpy to make older GCC happy.
Diffstat (limited to 'gr-audio/lib')
-rw-r--r--gr-audio/lib/osx/osx_common.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/gr-audio/lib/osx/osx_common.h b/gr-audio/lib/osx/osx_common.h
index 34266f2c63..59b866dbe3 100644
--- a/gr-audio/lib/osx/osx_common.h
+++ b/gr-audio/lib/osx/osx_common.h
@@ -35,9 +35,9 @@ namespace osx {
#define check_error_and_throw(err,what,throw_str) \
if(err) { \
OSStatus error = static_cast<OSStatus>(err); \
- char err_str[5]; \
- *((UInt32*)err_str) = error; \
- err_str[4] = 0; \
+ char err_str[sizeof(OSStatus)+1]; \
+ memcpy((void*)(&err_str), (void*)(&error), sizeof(OSStatus)); \
+ err_str[sizeof(OSStatus)] = 0; \
GR_LOG_FATAL(d_logger, boost::format(what)); \
GR_LOG_FATAL(d_logger, boost::format(" Error# %u ('%s')") \
% error % err_str); \
@@ -49,9 +49,9 @@ namespace osx {
#define check_error(err,what) \
if(err) { \
OSStatus error = static_cast<OSStatus>(err); \
- char err_str[5]; \
- *((UInt32*)err_str) = error; \
- err_str[4] = 0; \
+ char err_str[sizeof(OSStatus)+1]; \
+ memcpy((void*)(&err_str), (void*)(&error), sizeof(OSStatus)); \
+ err_str[sizeof(OSStatus)] = 0; \
GR_LOG_WARN(d_logger, boost::format(what)); \
GR_LOG_WARN(d_logger, boost::format(" Error# %u ('%s')") \
% error % err_str); \