本文整理汇总了C++中pfc::array_t::set_size方法的典型用法代码示例。如果您正苦于以下问题:C++ array_t::set_size方法的具体用法?C++ array_t::set_size怎么用?C++ array_t::set_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pfc::array_t
的用法示例。
在下文中一共展示了array_t::set_size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: STGMEDIUMToDataBlock
HRESULT IDataObjectUtils::STGMEDIUMToDataBlock(const STGMEDIUM & med, pfc::array_t<t_uint8> & out) {
switch(med.tymed) {
case TYMED_HGLOBAL:
{
CGlobalLockScope lock(med.hGlobal);
out.set_data_fromptr( (const t_uint8*) lock.GetPtr(), lock.GetSize() );
}
return S_OK;
case TYMED_ISTREAM:
{
HRESULT state;
IStream * stream = med.pstm;
LARGE_INTEGER offset = {};
STATSTG stats = {};
if (FAILED( state = stream->Stat(&stats,STATFLAG_NONAME ) ) ) return state;
t_size toRead = pfc::downcast_guarded<t_size>(stats.cbSize.QuadPart);
out.set_size(toRead);
if (FAILED( state = stream->Seek(offset,STREAM_SEEK_SET,NULL) ) ) return state;
ULONG cbRead = 0;
if (FAILED( state = stream->Read(out.get_ptr(), pfc::downcast_guarded<ULONG>(toRead), &cbRead) ) ) return state;
if (cbRead != toRead) return E_UNEXPECTED;
}
return S_OK;
default:
return DV_E_TYMED;
}
}
示例2: cleanup
void cleanup()
{
filter.set_size( 0 );
srate = 0;
nch = 0;
channel_config = 0;
}
示例3: SetSize
virtual HRESULT STDMETHODCALLTYPE SetSize(
ULARGE_INTEGER libNewSize)
{
if (libNewSize.QuadPart > MAXDWORD)
return STG_E_INVALIDFUNCTION;
m_data.set_size((t_size)libNewSize.QuadPart);
return S_OK;
}
示例4: init
void init()
{
filter.set_size( nch );
for ( unsigned h = 0; h < nch; h++ )
{
//these do not matter, only samplerate does
filter[ h ].setFrequency(400);
filter[ h ].setQuality(0);
filter[ h ].setGain(0);
filter[ h ].init(srate,RIAA_CD);
}
}
示例5: open
void open( service_ptr_t<file> m_file, const char * p_path, t_input_open_reason p_reason, abort_callback & p_abort )
{
if ( p_reason == input_open_info_write ) throw exception_io_data();
input_open_file_helper( m_file, p_path, p_reason, p_abort );
m_stats = m_file->get_stats( p_abort );
t_uint8 * ptr;
unsigned size;
t_filesize size64 = m_file->get_size_ex( p_abort );
if ( size64 > ( 1 << 24 ) )
throw exception_io_data();
size = (unsigned) size64;
file_buffer.set_size( size );
ptr = file_buffer.get_ptr();
m_file->read_object( ptr, size, p_abort );
m_player = ModPlug_Load(ptr, size);
if ( !m_player ) throw exception_io_data();
}
示例6: stream_to_mem_block
void stream_to_mem_block(stream_reader * p_source, pfc::array_t<t_uint8> & p_out,abort_callback & p_abort, unsigned p_sizehint, bool b_reset)
{
if (b_reset)
p_out.set_size(0);
enum {min_buffer = 256};
const unsigned buffer_size = max (min_buffer, p_sizehint);
pfc::array_t<t_uint8> buffer;
buffer.set_size(buffer_size);
for(;;)
{
unsigned delta_done = 0;
delta_done = p_source->read(buffer.get_ptr(),buffer_size,p_abort);
p_out.append_fromptr(buffer.get_ptr(),delta_done);
if (delta_done < buffer_size) break;
}
}
示例7: readdata
//void readboxfull(service_ptr_t<file> & p_file, abort_callback & p_abort)
//{
// readbox(p_file, p_abort);
// p_file->skip(4, p_abort);
//}
void readdata(stream_reader * p_file, abort_callback & p_abort)
{
m_data.set_size(pfc::downcast_guarded<t_size>(get_data_size()));
p_file->read(m_data.get_ptr(), m_data.get_size(), p_abort);
}
示例8: get_column_widths
unsigned playlist_view::get_column_widths(pfc::array_t<int, pfc::alloc_fast_aggressive> & out) const
{
const bit_array & p_mask = g_cache.active_get_columns_mask();
unsigned n,t = columns.get_count(),nw=0,i;
unsigned ac = 0;
for (n=0;n<t;n++) if (p_mask[n]) ac++;
out.set_size(ac);
RECT hd;
SetRectEmpty(&hd);
if (cfg_nohscroll && wnd_playlist && GetClientRect(wnd_playlist, &hd))
{
int tw=0,total_parts=0;
pfc::array_t<unsigned> columns_parts;
columns_parts.set_size(t);
out.fill(0);
for (n=0,i=0;n<t;n++)
if (p_mask[n])
{
tw += columns[n]->width;
unsigned part = columns[n]->parts;
total_parts += part;
columns_parts[n] = part;
i++;
}
int excess = hd.right-hd.left-tw;
bool first_pass = true;
while ( (excess && total_parts) || first_pass)
{
first_pass= false;
int parts = total_parts;
for (n=0,i=0;n<t;n++)
if (p_mask[n])
{
int part = columns_parts[n];
int e = ((parts && part) ? MulDiv(part,(excess),parts) : 0);
int f = columns[n]->width;
parts -= part;
excess -= e;
if (e < f*-1)
{
e = f*-1;
total_parts -= columns_parts[n];
columns_parts[n]=0;
}
int w = f + e;
out[i++] += w;
nw += w;
}
}
}
else
{
for (n=0,i=0;n<t;n++)
{
if (p_mask[n])
{
out[i] = columns[n]->width;
nw += out[i++];
}
}
}
return nw;
}