From ed31fc215fe80ef9078ca3591a13c3242461b97e Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Tue, 24 Aug 2021 14:31:26 +0200 Subject: [PATCH] wasm: fix loading for binary files This patch changes load function in thorvgwasm.cpp for using size() instead of strlen(). It fixes loading of binary files like .tvg. --- src/wasm/thorvgwasm.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/wasm/thorvgwasm.cpp b/src/wasm/thorvgwasm.cpp index be81e604..f58c1c3c 100644 --- a/src/wasm/thorvgwasm.cpp +++ b/src/wasm/thorvgwasm.cpp @@ -66,9 +66,7 @@ public: mSwCanvas->clear(); if (data.empty()) data = defaultData; - const char *cdata = data.c_str(); - if (mPicture->load(cdata, strlen(cdata)) != Result::Success) { - + if (mPicture->load(data.c_str(), data.size()) != Result::Success) { /* mPicture is not handled as unique_ptr yet, so delete here */ delete(mPicture); mPicture = nullptr;