Skip to content

Commit 1f0f8b3

Browse files
committed
Comment the buffer handling and size more carefully
1 parent dfa0849 commit 1f0f8b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/SwiftProtobuf/DoubleParser.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import Foundation
1616

1717
/// Support parsing float/double values from UTF-8
1818
internal class DoubleParser {
19+
// Temporary buffer so we can null-terminate the UTF-8 string
20+
// before calling the C standard libray to parse it.
21+
// In theory, JSON writers should be able to represent any IEEE Double
22+
// in at most 25 bytes, but many writers will emit more digits than
23+
// necessary, so we size this generously.
1924
#if swift(>=4.1)
2025
private var work =
2126
UnsafeMutableRawBufferPointer.allocate(byteCount: 128,

0 commit comments

Comments
 (0)