Skip to content

Commit

Permalink
Fix missing null terminator
Browse files Browse the repository at this point in the history
  • Loading branch information
thatstoasty committed Sep 22, 2024
1 parent bb80d57 commit 7978360
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion mojoproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/gojo/bytes/buffer.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ context:

package:
name: "gojo"
version: 0.1.10
version: 0.1.11

source:
- path: .
Expand Down

0 comments on commit 7978360

Please sign in to comment.