summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-06-09 20:10:25 +0200
committerJan Ekström <jeebjp@gmail.com>2018-06-12 01:57:34 +0300
commitcd893626cbab0e55ca9f9a5ef384532e978fe702 (patch)
treea5c426bb96fefff83a1854cdbea6acaff1385ff4
parent2e7a4f717c27251e95f2f50612035dc080c874be (diff)
downloadmpv-cd893626cbab0e55ca9f9a5ef384532e978fe702.tar.bz2
mpv-cd893626cbab0e55ca9f9a5ef384532e978fe702.tar.xz
cocoa-cb: fix building with Swift 4.2coverity_scan
init is a reserved keyword and Swift 4.2 got a bit stricter about using it. this could be fixed by adding apostrophes around init but makes the code uglier. hence i just renamed init to initialized and for consistency uninit to uninitialized. Fixes #5899
-rw-r--r--video/out/cocoa-cb/video_layer.swift2
-rw-r--r--video/out/cocoa_cb_common.swift12
2 files changed, 7 insertions, 7 deletions
diff --git a/video/out/cocoa-cb/video_layer.swift b/video/out/cocoa-cb/video_layer.swift
index c600b06b6c..b3893273b1 100644
--- a/video/out/cocoa-cb/video_layer.swift
+++ b/video/out/cocoa-cb/video_layer.swift
@@ -89,7 +89,7 @@ class VideoLayer: CAOpenGLLayer {
if inLiveResize == false {
isAsynchronous = false
}
- return mpv != nil && cocoaCB.backendState == .init
+ return mpv != nil && cocoaCB.backendState == .initialized
}
override func draw(inCGLContext ctx: CGLContextObj,
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift
index e6705902c4..a4aae9ff2a 100644
--- a/video/out/cocoa_cb_common.swift
+++ b/video/out/cocoa_cb_common.swift
@@ -35,11 +35,11 @@ class CocoaCB: NSObject {
}
enum State {
- case uninit
+ case uninitialized
case needsInit
- case `init`
+ case initialized
}
- var backendState: State = .uninit
+ var backendState: State = .uninitialized
let eventsLock = NSLock()
var events: Int = 0
@@ -58,7 +58,7 @@ class CocoaCB: NSObject {
}
func preinit(_ vo: UnsafeMutablePointer<vo>) {
- if backendState == .uninit {
+ if backendState == .uninitialized {
backendState = .needsInit
if let app = NSApp as? Application {
@@ -122,7 +122,7 @@ class CocoaCB: NSObject {
window.isMovableByWindowBackground = true
}
- backendState = .init
+ backendState = .initialized
}
func updateWindowSize(_ vo: UnsafeMutablePointer<vo>) {
@@ -476,7 +476,7 @@ class CocoaCB: NSObject {
}
shutdown()
case MPV_EVENT_PROPERTY_CHANGE:
- if backendState == .init {
+ if backendState == .initialized {
handlePropertyChange(event)
}
default: