Audacity 3.2.0
Classes | Functions | Variables
audacity::network_manager::anonymous_namespace{CurlResponse.cpp} Namespace Reference

Classes

struct  DataStream
 

Functions

size_t DataStreamRead (char *ptr, size_t size, size_t nmemb, DataStream *stream) noexcept
 
int DataStreamSeek (DataStream *stream, curl_off_t offs, int origin) noexcept
 
size_t MimePartRead (char *ptr, size_t size, size_t nmemb, MultipartData::Part *stream)
 
int MimePartSeek (MultipartData::Part *stream, curl_off_t offs, int origin) noexcept
 

Variables

static const std::map< CURLcode, NetworkErrorerrorsMap
 

Function Documentation

◆ DataStreamRead()

size_t audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStreamRead ( char *  ptr,
size_t  size,
size_t  nmemb,
DataStream stream 
)
noexcept

Definition at line 72 of file CurlResponse.cpp.

73{
74 size = std::min (size * nmemb, stream->Size - stream->Offset);
75
76 const char* start = stream->Buffer + stream->Offset;
77 const char* end = start + size;
78
79 std::copy (start, end, ptr);
80
81 stream->Offset += size;
82
83 return size;
84}
int min(int a, int b)
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40

References staffpad::vo::copy(), PackedArray::end(), min(), nmemb, and size.

Referenced by audacity::network_manager::CurlResponse::perform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DataStreamSeek()

int audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStreamSeek ( DataStream stream,
curl_off_t  offs,
int  origin 
)
noexcept

Definition at line 86 of file CurlResponse.cpp.

87{
88 int64_t offset = offs;
89
90 switch (origin)
91 {
92 case SEEK_CUR:
93 offset += stream->Offset;
94 break;
95 case SEEK_END:
96 offset += stream->Size;
97 break;
98 }
99
100 if (offset < 0 || offset >= stream->Size)
101 return CURL_SEEKFUNC_FAIL;
102
103 stream->Offset = offset;
104
105 return CURL_SEEKFUNC_OK;
106}

Referenced by audacity::network_manager::CurlResponse::perform().

Here is the caller graph for this function:

◆ MimePartRead()

size_t audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::MimePartRead ( char *  ptr,
size_t  size,
size_t  nmemb,
MultipartData::Part stream 
)

Definition at line 108 of file CurlResponse.cpp.

109{
110 return stream->Read(ptr, size * nmemb);
111}
virtual size_t Read(void *buffer, size_t maxBytes)=0

References nmemb, audacity::network_manager::MultipartData::Part::Read(), and size.

Referenced by audacity::network_manager::CurlResponse::perform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MimePartSeek()

int audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::MimePartSeek ( MultipartData::Part stream,
curl_off_t  offs,
int  origin 
)
noexcept

Definition at line 113 of file CurlResponse.cpp.

114{
115 return stream->Seek(offs, origin) ? CURL_SEEKFUNC_OK : CURL_SEEKFUNC_FAIL;
116}
virtual bool Seek(int64_t offset, int origin=SEEK_SET)=0

Referenced by audacity::network_manager::CurlResponse::perform().

Here is the caller graph for this function:

Variable Documentation

◆ errorsMap

const std::map<CURLcode, NetworkError> audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::errorsMap
static

Definition at line 27 of file CurlResponse.cpp.

Referenced by audacity::network_manager::CurlResponse::perform().