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

Fix Xcode 8.3 compiler warnings #2279

Merged
merged 1 commit into from
Mar 28, 2017
Merged
Show file tree
Hide file tree
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
20 changes: 10 additions & 10 deletions Source/Charts/Animation/ChartAnimationEasing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,17 @@ internal struct EasingFunctions

internal static let EaseInSine = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
var position: TimeInterval = elapsed / duration
return Double( -cos(position * M_PI_2) + 1.0 )
return Double( -cos(position * Double.pi / 2) + 1.0 )
}

internal static let EaseOutSine = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
var position: TimeInterval = elapsed / duration
return Double( sin(position * M_PI_2) )
return Double( sin(position * Double.pi / 2) )
}

internal static let EaseInOutSine = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
var position: TimeInterval = elapsed / duration
return Double( -0.5 * (cos(M_PI * position) - 1.0) )
return Double( -0.5 * (cos(Double.pi * position) - 1.0) )
}

internal static let EaseInExpo = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
Expand Down Expand Up @@ -286,9 +286,9 @@ internal struct EasingFunctions
}

var p = duration * 0.3
var s = p / (2.0 * M_PI) * asin(1.0)
var s = p / (2.0 * Double.pi) * asin(1.0)
position -= 1.0
return Double( -(pow(2.0, 10.0 * position) * sin((position * duration - s) * (2.0 * M_PI) / p)) )
return Double( -(pow(2.0, 10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p)) )
}

internal static let EaseOutElastic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
Expand All @@ -304,8 +304,8 @@ internal struct EasingFunctions
}

var p = duration * 0.3
var s = p / (2.0 * M_PI) * asin(1.0)
return Double( pow(2.0, -10.0 * position) * sin((position * duration - s) * (2.0 * M_PI) / p) + 1.0 )
var s = p / (2.0 * Double.pi) * asin(1.0)
return Double( pow(2.0, -10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p) + 1.0 )
}

internal static let EaseInOutElastic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
Expand All @@ -321,14 +321,14 @@ internal struct EasingFunctions
}

var p = duration * (0.3 * 1.5)
var s = p / (2.0 * M_PI) * asin(1.0)
var s = p / (2.0 * Double.pi) * asin(1.0)
if position < 1.0
{
position -= 1.0
return Double( -0.5 * (pow(2.0, 10.0 * position) * sin((position * duration - s) * (2.0 * M_PI) / p)) )
return Double( -0.5 * (pow(2.0, 10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p)) )
}
position -= 1.0
return Double( pow(2.0, -10.0 * position) * sin((position * duration - s) * (2.0 * M_PI) / p) * 0.5 + 1.0 )
return Double( pow(2.0, -10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p) * 0.5 + 1.0 )
}

internal static let EaseInBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
Expand Down
40 changes: 20 additions & 20 deletions Source/Charts/Data/Implementations/Standard/ChartData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import Foundation

