aboutsummaryrefslogtreecommitdiff
path: root/source/import/ImportBuffer.mc
diff options
context:
space:
mode:
Diffstat (limited to 'source/import/ImportBuffer.mc')
-rw-r--r--source/import/ImportBuffer.mc10
1 files changed, 4 insertions, 6 deletions
diff --git a/source/import/ImportBuffer.mc b/source/import/ImportBuffer.mc
index 0aca548..dee0012 100644
--- a/source/import/ImportBuffer.mc
+++ b/source/import/ImportBuffer.mc
@@ -54,17 +54,15 @@ module ImportBuffer {
return text;
}
- // Save text as the waiting import. Returns false (and saves nothing)
- // when it is over MAX_TEXT_BYTES.
- function save(store as Persist.Backend, keys as SealedBox.Keys, text as String, now as Long) as Boolean {
- var plain = Bytes.fromUtf8(text);
+ // Save the text's UTF-8 bytes as the waiting import. Returns false (and
+ // saves nothing) when they are over MAX_TEXT_BYTES. The caller's bytes
+ // are left as they are.
+ function save(store as Persist.Backend, keys as SealedBox.Keys, plain as ByteArray, now as Long) as Boolean {
if (plain.size() > MAX_TEXT_BYTES) {
- Bytes.wipe(plain);
return false;
}
clear(store);
var box = SealedBox.seal(keys, Bytes.fromUtf8(AAD), plain);
- Bytes.wipe(plain);
var n = 0;
for (var at = 0; at < box.size(); at += CHUNK_BYTES) {
store.setValue(META_KEY + "." + n, box.slice(at, at + CHUNK_BYTES < box.size() ? at + CHUNK_BYTES : box.size()));