summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp8
-rw-r--r--drivers/coremidi/midi_driver_coremidi.cpp2
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--drivers/unix/semaphore_posix.cpp2
-rw-r--r--drivers/unix/semaphore_posix.h2
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp2
-rw-r--r--editor/export_template_manager.cpp46
-rw-r--r--platform/iphone/gl_view.h2
-rw-r--r--platform/iphone/gl_view.mm36
-rw-r--r--platform/iphone/godot_iphone.cpp2
-rw-r--r--platform/iphone/in_app_store.mm2
-rw-r--r--platform/javascript/os_javascript.cpp2
-rw-r--r--platform/osx/camera_osx.mm8
-rw-r--r--platform/osx/crash_handler_osx.mm4
-rw-r--r--platform/osx/detect.py3
-rw-r--r--platform/osx/joypad_osx.cpp2
-rw-r--r--platform/osx/os_osx.h3
-rw-r--r--platform/osx/os_osx.mm16
-rw-r--r--platform/windows/os_windows.h3
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.cpp1
21 files changed, 53 insertions, 97 deletions
diff --git a/.travis.yml b/.travis.yml
index 8d1dd1ef90..49d1059360 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -74,7 +74,7 @@ matrix:
- name: macOS editor (debug, Clang)
stage: build
- env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang
+ env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang EXTRA_ARGS="warnings=extra werror=yes"
os: osx
compiler: clang
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 3b06c47244..9081fccd3a 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -186,15 +186,15 @@ OSStatus AudioDriverCoreAudio::output_callback(void *inRefCon,
for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
AudioBuffer *abuf = &ioData->mBuffers[i];
- int frames_left = inNumberFrames;
+ unsigned int frames_left = inNumberFrames;
int16_t *out = (int16_t *)abuf->mData;
while (frames_left) {
- int frames = MIN(frames_left, ad->buffer_frames);
+ unsigned int frames = MIN(frames_left, ad->buffer_frames);
ad->audio_server_process(frames, ad->samples_in.ptrw());
- for (int j = 0; j < frames * ad->channels; j++) {
+ for (unsigned int j = 0; j < frames * ad->channels; j++) {
out[j] = ad->samples_in[j] >> 16;
}
@@ -231,7 +231,7 @@ OSStatus AudioDriverCoreAudio::input_callback(void *inRefCon,
OSStatus result = AudioUnitRender(ad->input_unit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, &bufferList);
if (result == noErr) {
- for (int i = 0; i < inNumberFrames * ad->capture_channels; i++) {
+ for (unsigned int i = 0; i < inNumberFrames * ad->capture_channels; i++) {
int32_t sample = ad->input_buf[i] << 16;
ad->capture_buffer_write(sample);
diff --git a/drivers/coremidi/midi_driver_coremidi.cpp b/drivers/coremidi/midi_driver_coremidi.cpp
index 7a92ac0702..28665b5190 100644
--- a/drivers/coremidi/midi_driver_coremidi.cpp
+++ b/drivers/coremidi/midi_driver_coremidi.cpp
@@ -39,7 +39,7 @@
void MIDIDriverCoreMidi::read(const MIDIPacketList *packet_list, void *read_proc_ref_con, void *src_conn_ref_con) {
MIDIPacket *packet = const_cast<MIDIPacket *>(packet_list->packet);
- for (int i = 0; i < packet_list->numPackets; i++) {
+ for (UInt32 i = 0; i < packet_list->numPackets; i++) {
receive_input_packet(packet->timeStamp, packet->data, packet->length);
packet = MIDIPacketNext(packet);
}
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index b3d98a0648..25dee6aedb 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -126,7 +126,9 @@ void OS_Unix::initialize_core() {
RWLockDummy::make_default();
#else
ThreadPosix::make_default();
+#if !defined(OSX_ENABLED) && !defined(IPHONE_ENABLED)
SemaphorePosix::make_default();
+#endif
MutexPosix::make_default();
RWLockPosix::make_default();
#endif
diff --git a/drivers/unix/semaphore_posix.cpp b/drivers/unix/semaphore_posix.cpp
index 5aa51d77d1..fc2d5b0dfe 100644
--- a/drivers/unix/semaphore_posix.cpp
+++ b/drivers/unix/semaphore_posix.cpp
@@ -30,7 +30,7 @@
#include "semaphore_posix.h"
-#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
+#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(OSX_ENABLED) && !defined(IPHONE_ENABLED)
#include "core/os/memory.h"
#include <errno.h>
diff --git a/drivers/unix/semaphore_posix.h b/drivers/unix/semaphore_posix.h
index 83e75c9a82..8aff01fc27 100644
--- a/drivers/unix/semaphore_posix.h
+++ b/drivers/unix/semaphore_posix.h
@@ -33,7 +33,7 @@
#include "core/os/semaphore.h"
-#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
+#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(OSX_ENABLED) && !defined(IPHONE_ENABLED)
#include <semaphore.h>
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index adc3cc8d65..336d5c5814 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -76,7 +76,7 @@ public:
CMMNotificationClient() :
_cRef(1),
_pEnumerator(NULL) {}
- ~CMMNotificationClient() {
+ virtual ~CMMNotificationClient() {
if ((_pEnumerator) != NULL) {
(_pEnumerator)->Release();
(_pEnumerator) = NULL;
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 1cdf9848ef..95c615afa3 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -155,38 +155,27 @@ void ExportTemplateManager::_uninstall_template(const String &p_version) {
void ExportTemplateManager::_uninstall_template_confirm() {
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- Error err = d->change_dir(EditorSettings::get_singleton()->get_templates_dir());
-
- ERR_FAIL_COND(err != OK);
-
- err = d->change_dir(to_remove);
-
- ERR_FAIL_COND(err != OK);
-
- Vector<String> files;
- d->list_dir_begin();
- String c = d->get_next();
- while (c != String()) {
- if (!d->current_is_dir()) {
- files.push_back(c);
- }
- c = d->get_next();
- }
- d->list_dir_end();
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ const String &templates_dir = EditorSettings::get_singleton()->get_templates_dir();
+ Error err = da->change_dir(templates_dir);
+ ERR_FAIL_COND_MSG(err != OK, "Could not access templates directory at '" + templates_dir + "'.");
+ err = da->change_dir(to_remove);
+ ERR_FAIL_COND_MSG(err != OK, "Could not access templates directory at '" + templates_dir.plus_file(to_remove) + "'.");
- for (int i = 0; i < files.size(); i++) {
- d->remove(files[i]);
- }
+ err = da->erase_contents_recursive();
+ ERR_FAIL_COND_MSG(err != OK, "Could not remove all templates in '" + templates_dir.plus_file(to_remove) + "'.");
- d->change_dir("..");
- d->remove(to_remove);
+ da->change_dir("..");
+ da->remove(to_remove);
+ ERR_FAIL_COND_MSG(err != OK, "Could not remove templates directory at '" + templates_dir.plus_file(to_remove) + "'.");
_update_template_list();
}
bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_progress) {
+ // unzClose() will take care of closing the file stored in the unzFile,
+ // so we don't need to `memdelete(fa)` in this method.
FileAccess *fa = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&fa);
@@ -251,7 +240,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
String template_path = EditorSettings::get_singleton()->get_templates_dir().plus_file(version);
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ DirAccessRef d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Error err = d->make_dir_recursive(template_path);
if (err != OK) {
EditorNode::get_singleton()->show_warning(TTR("Error creating path for templates:") + "\n" + template_path);
@@ -259,8 +248,6 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
return false;
}
- memdelete(d);
-
ret = unzGoToFirstFile(pkg);
EditorProgress *p = NULL;
@@ -316,7 +303,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
}
String to_write = template_path.plus_file(file);
- FileAccess *f = FileAccess::open(to_write, FileAccess::WRITE);
+ FileAccessRef f = FileAccess::open(to_write, FileAccess::WRITE);
if (!f) {
ret = unzGoToNextFile(pkg);
@@ -326,8 +313,6 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
f->store_buffer(data.ptr(), data.size());
- memdelete(f);
-
#ifndef WINDOWS_ENABLED
FileAccess::set_unix_permissions(to_write, (info.external_fa >> 16) & 0x01FF);
#endif
@@ -343,7 +328,6 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
unzClose(pkg);
_update_template_list();
-
return true;
}
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index 4fb721f159..e3c9d212f0 100644
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -79,8 +79,6 @@
@property(strong, nonatomic) AVPlayer *avPlayer;
@property(strong, nonatomic) AVPlayerLayer *avPlayerLayer;
-// Old videoplayer properties
-@property(strong, nonatomic) MPMoviePlayerController *moviePlayerController;
@property(strong, nonatomic) UIWindow *backgroundWindow;
@property(nonatomic) UITextAutocorrectionType autocorrectionType;
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index dfca2e3dd7..2ac158e6d3 100644
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -729,40 +729,4 @@ static void clear_touches() {
_stop_video();
}
-/*
-- (void)moviePlayBackDidFinish:(NSNotification*)notification {
-
-
- NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
- switch ([reason intValue]) {
- case MPMovieFinishReasonPlaybackEnded:
- //NSLog(@"Playback Ended");
- break;
- case MPMovieFinishReasonPlaybackError:
- //NSLog(@"Playback Error");
- video_found_error = true;
- break;
- case MPMovieFinishReasonUserExited:
- //NSLog(@"User Exited");
- video_found_error = true;
- break;
- default:
- //NSLog(@"Unsupported reason!");
- break;
- }
-
- MPMoviePlayerController *player = [notification object];
-
- [[NSNotificationCenter defaultCenter]
- removeObserver:self
- name:MPMoviePlayerPlaybackDidFinishNotification
- object:player];
-
- [_instance.moviePlayerController stop];
- [_instance.moviePlayerController.view removeFromSuperview];
-
- video_playing = false;
-}
-*/
-
@end
diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index db93db5021..992da2818b 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.cpp
@@ -47,7 +47,7 @@ int iphone_main(int, int, int, char **, String);
int iphone_main(int width, int height, int argc, char **argv, String data_dir) {
- int len = strlen(argv[0]);
+ size_t len = strlen(argv[0]);
while (len--) {
if (argv[0][len] == '/') break;
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 490e84c571..8eef430621 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -92,7 +92,7 @@ void InAppStore::_bind_methods() {
PoolStringArray localized_prices;
PoolStringArray currency_codes;
- for (int i = 0; i < [products count]; i++) {
+ for (NSUInteger i = 0; i < [products count]; i++) {
SKProduct *product = [products objectAtIndex:i];
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index b0661cb4dd..652f6a1ce1 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -837,7 +837,7 @@ void OS_JavaScript::set_clipboard(const String &p_text) {
var text = UTF8ToString($0);
if (!navigator.clipboard || !navigator.clipboard.writeText)
return 1;
- navigator.clipboard.writeText(text).catch(e => {
+ navigator.clipboard.writeText(text).catch(function(e) {
// Setting OS clipboard is only possible from an input callback.
console.error("Setting OS clipboard is only possible from an input callback for the HTML5 plafrom. Exception:", e);
});
diff --git a/platform/osx/camera_osx.mm b/platform/osx/camera_osx.mm
index f13cf76beb..af09eec2eb 100644
--- a/platform/osx/camera_osx.mm
+++ b/platform/osx/camera_osx.mm
@@ -150,8 +150,8 @@
{
// do Y
- int new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 0);
- int new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 0);
+ size_t new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 0);
+ size_t new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 0);
if ((width[0] != new_width) || (height[0] != new_height)) {
width[0] = new_width;
@@ -168,8 +168,8 @@
{
// do CbCr
- int new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 1);
- int new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 1);
+ size_t new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 1);
+ size_t new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 1);
if ((width[1] != new_width) || (height[1] != new_height)) {
width[1] = new_width;
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index e19fdf1b9f..015859b3c0 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -95,7 +95,7 @@ static void handle_crash(int sig) {
if (strings) {
void *load_addr = (void *)load_address();
- for (int i = 1; i < size; i++) {
+ for (size_t i = 1; i < size; i++) {
char fname[1024];
Dl_info info;
@@ -142,7 +142,7 @@ static void handle_crash(int sig) {
}
}
- fprintf(stderr, "[%d] %ls\n", i, output.c_str());
+ fprintf(stderr, "[%zu] %ls\n", i, output.c_str());
}
free(strings);
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 881ed05025..7882253e7a 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -91,6 +91,9 @@ def configure(env):
env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib"
env['AS'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-as"
env.Append(CPPDEFINES=['__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define
+ else:
+ env['CC'] = 'clang'
+ env['CXX'] = 'clang++'
detect_darwin_sdk_path('osx', env)
env.Append(CCFLAGS=['-isysroot', '$MACOS_SDK_PATH'])
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index fa124dac11..4edf347f61 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -578,7 +578,7 @@ JoypadOSX::JoypadOSX() {
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++) {
+ for (size_t i = 0; i < n_elements; i++) {
if (vals[i]) {
CFRelease((CFTypeRef)vals[i]);
}
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index f1f37e24d2..09a871f26c 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -31,6 +31,8 @@
#ifndef OS_OSX_H
#define OS_OSX_H
+#define BitMap _QDBitMap // Suppress deprecated QuickDraw definition.
+
#include "camera_osx.h"
#include "core/os/input.h"
#include "crash_handler_osx.h"
@@ -50,6 +52,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <CoreVideo/CoreVideo.h>
+#undef BitMap
#undef CursorShape
class OS_OSX : public OS_Unix {
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 51ae264cf7..15885e1266 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -620,7 +620,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
Vector<String> files;
- for (int i = 0; i < filenames.count; i++) {
+ for (NSUInteger i = 0; i < filenames.count; i++) {
NSString *ns = [filenames objectAtIndex:i];
char *utfs = strdup([ns UTF8String]);
String ret;
@@ -1502,7 +1502,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
[window_object setContentView:window_view];
[window_object setDelegate:window_delegate];
[window_object setAcceptsMouseMovedEvents:YES];
- [window_object center];
+ [(NSWindow *)window_object center];
[window_object setRestorable:NO];
@@ -2338,12 +2338,12 @@ void OS_OSX::set_current_screen(int p_screen) {
};
Point2 OS_OSX::get_native_screen_position(int p_screen) const {
- if (p_screen == -1) {
+ if (p_screen < 0) {
p_screen = get_current_screen();
}
NSArray *screenArray = [NSScreen screens];
- if (p_screen < [screenArray count]) {
+ if ((NSUInteger)p_screen < [screenArray count]) {
float display_scale = _display_scale([screenArray objectAtIndex:p_screen]);
NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame];
// Return the top-left corner of the screen, for OS X the y starts at the bottom
@@ -2362,12 +2362,12 @@ Point2 OS_OSX::get_screen_position(int p_screen) const {
}
int OS_OSX::get_screen_dpi(int p_screen) const {
- if (p_screen == -1) {
+ if (p_screen < 0) {
p_screen = get_current_screen();
}
NSArray *screenArray = [NSScreen screens];
- if (p_screen < [screenArray count]) {
+ if ((NSUInteger)p_screen < [screenArray count]) {
float displayScale = _display_scale([screenArray objectAtIndex:p_screen]);
NSDictionary *description = [[screenArray objectAtIndex:p_screen] deviceDescription];
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
@@ -2381,12 +2381,12 @@ int OS_OSX::get_screen_dpi(int p_screen) const {
}
Size2 OS_OSX::get_screen_size(int p_screen) const {
- if (p_screen == -1) {
+ if (p_screen < 0) {
p_screen = get_current_screen();
}
NSArray *screenArray = [NSScreen screens];
- if (p_screen < [screenArray count]) {
+ if ((NSUInteger)p_screen < [screenArray count]) {
float displayScale = _display_scale([screenArray objectAtIndex:p_screen]);
// Note: Use frame to get the whole screen size
NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame];
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 915d025e3b..683896886b 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -81,7 +81,9 @@ class OS_Windows : public OS {
KEY_EVENT_BUFFER_SIZE = 512
};
+#ifdef STDOUT_FILE
FILE *stdo;
+#endif
struct KeyEvent {
@@ -107,7 +109,6 @@ class OS_Windows : public OS {
VisualServer *visual_server;
CameraWindows *camera_server;
int pressrc;
- HDC hDC; // Private GDI Device Context
HINSTANCE hInstance; // Holds The Instance Of The Application
HWND hWnd;
Point2 last_pos;
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_2d_server_wrap_mt.cpp
index c698290fd9..9fc15d9660 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.cpp
@@ -139,6 +139,7 @@ void Physics2DServerWrapMT::finish() {
segment_shape_free_cached_ids();
circle_shape_free_cached_ids();
rectangle_shape_free_cached_ids();
+ capsule_shape_free_cached_ids();
convex_polygon_shape_free_cached_ids();
concave_polygon_shape_free_cached_ids();