Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed compile errors on Ubuntu Linux - Swift 4.2 #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Sources/Models/DateAndTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,9 @@ class DateNSDateConverter {

let date = FHIRDate(year: comp.year!, month: UInt8(comp.month!), day: UInt8(comp.day!))
let zone = comp.timeZone ?? utc
let secs = Double(comp.second!) + (Double(comp.nanosecond!) / 1000000000)
let secs = Double(comp.second!)
// on Ubuntu Linux - Swift 4 - comp.nanosecond is null
// + (Double(comp.nanosecond!) / 1000000000)
let time = FHIRTime(hour: UInt8(comp.hour!), minute: UInt8(comp.minute!), second: secs)

return (date, time, zone)
Expand Down Expand Up @@ -960,15 +962,17 @@ extension Scanner {

public var fhir_isAtEnd: Bool {
#if os(Linux)
return atEnd
return isAtEnd
#else
return isAtEnd
#endif
}

public func fhir_scanString(_ searchString: String) -> String? {
#if os(Linux)
return scanString(string: searchString)
var buffer: String?
_ = scanString(searchString, into: &buffer)
return buffer
#else
var str: NSString?
if scanString(searchString, into: &str) {
Expand All @@ -993,7 +997,7 @@ extension Scanner {
public func fhir_scanInt() -> Int? {
var int = 0
#if os(Linux)
let flag = scanInteger(&int)
let flag = scanInt(&int)
#else
let flag = scanInt(&int)
#endif
Expand Down