commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 04/08: audio osx: change copying of a UInt3


From: git
Subject: [Commit-gnuradio] [gnuradio] 04/08: audio osx: change copying of a UInt32 type into a string by using memcpy instead of a direct pointer manipulation, to make some newer compilers happy.
Date: Tue, 31 Mar 2015 20:37:40 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch maint
in repository gnuradio.

commit 693fccf63657ccdb00f4e1fe33aa2a60f12244cd
Author: Michael Dickens <address@hidden>
Date:   Wed Mar 18 12:53:43 2015 -0400

    audio osx: change copying of a UInt32 type into a string by using memcpy 
instead of a direct pointer manipulation, to make some newer compilers happy.
---
 gr-audio/lib/osx/osx_impl.cc | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/gr-audio/lib/osx/osx_impl.cc b/gr-audio/lib/osx/osx_impl.cc
index c4e580b..92a2c24 100644
--- a/gr-audio/lib/osx/osx_impl.cc
+++ b/gr-audio/lib/osx/osx_impl.cc
@@ -42,9 +42,9 @@ operator<<
 (std::ostream& s,
  const AudioStreamBasicDescription& asbd)
 {
-  char format_id[5];
-  *((UInt32*)format_id) = asbd.mFormatID;
-  format_id[4] = 0;
+  char format_id[sizeof(asbd.mFormatID)+1];
+  memcpy((void*)(&asbd.mFormatID), format_id, sizeof(asbd.mFormatID));
+  format_id[sizeof(asbd.mFormatID)] = 0;
   s << "  Sample Rate      : " << asbd.mSampleRate << std::endl;
   s << "  Format ID        : " << format_id << std::endl;
   s << "  Format Flags     : " << asbd.mFormatFlags << std::endl;
@@ -166,10 +166,6 @@ find_audio_devices
 
   OSStatus err = noErr;
 
-  // set the default audio device id to "unknown"
-
-  AudioDeviceID d_ad_id = kAudioDeviceUnknown;
-
   // retrieve the size of the array of known audio device IDs
 
   UInt32 prop_size = 0;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]