mirror of
https://onedev.site.tesses.net/crosslang
synced 2026-02-08 17:15:45 +00:00
use shared ptrs for stream, vfs and ihttpserver and add progress
This commit is contained in:
@@ -113,11 +113,11 @@ namespace Tesses::CrossLang
|
||||
dict->DeclareFunction(gc, "Base64Decode","Base64 decode",{"str"},Crypto_Base64Decode);
|
||||
dict->DeclareFunction(gc, "Sha1", "Hash with sha1 algorithm (please don't use sha1 unless you need to)",{"strm"}, [](GCList& ls, std::vector<TObject> args)->TObject {
|
||||
TByteArray* baSrc;
|
||||
TStreamHeapObject* sho;
|
||||
std::shared_ptr<Tesses::Framework::Streams::Stream> sho;
|
||||
|
||||
if(GetArgumentHeap(args, 0, sho))
|
||||
if(GetArgument(args, 0, sho))
|
||||
{
|
||||
auto bytes = Sha1::ComputeHash(sho->stream);
|
||||
auto bytes = Sha1::ComputeHash(sho);
|
||||
auto ba = TByteArray::Create(ls);
|
||||
ba->data = bytes;
|
||||
return ba;
|
||||
@@ -133,13 +133,13 @@ namespace Tesses::CrossLang
|
||||
});
|
||||
dict->DeclareFunction(gc, "Sha256", "Hash with sha256 algorithm",{"strm","$is224"}, [](GCList& ls, std::vector<TObject> args)->TObject {
|
||||
TByteArray* baSrc;
|
||||
TStreamHeapObject* sho;
|
||||
std::shared_ptr<Tesses::Framework::Streams::Stream> sho;
|
||||
bool is224=false;
|
||||
GetArgument(args,1,is224);
|
||||
|
||||
if(GetArgumentHeap(args, 0, sho))
|
||||
if(GetArgument(args, 0, sho))
|
||||
{
|
||||
auto bytes = Sha256::ComputeHash(sho->stream,is224);
|
||||
auto bytes = Sha256::ComputeHash(sho,is224);
|
||||
auto ba = TByteArray::Create(ls);
|
||||
ba->data = bytes;
|
||||
return ba;
|
||||
@@ -155,13 +155,13 @@ namespace Tesses::CrossLang
|
||||
});
|
||||
dict->DeclareFunction(gc, "Sha512", "Hash with sha512 algorithm",{"strm","$is384"}, [](GCList& ls, std::vector<TObject> args)->TObject {
|
||||
TByteArray* baSrc;
|
||||
TStreamHeapObject* sho;
|
||||
std::shared_ptr<Tesses::Framework::Streams::Stream> sho;
|
||||
bool is384=false;
|
||||
GetArgument(args,1,is384);
|
||||
|
||||
if(GetArgumentHeap(args, 0, sho))
|
||||
if(GetArgument(args, 0, sho))
|
||||
{
|
||||
auto bytes = Sha512::ComputeHash(sho->stream,is384);
|
||||
auto bytes = Sha512::ComputeHash(sho,is384);
|
||||
auto ba = TByteArray::Create(ls);
|
||||
ba->data = bytes;
|
||||
return ba;
|
||||
|
||||
Reference in New Issue
Block a user