Azure / azure-storage-cpp

Microsoft Azure Storage Client Library for C++
http://azure.github.io/azure-storage-cpp
Apache License 2.0
131 stars 147 forks source link

Bug or typo? was/blob.h download_to_stream_async definition #352

Open yxiang92128 opened 4 years ago

yxiang92128 commented 4 years ago

It was defined as

    pplx::task<void> download_to_stream_async(concurrency::streams::ostream target, const access_condition& condition, const blob_request_options& options, operation_context context, const pplx::cancellation_token& cancellation_token)
    {
        return download_range_to_stream_async(target, **std::numeric_limits<utility::size64_t>::max(), 0, c**ondition, options, context, cancellation_token);
    }

We are wondering in the above, the offset defined as size64_t::max and the length defined as 0 are flipped?

Just curious and hope somebody would clarify.

Thanks,

Yang

Jinming-Hu commented 4 years ago

Hi @yxiang92128 , this is not bug or typo. (max,0) means downloading the whole blob.

yxiang92128 commented 4 years ago

@JinmingHu-MSFT And if the buffer passed in is smaller than the blob size, would it fill up to the size of the buffer or would it grab the whole blob and then copy over the buffer which could be troublesome? I wonder how it works underneath. Thanks.

Jinming-Hu commented 4 years ago

@yxiang92128 The target concurrency::streams::ostream is a base class, what would happen depends on the implementation of ostream. What kind of stream are you using as download destination?