libcsdbg  1.28
C++ exception (and generic) stack trace debug library
filebuf & csdbg::filebuf::resize ( u32  sz)
virtual

Resize the file.

Parameters
[in]szthe new size
Returns
*this
Exceptions
csdbg::exception
Note
If the file was larger than 'sz', the extra data is lost. If the file was shorter, it is extended, and the extended part reads as null bytes ('\0'). The file offset is not changed

Definition at line 313 of file filebuf.cpp.

References csdbg::streambuf::m_handle, and unlikely.

314 {
315  i32 retval;
316  do {
317  retval = ftruncate(m_handle, sz);
318  }
319  while ( unlikely(retval < 0 && errno == EINTR) );
320 
321  if ( unlikely(retval < 0) )
322  throw errno;
323 
324  return *this;
325 }
i32 m_handle
Stream handle (descriptor)
Definition: streambuf.hpp:43
int i32
32-bit signed integer
Definition: config.hpp:82
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349