Make the output type of a property source read-only.

This commit is contained in:
2023-01-16 20:53:45 +08:00
parent 9d6bdd968f
commit 5b9149cb34
8 changed files with 76 additions and 56 deletions

View File

@@ -252,7 +252,8 @@ namespace Cryville.Crtr {
readonly Func<string> _cb;
readonly ArrayPool<byte> _pool;
byte[] _buf;
public ScoreStringSrc(ArrayPool<byte> pool, Func<string> cb) {
public ScoreStringSrc(ArrayPool<byte> pool, Func<string> cb)
: base(PdtInternalType.String) {
_pool = pool;
_cb = cb;
}
@@ -263,7 +264,7 @@ namespace Cryville.Crtr {
_buf = null;
}
}
protected override unsafe int InternalGet() {
protected override unsafe void InternalGet() {
var src = _cb();
int strlen = src.Length;
buf = _pool.Rent(sizeof(int) + strlen * sizeof(char));
@@ -273,7 +274,6 @@ namespace Cryville.Crtr {
int i = 0;
foreach (var c in src) ptr[i++] = c;
}
return PdtInternalType.String;
}
}
#endregion