diff --git a/CHANGELOG.md b/CHANGELOG.md index fb47a20..ef6a692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - yyyy-mm-dd +## [0.1.11] - 2024-09-22 + +- Fix `consume()` missing null terminator. + ## [0.1.10] - 2024-09-21 - Add `consume()` to `StringBuilder` and `Buffer` to take ownership of the internal buffer instead of copying it. diff --git a/mojoproject.toml b/mojoproject.toml index e78216d..457300e 100644 --- a/mojoproject.toml +++ b/mojoproject.toml @@ -4,7 +4,7 @@ channels = ["conda-forge", "https://conda.modular.com/max"] description = "Experiments in porting over Golang stdlib into Mojo." name = "gojo" platforms = ["osx-arm64", "linux-64"] -version = "0.1.10" +version = "0.1.11" [tasks] tests = "bash scripts/tests.sh" diff --git a/src/gojo/bytes/buffer.mojo b/src/gojo/bytes/buffer.mojo index 2a237a0..2e2f233 100644 --- a/src/gojo/bytes/buffer.mojo +++ b/src/gojo/bytes/buffer.mojo @@ -215,7 +215,9 @@ struct Buffer( Returns: The string representation of the buffer. Returns an empty string if the buffer is empty. """ - var result = String(self._data, self._size) + var bytes = List[UInt8, True](unsafe_pointer=self._data, size=self._size, capacity=self._capacity) + bytes.append(0) + var result = String(bytes^) self._data = UnsafePointer[UInt8]() self._size = 0 return result diff --git a/src/recipe.yaml b/src/recipe.yaml index f201e12..c96f88a 100644 --- a/src/recipe.yaml +++ b/src/recipe.yaml @@ -5,7 +5,7 @@ context: package: name: "gojo" - version: 0.1.10 + version: 0.1.11 source: - path: .