Skip to content

Commit b95de49

Browse files
committed
fixes for Swift 3.0
1 parent 724b93c commit b95de49

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Sources/ImageGIF.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ final public class SGLImageDecoderGIF : SGLImageDecoder {
269269
}
270270

271271
if (avail & codemask) == 0 && avail <= 0x0FFF {
272-
codesize++
272+
codesize += 1
273273
codemask = (1 << codesize) - 1
274274
}
275275
oldcode = code

Sources/ImagePNG.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ final public class SGLImageDecoderPNG : SGLImageDecoder {
133133
}
134134
self.chunk_length -= 1
135135
return self.loader.readUInt8()
136-
}, filter(img)
136+
}, {
137+
if self.filter($0) {
138+
self.line(img)
139+
}
140+
}
137141
)
138142
// discard IDAT checksum
139143
if (!crushed) {
@@ -218,7 +222,7 @@ final public class SGLImageDecoderPNG : SGLImageDecoder {
218222
}
219223

220224

221-
private func filter<T:SGLImageType>(img:T)(byteImut:UInt8)
225+
private func filter(byteImut:UInt8) -> Bool
222226
{
223227
var byte = byteImut
224228
if linePos == 0 {
@@ -231,7 +235,7 @@ final public class SGLImageDecoderPNG : SGLImageDecoder {
231235
for i in 0 ..< filterStride {
232236
lineBuf[i] = 0
233237
}
234-
return
238+
return false
235239
}
236240
switch filter {
237241
case 0: // none
@@ -276,8 +280,9 @@ final public class SGLImageDecoderPNG : SGLImageDecoder {
276280
}
277281
linePos = 0
278282
// successful line
279-
line(img)
283+
return true
280284
}
285+
return false
281286
}
282287

283288

0 commit comments

Comments
 (0)