Skip to content

Commit f8d4494

Browse files
author
Nick Lockwood
committed
Update SVGPath to 1.1.6
1 parent f60e28d commit f8d4494

File tree

4 files changed

+31
-35
lines changed

4 files changed

+31
-35
lines changed

SVGPath/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.1.6](https://github.com/nicklockwood/SVGPath/releases/tag/1.1.6) (2025-04-06)
2+
3+
- Fixed stack overflow for large paths in debug builds
4+
15
## [1.1.5](https://github.com/nicklockwood/SVGPath/releases/tag/1.1.5) (2024-04-28)
26

37
- Fixed incorrect calculation for relative `moveTo` commands

SVGPath/SVGPath.xcodeproj/project.pbxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
attributes = {
165165
BuildIndependentTargetsInParallel = YES;
166166
LastSwiftUpdateCheck = 1530;
167-
LastUpgradeCheck = 1530;
167+
LastUpgradeCheck = 1610;
168168
ORGANIZATIONNAME = "Nick Lockwood";
169169
TargetAttributes = {
170170
016FAB2821BFE78100AF60DC = {
@@ -325,6 +325,7 @@
325325
DEBUG_INFORMATION_FORMAT = dwarf;
326326
ENABLE_STRICT_OBJC_MSGSEND = YES;
327327
ENABLE_TESTABILITY = YES;
328+
ENABLE_USER_SCRIPT_SANDBOXING = NO;
328329
GCC_C_LANGUAGE_STANDARD = gnu11;
329330
GCC_DYNAMIC_NO_PIC = NO;
330331
GCC_NO_COMMON_BLOCKS = YES;
@@ -394,6 +395,7 @@
394395
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
395396
ENABLE_NS_ASSERTIONS = NO;
396397
ENABLE_STRICT_OBJC_MSGSEND = YES;
398+
ENABLE_USER_SCRIPT_SANDBOXING = NO;
397399
GCC_C_LANGUAGE_STANDARD = gnu11;
398400
GCC_NO_COMMON_BLOCKS = YES;
399401
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -438,7 +440,7 @@
438440
"@executable_path/../Frameworks",
439441
"@loader_path/Frameworks",
440442
);
441-
MARKETING_VERSION = 1.1.5;
443+
MARKETING_VERSION = 1.1.6;
442444
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
443445
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
444446
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.SVGPath;
@@ -477,7 +479,7 @@
477479
"@executable_path/../Frameworks",
478480
"@loader_path/Frameworks",
479481
);
480-
MARKETING_VERSION = 1.1.5;
482+
MARKETING_VERSION = 1.1.6;
481483
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
482484
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
483485
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.SVGPath;
@@ -496,7 +498,6 @@
496498
016FAB4121BFE78100AF60DC /* Debug */ = {
497499
isa = XCBuildConfiguration;
498500
buildSettings = {
499-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
500501
CODE_SIGN_IDENTITY = "-";
501502
CODE_SIGN_STYLE = Automatic;
502503
COMBINE_HIDPI_IMAGES = YES;
@@ -519,7 +520,6 @@
519520
016FAB4221BFE78100AF60DC /* Release */ = {
520521
isa = XCBuildConfiguration;
521522
buildSettings = {
522-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
523523
CODE_SIGN_IDENTITY = "-";
524524
CODE_SIGN_STYLE = Automatic;
525525
COMBINE_HIDPI_IMAGES = YES;

SVGPath/SVGPath.xcodeproj/xcshareddata/xcschemes/SVGPath.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1530"
3+
LastUpgradeVersion = "1610"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

SVGPath/Sources/SVGPath.swift

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -160,38 +160,30 @@ public struct SVGPath: Hashable {
160160
throw SVGError.unexpectedToken(number)
161161
}
162162

163-
func appendCommand(_ command: SVGCommand) {
164-
commands.append(
165-
isRelative ? command.relative(to: commands) : command
166-
)
167-
}
168-
169163
func processCommand() throws {
170-
let command: SVGCommand
171-
switch token {
172-
case "m", "M":
173-
command = try moveTo()
174-
if !numbers.isEmpty {
175-
appendCommand(command)
164+
repeat {
165+
let command: SVGCommand
166+
switch token {
167+
case "m", "M":
168+
command = try moveTo()
169+
// Treat as l/L for subsequent numbers
176170
token = UnicodeScalar(token.value - 1)!
177-
return try processCommand()
171+
case "l", "L": command = try lineTo()
172+
case "v", "V": command = try lineToVertical()
173+
case "h", "H": command = try lineToHorizontal()
174+
case "q", "Q": command = try quadCurve()
175+
case "t", "T": command = try quadTo()
176+
case "c", "C": command = try cubicCurve()
177+
case "s", "S": command = try cubicTo()
178+
case "a", "A": command = try arc()
179+
case "z", "Z": command = try end()
180+
case " ": return
181+
default: throw SVGError.unexpectedToken(String(token))
178182
}
179-
case "l", "L": command = try lineTo()
180-
case "v", "V": command = try lineToVertical()
181-
case "h", "H": command = try lineToHorizontal()
182-
case "q", "Q": command = try quadCurve()
183-
case "t", "T": command = try quadTo()
184-
case "c", "C": command = try cubicCurve()
185-
case "s", "S": command = try cubicTo()
186-
case "a", "A": command = try arc()
187-
case "z", "Z": command = try end()
188-
case " ": return
189-
default: throw SVGError.unexpectedToken(String(token))
190-
}
191-
appendCommand(command)
192-
if !numbers.isEmpty {
193-
try processCommand()
194-
}
183+
commands.append(
184+
isRelative ? command.relative(to: commands) : command
185+
)
186+
} while !numbers.isEmpty
195187
}
196188

197189
for char in string.unicodeScalars {

0 commit comments

Comments
 (0)