diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /platform/osx | |
parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/audio_driver_osx.cpp | 36 | ||||
-rw-r--r-- | platform/osx/audio_driver_osx.h | 16 | ||||
-rw-r--r-- | platform/osx/context_gl_osx.cpp | 42 | ||||
-rw-r--r-- | platform/osx/context_gl_osx.h | 4 | ||||
-rw-r--r-- | platform/osx/dir_access_osx.h | 13 | ||||
-rw-r--r-- | platform/osx/export/export.cpp | 11 | ||||
-rw-r--r-- | platform/osx/joypad_osx.cpp | 296 | ||||
-rw-r--r-- | platform/osx/joypad_osx.h | 4 | ||||
-rw-r--r-- | platform/osx/os_osx.h | 71 | ||||
-rw-r--r-- | platform/osx/power_osx.cpp | 66 | ||||
-rw-r--r-- | platform/osx/power_osx.h | 2 | ||||
-rw-r--r-- | platform/osx/sem_osx.cpp | 25 | ||||
-rw-r--r-- | platform/osx/sem_osx.h | 3 |
13 files changed, 273 insertions, 316 deletions
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp index 4ad3a5b8fc..7ef0669656 100644 --- a/platform/osx/audio_driver_osx.cpp +++ b/platform/osx/audio_driver_osx.cpp @@ -43,9 +43,9 @@ Error AudioDriverOSX::init() { strdesc.mFramesPerPacket = 1; strdesc.mBitsPerChannel = 16; strdesc.mBytesPerFrame = - strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8; + strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8; strdesc.mBytesPerPacket = - strdesc.mBytesPerFrame * strdesc.mFramesPerPacket; + strdesc.mBytesPerFrame * strdesc.mFramesPerPacket; OSStatus result = noErr; AURenderCallbackStruct callback; @@ -57,7 +57,7 @@ Error AudioDriverOSX::init() { zeromem(&desc, sizeof(desc)); desc.componentType = kAudioUnitType_Output; - desc.componentSubType = 0; /* !!! FIXME: ? */ + desc.componentSubType = 0; /* !!! FIXME: ? */ comp = AudioComponentFindNext(NULL, &desc); desc.componentManufacturer = kAudioUnitManufacturer_Apple; @@ -66,16 +66,16 @@ Error AudioDriverOSX::init() { ERR_FAIL_COND_V(comp == NULL, FAILED); result = AudioUnitSetProperty(audio_unit, - kAudioUnitProperty_StreamFormat, - scope, bus, &strdesc, sizeof(strdesc)); + kAudioUnitProperty_StreamFormat, + scope, bus, &strdesc, sizeof(strdesc)); ERR_FAIL_COND_V(result != noErr, FAILED); zeromem(&callback, sizeof(AURenderCallbackStruct)); callback.inputProc = &AudioDriverOSX::output_callback; callback.inputProcRefCon = this; result = AudioUnitSetProperty(audio_unit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, sizeof(callback)); + kAudioUnitProperty_SetRenderCallback, + scope, bus, &callback, sizeof(callback)); ERR_FAIL_COND_V(result != noErr, FAILED); result = AudioUnitInitialize(audio_unit); @@ -92,14 +92,13 @@ Error AudioDriverOSX::init() { }; OSStatus AudioDriverOSX::output_callback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData) { - + AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, UInt32 inNumberFrames, + AudioBufferList *ioData) { AudioBuffer *abuf; - AudioDriverOSX* ad = (AudioDriverOSX*)inRefCon; + AudioDriverOSX *ad = (AudioDriverOSX *)inRefCon; bool mix = true; @@ -109,7 +108,6 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon, mix = ad->mutex->try_lock() == OK; }; - if (!mix) { for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { abuf = &ioData->mBuffers[i]; @@ -124,7 +122,7 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon, abuf = &ioData->mBuffers[i]; frames_left = inNumberFrames; - int16_t* out = (int16_t*)abuf->mData; + int16_t *out = (int16_t *)abuf->mData; while (frames_left) { @@ -133,9 +131,9 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon, ad->audio_server_process(frames, ad->samples_in); //ad->unlock(); - for(int i = 0; i < frames * ad->channels; i++) { + for (int i = 0; i < frames * ad->channels; i++) { - out[i] = ad->samples_in[i]>>16; + out[i] = ad->samples_in[i] >> 16; } frames_left -= frames; @@ -180,10 +178,10 @@ void AudioDriverOSX::finish() { AudioDriverOSX::AudioDriverOSX() { - mutex=Mutex::create();//NULL; + mutex = Mutex::create(); //NULL; }; -AudioDriverOSX::~AudioDriverOSX() { +AudioDriverOSX::~AudioDriverOSX(){ }; diff --git a/platform/osx/audio_driver_osx.h b/platform/osx/audio_driver_osx.h index 9e9bb63726..b030570a6e 100644 --- a/platform/osx/audio_driver_osx.h +++ b/platform/osx/audio_driver_osx.h @@ -42,19 +42,17 @@ class AudioDriverOSX : public AudioDriver { Mutex *mutex; int channels; - int32_t* samples_in; - int buffer_frames; + int32_t *samples_in; + int buffer_frames; static OSStatus output_callback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData); - + AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, UInt32 inNumberFrames, + AudioBufferList *ioData); public: - - const char* get_name() const { + const char *get_name() const { return "AudioUnit"; }; diff --git a/platform/osx/context_gl_osx.cpp b/platform/osx/context_gl_osx.cpp index d0819bbfb6..0737e3d3c6 100644 --- a/platform/osx/context_gl_osx.cpp +++ b/platform/osx/context_gl_osx.cpp @@ -31,58 +31,58 @@ #ifdef OSX_ENABLED #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) #include <stdio.h> -#include <unistd.h> #include <stdlib.h> +#include <unistd.h> -#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 void ContextGL_OSX::release_current() { - aglSetCurrentContext( context ); + aglSetCurrentContext(context); } void ContextGL_OSX::make_current() { - aglSetCurrentContext( NULL ); + aglSetCurrentContext(NULL); } void ContextGL_OSX::swap_buffers() { - aglSwapBuffers( context ); + aglSwapBuffers(context); } Error ContextGL_OSX::initialize() { - if ( (Ptr) kUnresolvedCFragSymbolAddress == (Ptr) aglChoosePixelFormat ) + if ((Ptr)kUnresolvedCFragSymbolAddress == (Ptr)aglChoosePixelFormat) return FAILED; GLint attributes[] = { AGL_RGBA, - AGL_DOUBLEBUFFER, - AGL_DEPTH_SIZE, 32, - AGL_NO_RECOVERY, - AGL_NONE, - AGL_NONE }; + AGL_DOUBLEBUFFER, + AGL_DEPTH_SIZE, 32, + AGL_NO_RECOVERY, + AGL_NONE, + AGL_NONE }; AGLPixelFormat format = NULL; - format = aglChoosePixelFormat( NULL, 0, attributes ); + format = aglChoosePixelFormat(NULL, 0, attributes); - if ( !format ) + if (!format) return FAILED; - context = aglCreateContext( format, 0 ); + context = aglCreateContext(format, 0); - if ( !context ) + if (!context) return FAILED; - aglDestroyPixelFormat( format ); + aglDestroyPixelFormat(format); - aglSetWindowRef( context, window ); + aglSetWindowRef(context, window); GLint swapInterval = 1; - aglSetInteger( context, AGL_SWAP_INTERVAL, &swapInterval ); + aglSetInteger(context, AGL_SWAP_INTERVAL, &swapInterval); - aglSetCurrentContext( context ); + aglSetCurrentContext(context); return OK; } @@ -92,13 +92,11 @@ ContextGL_OSX::ContextGL_OSX(WindowRef p_window) { window = p_window; } - ContextGL_OSX::~ContextGL_OSX() { if (context) aglDestroyContext(context); } - #endif #endif diff --git a/platform/osx/context_gl_osx.h b/platform/osx/context_gl_osx.h index 6a02aa23d1..66da8b1ecf 100644 --- a/platform/osx/context_gl_osx.h +++ b/platform/osx/context_gl_osx.h @@ -36,8 +36,8 @@ #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) -#include "os/os.h" #include "drivers/gl_context/context_gl.h" +#include "os/os.h" #include <AGL/agl.h> #include <Carbon/Carbon.h> @@ -47,7 +47,6 @@ class ContextGL_OSX : public ContextGL { WindowRef window; public: - virtual void release_current(); virtual void make_current(); virtual void swap_buffers(); @@ -56,7 +55,6 @@ public: ContextGL_OSX(WindowRef window); ~ContextGL_OSX(); - }; #endif diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h index c30d380dd3..56a8e057dd 100644 --- a/platform/osx/dir_access_osx.h +++ b/platform/osx/dir_access_osx.h @@ -31,26 +31,21 @@ #if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED) -#include <sys/types.h> +#include <dirent.h> #include <sys/stat.h> +#include <sys/types.h> #include <unistd.h> -#include <dirent.h> -#include "os/dir_access.h" #include "drivers/unix/dir_access_unix.h" - +#include "os/dir_access.h" /** @author Juan Linietsky <reduzio@gmail.com> */ class DirAccessOSX : public DirAccessUnix { protected: - - virtual String fix_unicode_name(const char* p_name) const; - + virtual String fix_unicode_name(const char *p_name) const; }; - - #endif //UNIX ENABLED #endif diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 4af2aaca63..ba4ef0300c 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -26,19 +26,19 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "version.h" #include "export.h" -#include "editor/editor_settings.h" #include "editor/editor_export.h" #include "editor/editor_node.h" -#include "io/zip_io.h" +#include "editor/editor_settings.h" +#include "global_config.h" #include "io/marshalls.h" #include "io/resource_saver.h" -#include "global_config.h" +#include "io/zip_io.h" #include "os/file_access.h" #include "os/os.h" #include "platform/osx/logo.h" #include "string.h" +#include "version.h" #if 0 class EditorExportPlatformOSX : public EditorExportPlatform { @@ -543,7 +543,4 @@ void register_osx_exporter() { Ref<EditorExportPlatformOSX> exporter = Ref<EditorExportPlatformOSX>( memnew(EditorExportPlatformOSX) ); EditorImportExport::get_singleton()->add_export_platform(exporter); #endif - } - - diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 98bcc8dc73..c2b0e1f052 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -32,7 +32,7 @@ #define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoypad") -static JoypadOSX* self = NULL; +static JoypadOSX *self = NULL; joypad::joypad() { device_ref = NULL; @@ -83,7 +83,7 @@ int joypad::get_hid_element_state(rec_element *p_element) const { if (p_element && p_element->ref) { IOHIDValueRef valueRef; if (IOHIDDeviceGetValue(device_ref, p_element->ref, &valueRef) == kIOReturnSuccess) { - value = (SInt32) IOHIDValueGetIntegerValue(valueRef); + value = (SInt32)IOHIDValueGetIntegerValue(valueRef); /* record min and max for auto calibration */ if (value < p_element->min) { @@ -106,91 +106,89 @@ void joypad::add_hid_element(IOHIDElementRef p_element) { Vector<rec_element> *list = NULL; switch (IOHIDElementGetType(p_element)) { - case kIOHIDElementTypeInput_Misc: - case kIOHIDElementTypeInput_Button: - case kIOHIDElementTypeInput_Axis: { - switch (usagePage) { - case kHIDPage_GenericDesktop: - switch (usage) { - case kHIDUsage_GD_X: - case kHIDUsage_GD_Y: - case kHIDUsage_GD_Z: - case kHIDUsage_GD_Rx: - case kHIDUsage_GD_Ry: - case kHIDUsage_GD_Rz: - case kHIDUsage_GD_Slider: - case kHIDUsage_GD_Dial: - case kHIDUsage_GD_Wheel: - if (!has_element(cookie, &axis_elements)) { - list = &axis_elements; - } - break; - - case kHIDUsage_GD_Hatswitch: - if (!has_element(cookie, &hat_elements)) { - list = &hat_elements; - } - break; - case kHIDUsage_GD_DPadUp: - case kHIDUsage_GD_DPadDown: - case kHIDUsage_GD_DPadRight: - case kHIDUsage_GD_DPadLeft: - case kHIDUsage_GD_Start: - case kHIDUsage_GD_Select: - if (!has_element(cookie, &button_elements)) { - list = &button_elements; - } - break; + case kIOHIDElementTypeInput_Misc: + case kIOHIDElementTypeInput_Button: + case kIOHIDElementTypeInput_Axis: { + switch (usagePage) { + case kHIDPage_GenericDesktop: + switch (usage) { + case kHIDUsage_GD_X: + case kHIDUsage_GD_Y: + case kHIDUsage_GD_Z: + case kHIDUsage_GD_Rx: + case kHIDUsage_GD_Ry: + case kHIDUsage_GD_Rz: + case kHIDUsage_GD_Slider: + case kHIDUsage_GD_Dial: + case kHIDUsage_GD_Wheel: + if (!has_element(cookie, &axis_elements)) { + list = &axis_elements; + } + break; + + case kHIDUsage_GD_Hatswitch: + if (!has_element(cookie, &hat_elements)) { + list = &hat_elements; + } + break; + case kHIDUsage_GD_DPadUp: + case kHIDUsage_GD_DPadDown: + case kHIDUsage_GD_DPadRight: + case kHIDUsage_GD_DPadLeft: + case kHIDUsage_GD_Start: + case kHIDUsage_GD_Select: + if (!has_element(cookie, &button_elements)) { + list = &button_elements; + } + break; + } + break; + + case kHIDPage_Simulation: + switch (usage) { + case kHIDUsage_Sim_Rudder: + case kHIDUsage_Sim_Throttle: + if (!has_element(cookie, &axis_elements)) { + list = &axis_elements; + } + break; + + default: + break; + } + break; + + case kHIDPage_Button: + case kHIDPage_Consumer: + if (!has_element(cookie, &button_elements)) { + list = &button_elements; + } + break; + + default: + break; } - break; - - case kHIDPage_Simulation: - switch (usage) { - case kHIDUsage_Sim_Rudder: - case kHIDUsage_Sim_Throttle: - if (!has_element(cookie, &axis_elements)) { - list = &axis_elements; - } - break; - - default: - break; - } - break; + } break; - case kHIDPage_Button: - case kHIDPage_Consumer: - if (!has_element(cookie, &button_elements)) { - list = &button_elements; + case kIOHIDElementTypeCollection: { + CFArrayRef array = IOHIDElementGetChildren(p_element); + if (array) { + add_hid_elements(array); } - break; + } break; default: break; - } - } - break; - - case kIOHIDElementTypeCollection: { - CFArrayRef array = IOHIDElementGetChildren(p_element); - if (array) { - add_hid_elements(array); - } - } - break; - - default: - break; } - if (list) { /* add to list */ + if (list) { /* add to list */ rec_element element; element.ref = p_element; element.usage = usage; - element.min = (SInt32) IOHIDElementGetLogicalMin(p_element); - element.max = (SInt32) IOHIDElementGetLogicalMax(p_element); + element.min = (SInt32)IOHIDElementGetLogicalMin(p_element); + element.max = (SInt32)IOHIDElementGetLogicalMax(p_element); element.cookie = IOHIDElementGetCookie(p_element); list->push_back(element); list->sort_custom<rec_element::Comparator>(); @@ -199,21 +197,20 @@ void joypad::add_hid_element(IOHIDElementRef p_element) { } static void hid_element_added(const void *p_value, void *p_parameter) { - joypad *joy = (joypad*) p_parameter; - joy->add_hid_element((IOHIDElementRef) p_value); + joypad *joy = (joypad *)p_parameter; + joy->add_hid_element((IOHIDElementRef)p_value); } void joypad::add_hid_elements(CFArrayRef p_array) { CFRange range = { 0, CFArrayGetCount(p_array) }; - CFArrayApplyFunction(p_array, range,hid_element_added,this); + CFArrayApplyFunction(p_array, range, hid_element_added, this); } static void joypad_removed_callback(void *ctx, IOReturn result, void *sender) { - int id = (intptr_t) ctx; + int id = (intptr_t)ctx; self->_device_removed(id); } - static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) { self->_device_added(res, ioHIDDeviceObject); } @@ -224,7 +221,7 @@ static bool is_joypad(IOHIDDeviceRef p_device_ref) { int usage = 0; refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey)); if (refCF) { - CFNumberGetValue((CFNumberRef) refCF, kCFNumberSInt32Type, &usage_page); + CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &usage_page); } if (usage_page != kHIDPage_GenericDesktop) { return false; @@ -232,11 +229,11 @@ static bool is_joypad(IOHIDDeviceRef p_device_ref) { refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsageKey)); if (refCF) { - CFNumberGetValue((CFNumberRef) refCF, kCFNumberSInt32Type, &usage); + CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &usage); } if ((usage != kHIDUsage_GD_Joystick && - usage != kHIDUsage_GD_GamePad && - usage != kHIDUsage_GD_MultiAxisController)) { + usage != kHIDUsage_GD_GamePad && + usage != kHIDUsage_GD_MultiAxisController)) { return false; } return true; @@ -255,7 +252,7 @@ void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) { if (IOHIDDeviceGetService != NULL) { #endif const io_service_t ioservice = IOHIDDeviceGetService(p_device); - if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) { + if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) { new_joypad.ffservice = ioservice; } #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 @@ -263,7 +260,7 @@ void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) { #endif device_list.push_back(new_joypad); } - IOHIDDeviceRegisterRemovalCallback(p_device, joypad_removed_callback, (void*) (intptr_t) new_joypad.id); + IOHIDDeviceRegisterRemovalCallback(p_device, joypad_removed_callback, (void *)(intptr_t)new_joypad.id); IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE); } @@ -279,17 +276,17 @@ void JoypadOSX::_device_removed(int p_id) { static String _hex_str(uint8_t p_byte) { - static const char* dict = "0123456789abcdef"; + static const char *dict = "0123456789abcdef"; char ret[3]; ret[2] = 0; - ret[0] = dict[p_byte>>4]; + ret[0] = dict[p_byte >> 4]; ret[1] = dict[p_byte & 0xF]; return ret; } -bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) { +bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) { CFTypeRef refCF = NULL; @@ -301,7 +298,7 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) { if (!refCF) { refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey)); } - if ((!refCF) || (!CFStringGetCString((CFStringRef) refCF, c_name, sizeof (c_name), kCFStringEncodingUTF8))) { + if ((!refCF) || (!CFStringGetCString((CFStringRef)refCF, c_name, sizeof(c_name), kCFStringEncodingUTF8))) { name = "Unidentified Joypad"; } name = c_name; @@ -322,15 +319,16 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) { } if (vendor && product_id) { char uid[128]; - sprintf(uid, "%04x%08x%04x%08x", OSSwapHostToBigInt32(vendor),0, OSSwapHostToBigInt32(product_id), 0); + sprintf(uid, "%04x%08x%04x%08x", OSSwapHostToBigInt32(vendor), 0, OSSwapHostToBigInt32(product_id), 0); input->joy_connection_changed(id, true, name, uid); - } - else { + } else { //bluetooth device String guid = "05000000"; for (int i = 0; i < 12; i++) { - if (i < name.size()) guid += _hex_str(name[i]); - else guid += "00"; + if (i < name.size()) + guid += _hex_str(name[i]); + else + guid += "00"; } input->joy_connection_changed(id, true, name, guid); } @@ -344,7 +342,13 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) { return true; } -#define FF_ERR() { if (ret != FF_OK) { FFReleaseDevice(ff_device); return false; } } +#define FF_ERR() \ + { \ + if (ret != FF_OK) { \ + FFReleaseDevice(ff_device); \ + return false; \ + } \ + } bool joypad::config_force_feedback(io_service_t p_service) { HRESULT ret = FFCreateDevice(p_service, &ff_device); @@ -376,8 +380,8 @@ bool joypad::check_ff_features() { ret = FFDeviceGetForceFeedbackProperty(ff_device, FFPROP_FFGAIN, &val, sizeof(val)); if (ret != FF_OK) return false; int num_axes = features.numFfAxes; - ff_axes = (DWORD*) memalloc(sizeof(DWORD) * num_axes); - ff_directions = (LONG*) memalloc(sizeof(LONG) * num_axes); + ff_axes = (DWORD *)memalloc(sizeof(DWORD) * num_axes); + ff_directions = (LONG *)memalloc(sizeof(LONG) * num_axes); for (int i = 0; i < num_axes; i++) { ff_axes[i] = features.ffAxes[i]; @@ -401,39 +405,39 @@ static int process_hat_value(int p_min, int p_max, int p_value) { } switch (value) { - case 0: - hat_value = InputDefault::HAT_MASK_UP; - break; - case 1: - hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_RIGHT; - break; - case 2: - hat_value = InputDefault::HAT_MASK_RIGHT; - break; - case 3: - hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_RIGHT; - break; - case 4: - hat_value = InputDefault::HAT_MASK_DOWN; - break; - case 5: - hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_LEFT; - break; - case 6: - hat_value = InputDefault::HAT_MASK_LEFT; - break; - case 7: - hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_LEFT; - break; - default: - hat_value = InputDefault::HAT_MASK_CENTER; - break; + case 0: + hat_value = InputDefault::HAT_MASK_UP; + break; + case 1: + hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_RIGHT; + break; + case 2: + hat_value = InputDefault::HAT_MASK_RIGHT; + break; + case 3: + hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_RIGHT; + break; + case 4: + hat_value = InputDefault::HAT_MASK_DOWN; + break; + case 5: + hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_LEFT; + break; + case 6: + hat_value = InputDefault::HAT_MASK_LEFT; + break; + case 7: + hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_LEFT; + break; + default: + hat_value = InputDefault::HAT_MASK_CENTER; + break; } return hat_value; } void JoypadOSX::poll_joypads() const { - while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { + while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) { /* no-op. Pending callbacks will fire. */ } } @@ -443,18 +447,18 @@ static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_ma if (p_min < 0) { jx.min = -1; if (p_value < 0) { - jx.value = (float) -p_value / p_min; - } - else jx.value = (float) p_value / p_max; + jx.value = (float)-p_value / p_min; + } else + jx.value = (float)p_value / p_max; } if (p_min == 0) { jx.min = 0; - jx.value = 0.0f + (float) p_value / p_max; + jx.value = 0.0f + (float)p_value / p_max; } return jx; } -uint32_t JoypadOSX::process_joypads(uint32_t p_last_id){ +uint32_t JoypadOSX::process_joypads(uint32_t p_last_id) { poll_joypads(); for (int i = 0; i < device_list.size(); i++) { @@ -467,7 +471,7 @@ uint32_t JoypadOSX::process_joypads(uint32_t p_last_id){ } for (int j = 0; j < joy.button_elements.size(); j++) { int value = joy.get_hid_element_state(&joy.button_elements[j]); - p_last_id = input->joy_button(p_last_id, joy.id, j, (value>=1)); + p_last_id = input->joy_button(p_last_id, joy.id, j, (value >= 1)); } for (int j = 0; j < joy.hat_elements.size(); j++) { rec_element &elem = joy.hat_elements[j]; @@ -483,8 +487,7 @@ uint32_t JoypadOSX::process_joypads(uint32_t p_last_id){ float duration = input->get_joy_vibration_duration(joy.id); if (strength.x == 0 && strength.y == 0) { joypad_vibration_stop(joy.id, timestamp); - } - else { + } else { float gain = MAX(strength.x, strength.y); joypad_vibration_start(joy.id, gain, duration, timestamp); } @@ -504,7 +507,7 @@ void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_dura } void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) { - joypad* joy = &device_list[get_joy_index(p_id)]; + joypad *joy = &device_list[get_joy_index(p_id)]; joy->ff_timestamp = p_timestamp; FFEffectStop(joy->ff_object); } @@ -525,13 +528,12 @@ bool JoypadOSX::have_device(IOHIDDeviceRef p_device) const { return false; } -static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 usage, int *okay) -{ +static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 usage, int *okay) { CFDictionaryRef retval = NULL; CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); - const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) }; - const void *vals[2] = { (void *) pageNumRef, (void *) usageNumRef }; + const void *keys[2] = { (void *)CFSTR(kIOHIDDeviceUsagePageKey), (void *)CFSTR(kIOHIDDeviceUsageKey) }; + const void *vals[2] = { (void *)pageNumRef, (void *)usageNumRef }; if (pageNumRef && usageNumRef) { retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); @@ -561,28 +563,27 @@ void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const { IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, NULL); IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE); - while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { + while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) { /* no-op. Callback fires once per existing device. */ } } -JoypadOSX::JoypadOSX() -{ +JoypadOSX::JoypadOSX() { self = this; - input = (InputDefault*)Input::get_singleton(); + input = (InputDefault *)Input::get_singleton(); int okay = 1; const void *vals[] = { - (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay), - (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay), - (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay), + (void *)create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay), + (void *)create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay), + (void *)create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay), }; - const size_t n_elements = sizeof(vals)/sizeof(vals[0]); + const size_t n_elements = sizeof(vals) / sizeof(vals[0]); CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, n_elements, &kCFTypeArrayCallBacks) : NULL; for (int i = 0; i < n_elements; i++) { if (vals[i]) { - CFRelease((CFTypeRef) vals[i]); + CFRelease((CFTypeRef)vals[i]); } } @@ -606,4 +607,3 @@ JoypadOSX::~JoypadOSX() { CFRelease(hid_manager); hid_manager = NULL; } - diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h index 71a0335316..dabd1b8aec 100644 --- a/platform/osx/joypad_osx.h +++ b/platform/osx/joypad_osx.h @@ -34,9 +34,9 @@ #else #include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h> #endif -#include <IOKit/hid/IOHIDLib.h> #include <ForceFeedback/ForceFeedback.h> #include <ForceFeedback/ForceFeedbackConstants.h> +#include <IOKit/hid/IOHIDLib.h> #include "main/input_default.h" @@ -63,7 +63,7 @@ struct joypad { int id; - io_service_t ffservice; /* Interface for force feedback, 0 = no ff */ + io_service_t ffservice; /* Interface for force feedback, 0 = no ff */ FFCONSTANTFORCE ff_constant_force; FFDeviceObjectReference ff_device; FFEffectObjectReference ff_object; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 9941774b40..2c7ad09b89 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -29,22 +29,21 @@ #ifndef OS_OSX_H #define OS_OSX_H - -#include "os/input.h" -#include "joypad_osx.h" -#include "power_osx.h" #include "drivers/unix/os_unix.h" +#include "joypad_osx.h" #include "main/input_default.h" +#include "os/input.h" +#include "power_osx.h" #include "servers/visual_server.h" // #include "servers/visual/visual_server_wrap_mt.h" -#include "servers/visual/rasterizer.h" -#include "servers/physics_server.h" -#include "servers/audio_server.h" -#include "drivers/rtaudio/audio_driver_rtaudio.h" #include "drivers/alsa/audio_driver_alsa.h" +#include "drivers/rtaudio/audio_driver_rtaudio.h" +#include "platform/osx/audio_driver_osx.h" +#include "servers/audio_server.h" #include "servers/physics_2d/physics_2d_server_sw.h" #include "servers/physics_2d/physics_2d_server_wrap_mt.h" -#include "platform/osx/audio_driver_osx.h" +#include "servers/physics_server.h" +#include "servers/visual/rasterizer.h" #include <ApplicationServices/ApplicationServices.h> //bitch @@ -56,7 +55,7 @@ class OS_OSX : public OS_Unix { public: bool force_quit; -// rasterizer seems to no longer be given to visual server, its using GLES3 directly? + // rasterizer seems to no longer be given to visual server, its using GLES3 directly? //Rasterizer *rasterizer; VisualServer *visual_server; @@ -80,8 +79,8 @@ public: void process_events(); - void* framework; -// pthread_key_t current; + void *framework; + // pthread_key_t current; bool mouse_grab; Point2 mouse_pos; uint32_t last_id; @@ -108,60 +107,58 @@ public: Size2 window_size; int current_screen; Rect2 restore_rect; - + power_osx *power_manager; float _mouse_scale(float p_scale) { - if (display_scale>1.0) + if (display_scale > 1.0) return p_scale; else return 1.0; } float display_scale; -protected: +protected: virtual int get_video_driver_count() const; - virtual const char * get_video_driver_name(int p_driver) const; + virtual const char *get_video_driver_name(int p_driver) const; virtual VideoMode get_default_video_mode() const; virtual void initialize_core(); - virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); + virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); virtual void finalize(); - virtual void set_main_loop( MainLoop * p_main_loop ); + virtual void set_main_loop(MainLoop *p_main_loop); virtual void delete_main_loop(); public: - - - static OS_OSX* singleton; + static OS_OSX *singleton; void wm_minimized(bool p_minimized); virtual String get_name(); - virtual void alert(const String& p_alert, const String& p_title="ALERT!"); + virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); virtual void set_cursor_shape(CursorShape p_shape); virtual void set_mouse_show(bool p_show); virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; - virtual void warp_mouse_pos(const Point2& p_to); + virtual void warp_mouse_pos(const Point2 &p_to); virtual Point2 get_mouse_pos() const; virtual int get_mouse_button_state() const; - virtual void set_window_title(const String& p_title); + virtual void set_window_title(const String &p_title); virtual Size2 get_window_size() const; - virtual void set_icon(const Image& p_icon); + virtual void set_icon(const Image &p_icon); virtual MainLoop *get_main_loop() const; virtual bool can_draw() const; - virtual void set_clipboard(const String& p_text); + virtual void set_clipboard(const String &p_text); virtual String get_clipboard() const; virtual void release_rendering_thread(); @@ -169,13 +166,13 @@ public: virtual void swap_buffers(); Error shell_open(String p_uri); - void push_input(const InputEvent& p_event); + void push_input(const InputEvent &p_event); String get_locale() const; - virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); - virtual VideoMode get_video_mode(int p_screen=0) const; - virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const; + virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); + virtual VideoMode get_video_mode(int p_screen = 0) const; + virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; virtual String get_executable_path() const; @@ -186,12 +183,12 @@ public: virtual int get_screen_count() const; virtual int get_current_screen() const; virtual void set_current_screen(int p_screen); - virtual Point2 get_screen_position(int p_screen=0) const; - virtual Size2 get_screen_size(int p_screen=0) const; - virtual int get_screen_dpi(int p_screen=0) const; + virtual Point2 get_screen_position(int p_screen = 0) const; + virtual Size2 get_screen_size(int p_screen = 0) const; + virtual int get_screen_dpi(int p_screen = 0) const; virtual Point2 get_window_position() const; - virtual void set_window_position(const Point2& p_position); + virtual void set_window_position(const Point2 &p_position); virtual void set_window_size(const Size2 p_size); virtual void set_window_fullscreen(bool p_enabled); virtual bool is_window_fullscreen() const; @@ -203,15 +200,15 @@ public: virtual bool is_window_maximized() const; virtual void request_attention(); virtual String get_joy_guid(int p_device) const; - + virtual PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); void run(); - void set_mouse_mode(MouseMode p_mode); - MouseMode get_mouse_mode() const; + void set_mouse_mode(MouseMode p_mode); + MouseMode get_mouse_mode() const; OS_OSX(); }; diff --git a/platform/osx/power_osx.cpp b/platform/osx/power_osx.cpp index 5c8f067f24..de9bcaf6fc 100644 --- a/platform/osx/power_osx.cpp +++ b/platform/osx/power_osx.cpp @@ -29,20 +29,19 @@ #include "power_osx.h" #include <CoreFoundation/CoreFoundation.h> -#include <IOKit/ps/IOPowerSources.h> #include <IOKit/ps/IOPSKeys.h> +#include <IOKit/ps/IOPowerSources.h> // CODE CHUNK IMPORTED FROM SDL 2.0 /* CoreFoundation is so verbose... */ -#define STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo) -#define GETVAL(k,v) \ - CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v) +#define STRMATCH(a, b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo) +#define GETVAL(k, v) \ + CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **)v) /* Note that AC power sources also include a laptop battery it is charging. */ -void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery, bool * charging) -{ - CFStringRef strval; /* don't CFRelease() this. */ +void power_osx::checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery, bool *charging) { + CFStringRef strval; /* don't CFRelease() this. */ CFBooleanRef bval; CFNumberRef numval; bool charge = false; @@ -53,7 +52,7 @@ void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_batter int pct = -1; if ((GETVAL(kIOPSIsPresentKey, &bval)) && (bval == kCFBooleanFalse)) { - return; /* nothing to see here. */ + return; /* nothing to see here. */ } if (!GETVAL(kIOPSPowerSourceStateKey, &strval)) { @@ -63,7 +62,7 @@ void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_batter if (STRMATCH(strval, CFSTR(kIOPSACPowerValue))) { is_ac = *have_ac = true; } else if (!STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue))) { - return; /* not a battery? */ + return; /* not a battery? */ } if ((GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue)) { @@ -75,7 +74,7 @@ void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_batter CFNumberGetValue(numval, kCFNumberSInt32Type, &val); if (val > 0) { *have_battery = true; - maxpct = (int) val; + maxpct = (int)val; } } @@ -84,7 +83,7 @@ void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_batter CFNumberGetValue(numval, kCFNumberSInt32Type, &val); if (val > 0) { *have_battery = true; - maxpct = (int) val; + maxpct = (int)val; } } @@ -93,24 +92,24 @@ void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_batter CFNumberGetValue(numval, kCFNumberSInt32Type, &val); /* Mac OS X reports 0 minutes until empty if you're plugged in. :( */ - if ((val == 0) && (is_ac)) { - val = -1; /* !!! FIXME: calc from timeToFull and capacity? */ - } + if ((val == 0) && (is_ac)) { + val = -1; /* !!! FIXME: calc from timeToFull and capacity? */ + } - secs = (int) val; - if (secs > 0) { - secs *= 60; /* value is in minutes, so convert to seconds. */ - } + secs = (int)val; + if (secs > 0) { + secs *= 60; /* value is in minutes, so convert to seconds. */ + } } if (GETVAL(kIOPSCurrentCapacityKey, &numval)) { SInt32 val = -1; CFNumberGetValue(numval, kCFNumberSInt32Type, &val); - pct = (int) val; + pct = (int)val; } if ((pct > 0) && (maxpct > 0)) { - pct = (int) ((((double) pct) / ((double) maxpct)) * 100.0); + pct = (int)((((double)pct) / ((double)maxpct)) * 100.0); } if (pct > 100) { @@ -123,7 +122,7 @@ void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_batter */ if ((secs < 0) && (nsecs_left < 0)) { if ((pct < 0) && (percent_left < 0)) { - choose = true; /* at least we know there's a battery. */ + choose = true; /* at least we know there's a battery. */ } if (pct > percent_left) { choose = true; @@ -143,8 +142,7 @@ void power_osx::checkps(CFDictionaryRef dict, bool * have_ac, bool * have_batter #undef STRMATCH // CODE CHUNK IMPORTED FROM SDL 2.0 -bool power_osx::GetPowerInfo_MacOSX() -{ +bool power_osx::GetPowerInfo_MacOSX() { CFTypeRef blob = IOPSCopyPowerSourcesInfo(); nsecs_left = -1; @@ -161,7 +159,7 @@ bool power_osx::GetPowerInfo_MacOSX() const CFIndex total = CFArrayGetCount(list); CFIndex i; for (i = 0; i < total; i++) { - CFTypeRef ps = (CFTypeRef) CFArrayGetValueAtIndex(list, i); + CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i); CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps); if (dict != NULL) { checkps(dict, &have_ac, &have_battery, &charging); @@ -183,11 +181,9 @@ bool power_osx::GetPowerInfo_MacOSX() CFRelease(blob); } - return true; /* always the definitive answer on Mac OS X. */ + return true; /* always the definitive answer on Mac OS X. */ } - - bool power_osx::UpdatePowerInfo() { if (GetPowerInfo_MacOSX()) { return true; @@ -195,12 +191,10 @@ bool power_osx::UpdatePowerInfo() { return false; } - PowerState power_osx::get_power_state() { if (UpdatePowerInfo()) { return power_state; - } - else { + } else { return POWERSTATE_UNKNOWN; } } @@ -208,8 +202,7 @@ PowerState power_osx::get_power_state() { int power_osx::get_power_seconds_left() { if (UpdatePowerInfo()) { return nsecs_left; - } - else { + } else { return -1; } } @@ -217,17 +210,14 @@ int power_osx::get_power_seconds_left() { int power_osx::get_power_percent_left() { if (UpdatePowerInfo()) { return percent_left; - } - else { + } else { return -1; } } - -power_osx::power_osx() : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { - +power_osx::power_osx() + : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { } power_osx::~power_osx() { - } diff --git a/platform/osx/power_osx.h b/platform/osx/power_osx.h index a4aee31117..c638dc675a 100644 --- a/platform/osx/power_osx.h +++ b/platform/osx/power_osx.h @@ -41,7 +41,7 @@ private: int nsecs_left; int percent_left; PowerState power_state; - void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery, bool * charging); + void checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery, bool *charging); bool GetPowerInfo_MacOSX(/*PowerState * state, int *seconds, int *percent*/); bool UpdatePowerInfo(); diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp index ca710d8b1e..069e3a5153 100644 --- a/platform/osx/sem_osx.cpp +++ b/platform/osx/sem_osx.cpp @@ -28,11 +28,10 @@ /*************************************************************************/ #include "sem_osx.h" -#include <unistd.h> #include <fcntl.h> +#include <unistd.h> -void cgsem_init(cgsem_t *cgsem) -{ +void cgsem_init(cgsem_t *cgsem) { int flags, fd, i; pipe(cgsem->pipefd); @@ -47,31 +46,26 @@ void cgsem_init(cgsem_t *cgsem) } } -void cgsem_post(cgsem_t *cgsem) -{ +void cgsem_post(cgsem_t *cgsem) { const char buf = 1; write(cgsem->pipefd[1], &buf, 1); } -void cgsem_wait(cgsem_t *cgsem) -{ +void cgsem_wait(cgsem_t *cgsem) { char buf; read(cgsem->pipefd[0], &buf, 1); } -void cgsem_destroy(cgsem_t *cgsem) -{ +void cgsem_destroy(cgsem_t *cgsem) { close(cgsem->pipefd[1]); close(cgsem->pipefd[0]); } - #include "os/memory.h" #include <errno.h> - Error SemaphoreOSX::wait() { cgsem_wait(&sem); @@ -89,15 +83,14 @@ int SemaphoreOSX::get() const { return 0; } - Semaphore *SemaphoreOSX::create_semaphore_osx() { - return memnew( SemaphoreOSX ); + return memnew(SemaphoreOSX); } void SemaphoreOSX::make_default() { - create_func=create_semaphore_osx; + create_func = create_semaphore_osx; } SemaphoreOSX::SemaphoreOSX() { @@ -105,11 +98,7 @@ SemaphoreOSX::SemaphoreOSX() { cgsem_init(&sem); } - SemaphoreOSX::~SemaphoreOSX() { cgsem_destroy(&sem); } - - - diff --git a/platform/osx/sem_osx.h b/platform/osx/sem_osx.h index da2fac434c..a30f3fcc98 100644 --- a/platform/osx/sem_osx.h +++ b/platform/osx/sem_osx.h @@ -44,7 +44,6 @@ class SemaphoreOSX : public Semaphore { static Semaphore *create_semaphore_osx(); public: - virtual Error wait(); virtual Error post(); virtual int get() const; @@ -53,8 +52,6 @@ public: SemaphoreOSX(); ~SemaphoreOSX(); - }; - #endif |