Beispiel #1
0
void Bio::set(core::data const& da)
{
    clear();
    
    bio = BIO_new(BIO_s_mem());
    BIO_write(bio, da.bytes(), da.length());
}
Beispiel #2
0
int HttpConnection::read(core::data& da)
{
    if (da.length())
        return 0;
    use<mg_connection> cnt = connection;
    return mg_read(cnt, da.bytes(), da.length());
}
Beispiel #3
0
bool Bdb::get(core::data const& key, core::data& data)
{
    void* rda = NULL;
    uint rsz = 0;
    if (!this->get((void*)key.bytes(), key.length(), &rda, &rsz))
        return false;
    
    data = core::data((byte*)rda, rsz);
    data.set_release(true);

    return true;
}
Beispiel #4
0
NNT_BEGIN_HEADER_C

# include <openssl/md5.h>

NNT_END_HEADER_C

NNT_BEGIN_CXX

core::string md5::digest(const core::data &data)
{
    core::data re(MD5_DIGEST_LENGTH);
    MD5(data.bytes(), data.length(), core::pointer(re));
    return core::present_cast<core::string>(re);
}
Beispiel #5
0
bool PlayBuffer::read(core::data &da)
{
# ifdef NNT_MACH

    AudioBufferList buf;
    buf.mNumberBuffers = 1;
    buf.mBuffers[0].mDataByteSize = da.length();
    buf.mBuffers[0].mNumberChannels = d_ptr->ofmt.mChannelsPerFrame;
    buf.mBuffers[0].mData = da.bytes();

    UInt32 frames = da.length() / d_ptr->ofmt.mBytesPerFrame;
    OSStatus sta = ExtAudioFileRead(d_ptr->extstm,
                                    &frames,
                                    &buf);

    usize readed = frames * d_ptr->ofmt.mBytesPerFrame;
    da.set_length(readed);

    return sta == 0;

# endif

    return false;
}
Beispiel #6
0
int HttpConnection::write(core::data const& da)
{
    use<mg_connection> cnt = connection;
    return mg_write(cnt, da.bytes(), da.length());
}
Beispiel #7
0
core::data md5::hex(core::data const& da)
{
    core::data re(MD5_DIGEST_LENGTH);
    MD5(da.bytes(), da.length(), core::pointer(re));
    return re;
}
Beispiel #8
0
bool Bdb::del(const core::data &key)
{
    return this->del((void*)key.bytes(), key.length());
}
Beispiel #9
0
bool Bdb::over(core::data const& data, core::data const& key)
{
    return this->over((void*)data.bytes(), data.length(), (void*)key.bytes(), key.length());
}