open class ChartData: NSObject
{
internal var _yMax: Double = -DBL_MAX
internal var _yMin: Double = DBL_MAX
internal var _xMax: Double = -DBL_MAX
internal var _xMin: Double = DBL_MAX
internal var _leftAxisMax: Double = -DBL_MAX
internal var _leftAxisMin: Double = DBL_MAX
internal var _rightAxisMax: Double = -DBL_MAX
internal var _rightAxisMin: Double = DBL_MAX
internal var _yMax: Double = -Double.greatestFiniteMagnitude
internal var _yMin: Double = Double.greatestFiniteMagnitude
internal var _xMax: Double = -Double.greatestFiniteMagnitude
internal var _xMin: Double = Double.greatestFiniteMagnitude
internal var _leftAxisMax: Double = -Double.greatestFiniteMagnitude
internal var _leftAxisMin: Double = Double.greatestFiniteMagnitude
internal var _rightAxisMax: Double = -Double.greatestFiniteMagnitude
internal var _rightAxisMin: Double = Double.greatestFiniteMagnitude

internal var _dataSets = [IChartDataSet]()

Expand Down Expand Up @@ -71,20 +71,20 @@ open class ChartData: NSObject
/// calc minimum and maximum y value over all datasets
open func calcMinMax()
{
_yMax = -DBL_MAX
_yMin = DBL_MAX
_xMax = -DBL_MAX
_xMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude
_xMax = -Double.greatestFiniteMagnitude
_xMin = Double.greatestFiniteMagnitude

for set in _dataSets
{
calcMinMax(dataSet: set)
}

_leftAxisMax = -DBL_MAX
_leftAxisMin = DBL_MAX
_rightAxisMax = -DBL_MAX
_rightAxisMin = DBL_MAX
_leftAxisMax = -Double.greatestFiniteMagnitude
_leftAxisMin = Double.greatestFiniteMagnitude
_rightAxisMax = -Double.greatestFiniteMagnitude
_rightAxisMin = Double.greatestFiniteMagnitude

// left axis
let firstLeft = getFirstLeft(dataSets: dataSets)
Expand Down Expand Up @@ -257,7 +257,7 @@ open class ChartData: NSObject
{
if axis == .left
{
if _leftAxisMin == DBL_MAX
if _leftAxisMin == Double.greatestFiniteMagnitude
{
return _rightAxisMin
}
Expand All @@ -268,7 +268,7 @@ open class ChartData: NSObject
}
else
{
if _rightAxisMin == DBL_MAX
if _rightAxisMin == Double.greatestFiniteMagnitude
{
return _leftAxisMin
}
Expand All @@ -295,7 +295,7 @@ open class ChartData: NSObject
{
if axis == .left
{
if _leftAxisMax == -DBL_MAX
if _leftAxisMax == -Double.greatestFiniteMagnitude
{
return _rightAxisMax
}
Expand All @@ -306,7 +306,7 @@ open class ChartData: NSObject
}
else
{
if _rightAxisMax == -DBL_MAX
if _rightAxisMax == -Double.greatestFiniteMagnitude
{
return _leftAxisMax
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ open class ChartDataEntry: ChartDataEntryBase
return false
}

if fabs((object! as AnyObject).x - x) > DBL_EPSILON
if fabs((object! as AnyObject).x - x) > Double.ulpOfOne
{
return false
}
Expand Down Expand Up @@ -125,12 +125,12 @@ public func ==(lhs: ChartDataEntry, rhs: ChartDataEntry) -> Bool
return false
}

if fabs(lhs.x - rhs.x) > DBL_EPSILON
if fabs(lhs.x - rhs.x) > Double.ulpOfOne
{
return false
}

if fabs(lhs.y - rhs.y) > DBL_EPSILON
if fabs(lhs.y - rhs.y) > Double.ulpOfOne
{
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ open class ChartDataEntryBase: NSObject
return false
}

if fabs((object! as AnyObject).y - y) > DBL_EPSILON
if fabs((object! as AnyObject).y - y) > Double.ulpOfOne
{
return false
}
Expand Down Expand Up @@ -123,7 +123,7 @@ public func ==(lhs: ChartDataEntryBase, rhs: ChartDataEntryBase) -> Bool
return false
}

if fabs(lhs.y - rhs.y) > DBL_EPSILON
if fabs(lhs.y - rhs.y) > Double.ulpOfOne
{
return false
}
Expand Down
20 changes: 10 additions & 10 deletions Source/Charts/Data/Implementations/Standard/ChartDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ open class ChartDataSet: ChartBaseDataSet
internal var _values: [ChartDataEntry]!

/// maximum y-value in the value array
internal var _yMax: Double = -DBL_MAX
internal var _yMax: Double = -Double.greatestFiniteMagnitude

/// minimum y-value in the value array
internal var _yMin: Double = DBL_MAX
internal var _yMin: Double = Double.greatestFiniteMagnitude

/// maximum x-value in the value array
internal var _xMax: Double = -DBL_MAX
internal var _xMax: Double = -Double.greatestFiniteMagnitude

/// minimum x-value in the value array
internal var _xMin: Double = DBL_MAX
internal var _xMin: Double = Double.greatestFiniteMagnitude

/// *
/// - note: Calls `notifyDataSetChanged()` after setting a new value.
Expand Down Expand Up @@ -98,10 +98,10 @@ open class ChartDataSet: ChartBaseDataSet
return
}

_yMax = -DBL_MAX
_yMin = DBL_MAX
_xMax = -DBL_MAX
_xMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude
_xMax = -Double.greatestFiniteMagnitude
_xMin = Double.greatestFiniteMagnitude

for e in _values
{
Expand All @@ -116,8 +116,8 @@ open class ChartDataSet: ChartBaseDataSet
return
}

_yMax = -DBL_MAX
_yMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude

let indexFrom = entryIndex(x: fromX, closestToY: Double.nan, rounding: .down)
let indexTo = entryIndex(x: toX, closestToY: Double.nan, rounding: .up)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ open class CombinedChartData: BarLineScatterCandleBubbleChartData
{
_dataSets.removeAll()

_yMax = -DBL_MAX
_yMin = DBL_MAX
_xMax = -DBL_MAX
_xMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude
_xMax = -Double.greatestFiniteMagnitude
_xMin = Double.greatestFiniteMagnitude

_leftAxisMax = -DBL_MAX
_leftAxisMin = DBL_MAX
_rightAxisMax = -DBL_MAX
_rightAxisMin = DBL_MAX
_leftAxisMax = -Double.greatestFiniteMagnitude
_leftAxisMin = Double.greatestFiniteMagnitude
_rightAxisMax = -Double.greatestFiniteMagnitude
_rightAxisMin = Double.greatestFiniteMagnitude

let allData = self.allData

Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Highlight/RadarHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class RadarHighlighter: PieRadarHighlighter
let distanceToCenter = Double(chart.distanceToCenter(x: x, y: y) / chart.factor)

var closest: Highlight? = nil
var distance = DBL_MAX
var distance = Double.greatestFiniteMagnitude

for high in highlights
{
Expand Down
6 changes: 3 additions & 3 deletions Source/Charts/Renderers/PieChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ open class PieChartRenderer: DataRenderer
for j in 0 ..< entryCount
{
guard let e = dataSet.entryForIndex(j) else { continue }
if ((abs(e.y) > DBL_EPSILON))
if ((abs(e.y) > Double.ulpOfOne))
{
visibleAngleCount += 1
}
Expand All @@ -148,7 +148,7 @@ open class PieChartRenderer: DataRenderer
guard let e = dataSet.entryForIndex(j) else { continue }

// draw only if the value is greater than zero
if (abs(e.y) > DBL_EPSILON)
if (abs(e.y) > Double.ulpOfOne)
{
if !chart.needsHighlight(index: j)
{
Expand Down Expand Up @@ -708,7 +708,7 @@ open class PieChartRenderer: DataRenderer
for j in 0 ..< entryCount
{
guard let e = set.entryForIndex(j) else { continue }
if ((abs(e.y) > DBL_EPSILON))
if ((abs(e.y) > Double.ulpOfOne))
{
visibleAngleCount += 1
}
Expand Down
10 changes: 5 additions & 5 deletions Source/Charts/Utils/ChartUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ open class ChartUtils

internal struct Math
{
internal static let FDEG2RAD = CGFloat(M_PI / 180.0)
internal static let FRAD2DEG = CGFloat(180.0 / M_PI)
internal static let DEG2RAD = M_PI / 180.0
internal static let RAD2DEG = 180.0 / M_PI
internal static let FDEG2RAD = CGFloat(Double.pi / 180.0)
internal static let FRAD2DEG = CGFloat(180.0 / Double.pi)
internal static let DEG2RAD = Double.pi / 180.0
internal static let RAD2DEG = 180.0 / Double.pi
}

internal class func roundToNextSignificant(number: Double) -> Double
Expand Down Expand Up @@ -67,7 +67,7 @@ open class ChartUtils
}
else
{
return number + DBL_EPSILON
return number + Double.ulpOfOne
}
}

Expand Down
8 changes: 4 additions & 4 deletions Source/ChartsRealm/Data/RealmBarDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ open class RealmBarDataSet: RealmBarLineScatterCandleBubbleDataSet, IBarChartDat
return
}

_yMax = -DBL_MAX
_yMin = DBL_MAX
_xMax = -DBL_MAX
_xMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude
_xMax = -Double.greatestFiniteMagnitude
_xMin = Double.greatestFiniteMagnitude

for e in _cache as! [BarChartDataEntry]
{
Expand Down
16 changes: 8 additions & 8 deletions Source/ChartsRealm/Data/RealmBaseDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ open class RealmBaseDataSet: ChartBaseDataSet
internal var _xValueField: String?
internal var _cache = [ChartDataEntry]()

internal var _yMax: Double = -DBL_MAX
internal var _yMin: Double = DBL_MAX
internal var _yMax: Double = -Double.greatestFiniteMagnitude
internal var _yMin: Double = Double.greatestFiniteMagnitude

internal var _xMax: Double = -DBL_MAX
internal var _xMin: Double = DBL_MAX
internal var _xMax: Double = -Double.greatestFiniteMagnitude
internal var _xMin: Double = Double.greatestFiniteMagnitude

/// Makes sure that the cache is populated for the specified range
internal func buildCache()
Expand Down Expand Up @@ -275,10 +275,10 @@ open class RealmBaseDataSet: ChartBaseDataSet
return
}

_yMax = -DBL_MAX
_yMin = DBL_MAX
_xMax = -DBL_MAX
_xMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude
_xMax = -Double.greatestFiniteMagnitude
_xMin = Double.greatestFiniteMagnitude

for e in _cache
{
Expand Down
8 changes: 4 additions & 4 deletions Source/ChartsRealm/Data/RealmBubbleDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ open class RealmBubbleDataSet: RealmBarLineScatterCandleBubbleDataSet, IBubbleCh
return
}

_yMax = -DBL_MAX
_yMin = DBL_MAX
_xMax = -DBL_MAX
_xMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude
_xMax = -Double.greatestFiniteMagnitude
_xMin = Double.greatestFiniteMagnitude

for e in _cache as! [BubbleChartDataEntry]
{
Expand Down
8 changes: 4 additions & 4 deletions Source/ChartsRealm/Data/RealmCandleDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ open class RealmCandleDataSet: RealmLineScatterCandleRadarDataSet, ICandleChartD
return
}

_yMax = -DBL_MAX
_yMin = DBL_MAX
_xMax = -DBL_MAX
_xMin = DBL_MAX
_yMax = -Double.greatestFiniteMagnitude
_yMin = Double.greatestFiniteMagnitude
_xMax = -Double.greatestFiniteMagnitude
_xMin = Double.greatestFiniteMagnitude

for e in _cache as! [CandleChartDataEntry]
{
Expand Down
Loading