Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1633)

Unified Diff: media/midi/midi_manager_mac.cc

Issue 17617004: Fix MIDI code for 64 bit build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 32? Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager_mac.cc
diff --git a/media/midi/midi_manager_mac.cc b/media/midi/midi_manager_mac.cc
index 73df1fe022e5593f50463c8197952fb934841b67..fa4b3fd7e12bc5a99dff35e231aa4b6526df0a5f 100644
--- a/media/midi/midi_manager_mac.cc
+++ b/media/midi/midi_manager_mac.cc
@@ -16,6 +16,10 @@ using base::IntToString;
using base::SysCFStringRefToUTF8;
using std::string;
+// NB: System MIDI types are pointer types in 32-bit and integer types in
+// 64-bit. Therefore, the initialization is the simplest one that satisfies both
+// (if possible).
+
namespace media {
MIDIManager* MIDIManager::Create() {
@@ -23,9 +27,9 @@ MIDIManager* MIDIManager::Create() {
}
MIDIManagerMac::MIDIManagerMac()
- : midi_client_(NULL),
- coremidi_input_(NULL),
- coremidi_output_(NULL),
+ : midi_client_(0),
+ coremidi_input_(0),
+ coremidi_output_(0),
packet_list_(NULL),
midi_packet_(NULL) {
}
@@ -34,7 +38,7 @@ bool MIDIManagerMac::Initialize() {
TRACE_EVENT0("midi", "MIDIManagerMac::Initialize");
// CoreMIDI registration.
- midi_client_ = NULL;
+ midi_client_ = 0;
OSStatus result = MIDIClientCreate(
CFSTR("Google Chrome"),
NULL,
@@ -44,7 +48,7 @@ bool MIDIManagerMac::Initialize() {
if (result != noErr)
return false;
- coremidi_input_ = NULL;
+ coremidi_input_ = 0;
// Create input and output port.
result = MIDIInputPortCreate(
@@ -83,7 +87,7 @@ bool MIDIManagerMac::Initialize() {
for (int i = 0; i < source_count; ++i) {
// Receive from all sources.
MIDIEndpointRef src = MIDIGetSource(i);
- MIDIPortConnectSource(coremidi_input_, src, src);
+ MIDIPortConnectSource(coremidi_input_, src, reinterpret_cast<void*>(src));
// Keep track of all sources (known as inputs in Web MIDI API terminology).
source_map_[src] = i;
@@ -110,7 +114,11 @@ void MIDIManagerMac::ReadMidiDispatch(const MIDIPacketList* packet_list,
void* read_proc_refcon,
void* src_conn_refcon) {
MIDIManagerMac* manager = static_cast<MIDIManagerMac*>(read_proc_refcon);
+#if __LP64__
+ MIDIEndpointRef source = reinterpret_cast<uintptr_t>(src_conn_refcon);
+#else
MIDIEndpointRef source = static_cast<MIDIEndpointRef>(src_conn_refcon);
+#endif
// Dispatch to class method.
manager->ReadMidi(source, packet_list);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698