Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreffs committed Oct 14, 2021
1 parent e1091c6 commit 8b785d8
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 23 deletions.
4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,14 @@ let renderingAPIDefines: [SwiftSetting] = {
return swiftSettings
}()


let swiftSettings: [SwiftSetting] = renderingAPIDefines + platformDefines


let package = Package(
name: "FirebladePAL",
platforms: [
.macOS(.v11),
.iOS(.v13),
.tvOS(.v13),
.tvOS(.v13)
],
products: [
.library(
Expand Down
2 changes: 1 addition & 1 deletion Sources/FirebladePAL/Keys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ extension KeyModifier: CustomDebugStringConvertible {
.metaRight: "metaRight",
.alternateGraphic: "alternateGraphic",
.capsLock: "capsLock",
.numLock: "numLock",
.numLock: "numLock"
]

public var debugDescription: String {
Expand Down
4 changes: 2 additions & 2 deletions Sources/FirebladePAL/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public enum Platform {
#if FRB_PLATFORM_APPL
case .apple:
break
// APPLPlatform.initialize()
// APPLPlatform.initialize()
#endif
}
}
Expand All @@ -64,7 +64,7 @@ public enum Platform {
#if FRB_PLATFORM_APPL
case .apple:
break
// APPLPlatform.quit()
// APPLPlatform.quit()
#endif
}
}
Expand Down
3 changes: 1 addition & 2 deletions Sources/FirebladePAL/Platform/Apple/APPLDisplayLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ final class APPLDisplayLinkMacOS {
_: UnsafePointer<CVTimeStamp>, // A pointer to the time that the frame will be displayed.
_: CVOptionFlags, // Currently unused. Pass 0.
_: UnsafeMutablePointer<CVOptionFlags>, // Currently unused. Pass 0.
_ displayLinkContext: UnsafeMutableRawPointer?) -> CVReturn
{
_ displayLinkContext: UnsafeMutableRawPointer?) -> CVReturn {
guard let context = displayLinkContext else {
assertionFailure("Display link context not set.")
return kCVReturnError
Expand Down
4 changes: 2 additions & 2 deletions Sources/FirebladePAL/Platform/Apple/APPLView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class APPLView: _APPLView {

/*
override func makeBackingLayer() -> CALayer {
CAMetalLayer.init()
CAMetalLayer.init()
}
*/
*/

required init?(coder _: NSCoder) { nil }

Expand Down
3 changes: 1 addition & 2 deletions Sources/FirebladePAL/Platform/Apple/APPLWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ final class APPLWindow: NSObject, WindowBase {
init(manager: APPLWindowManager,
viewController: APPLViewController,
properties _: WindowProperties,
nativeWindow: _APPLWindow? = nil)
{
nativeWindow: _APPLWindow? = nil) {
self.manager = manager
self._viewController = viewController
#if FRB_PLATFORM_APPL_MACOS
Expand Down
6 changes: 3 additions & 3 deletions Sources/FirebladePAL/Platform/SDL/SDLEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ final class SDLEvents: PlatformEvents {
SDLK_w: .W,
SDLK_x: .X,
SDLK_y: .Y,
SDLK_z: .Z,
SDLK_z: .Z
]

private static let physicalKeyMap: [SDL_Scancode: KeyCode] = [
Expand Down Expand Up @@ -780,15 +780,15 @@ final class SDLEvents: PlatformEvents {
SDL_SCANCODE_WWW: .WWW,
SDL_SCANCODE_X: .X,
SDL_SCANCODE_Y: .Y,
SDL_SCANCODE_Z: .Z,
SDL_SCANCODE_Z: .Z
]

static let pointerButtonMap: [Int32: PointerButton] = [
SDL_BUTTON_LEFT: .left,
SDL_BUTTON_MIDDLE: .middle,
SDL_BUTTON_RIGHT: .right,
SDL_BUTTON_X1: .other(4), // extra button 1 is mouse button 4
SDL_BUTTON_X2: .other(5), // extra button 2 is mouse button 5
SDL_BUTTON_X2: .other(5) // extra button 2 is mouse button 5
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ open class SDLVLKWindowSurface: SDLWindowSurface, VLKWindowSurfaceBase {

open class func createInstance(layers enabledLayerNames: [String] = [],
extensions enabledExtensionNames: [String] = []) throws -> VkInstance {

#if DEBUG
let enabledLayerNames = Set(enabledLayerNames) + ["VK_LAYER_KHRONOS_validation"]
#endif
Expand Down Expand Up @@ -128,8 +128,7 @@ open class SDLVLKWindowSurface: SDLWindowSurface, VLKWindowSurfaceBase {

extension Array where Element == String {
fileprivate init<I: FixedWidthInteger>(unsafeUninitializedCapacity count: I,
initializingWith closure: (_ buffer: UnsafeMutablePointer<UnsafePointer<CChar>?>, _ written: inout Int) throws -> Void) rethrows
{
initializingWith closure: (_ buffer: UnsafeMutablePointer<UnsafePointer<CChar>?>, _ written: inout Int) throws -> Void) rethrows {
let buffer = UnsafeMutablePointer<UnsafePointer<CChar>?>.allocate(capacity: Int(count))
defer {
buffer.deallocate()
Expand All @@ -155,8 +154,7 @@ extension Array where Element == String {
func translate(_ slice: inout Self.SubSequence,
_ offset: inout Int,
_ buffer: UnsafeMutableBufferPointer<UnsafePointer<CChar>?>,
_ body: (UnsafeBufferPointer<UnsafePointer<CChar>?>) throws -> R) rethrows -> R
{
_ body: (UnsafeBufferPointer<UnsafePointer<CChar>?>) throws -> R) rethrows -> R {
guard let string = slice.popFirst() else {
return try body(UnsafeBufferPointer(buffer))
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/FirebladePALTests/FirebladePALTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import XCTest
final class FirebladePALTests: XCTestCase {
func testPlatformSetup() throws {
Platform.initialize()

#if FRB_ENABLE_PLATFORM_SDL
XCTAssertEqual(Platform.implementation, .sdl)
#endif

#if FRB_ENABLE_PLATFORM_APPL
XCTAssertEqual(Platform.implementation, .apple)
#endif

Platform.quit()
}
}

0 comments on commit 8b785d8

Please sign in to comment.