示例#1
0
void Bio::set(core::data const& da)
{
    clear();
    
    bio = BIO_new(BIO_s_mem());
    BIO_write(bio, da.bytes(), da.length());
}
示例#2
0
文件: HttpServer.cpp 项目: imace/nnt
int HttpConnection::read(core::data& da)
{
    if (da.length())
        return 0;
    use<mg_connection> cnt = connection;
    return mg_read(cnt, da.bytes(), da.length());
}
示例#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;
}
示例#4
0
文件: MDN+NNT.cpp 项目: imace/nnt
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);
}
示例#5
0
文件: AudioBuffer.cpp 项目: imace/nnt
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;
}
示例#6
0
文件: HttpServer.cpp 项目: imace/nnt
int HttpConnection::write(core::data const& da)
{
    use<mg_connection> cnt = connection;
    return mg_write(cnt, da.bytes(), da.length());
}
示例#7
0
文件: MDN+NNT.cpp 项目: imace/nnt
core::data md5::hex(core::data const& da)
{
    core::data re(MD5_DIGEST_LENGTH);
    MD5(da.bytes(), da.length(), core::pointer(re));
    return re;
}
示例#8
0
bool Bdb::del(const core::data &key)
{
    return this->del((void*)key.bytes(), key.length());
}
示例#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());
}