ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
cpr.cpp File Reference
#include <ucommon-config.h>
#include <ucommon/export.h>
#include <ucommon/cpr.h>
#include <stdexcept>
#include <ucommon/string.h>
#include <ucommon/socket.h>
#include <errno.h>
#include <stdarg.h>
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>
Include dependency graph for cpr.cpp:

Go to the source code of this file.

Functions

void cpr_runtime_error (const char *str)
 Function to handle runtime errors. More...
 
int stricmp (const char *s1, const char *s2)
 
int strnicmp (const char *s1, const char *s2, size_t size)
 
uint16_t lsb_getshort (uint8_t *b)
 
uint32_t lsb_getlong (uint8_t *b)
 
uint16_t msb_getshort (uint8_t *b)
 
uint32_t msb_getlong (uint8_t *b)
 
void lsb_setshort (uint8_t *b, uint16_t v)
 
void msb_setshort (uint8_t *b, uint16_t v)
 
void lsb_setlong (uint8_t *b, uint32_t v)
 
void msb_setlong (uint8_t *b, uint32_t v)
 
void * cpr_newp (void **handle, size_t size)
 
void cpr_freep (void **handle)
 
void cpr_memswap (void *s1, void *s2, size_t size)
 Portable swap code. More...
 
void * cpr_memalloc (size_t size)
 Portable memory allocation helper function. More...
 
void * cpr_memassign (size_t size, caddr_t addr, size_t max)
 Portable memory placement helper function. More...
 

Function Documentation

◆ cpr_freep()

void cpr_freep ( void **  handle)

Definition at line 184 of file cpr.cpp.

Referenced by freep().

◆ cpr_memalloc()

void * cpr_memalloc ( size_t  size)

Portable memory allocation helper function.

Handles out of heap error as a runtime error.

Parameters
sizeof memory block to allocate from heap.
Returns
memory address of allocated heap space.

Definition at line 209 of file cpr.cpp.

◆ cpr_memassign()

void * cpr_memassign ( size_t  size,
caddr_t  address,
size_t  known 
)

Portable memory placement helper function.

This is used to process "placement" new operators where a new object is constructed over a pre-allocated area of memory. This handles invalid values through runtime error.

Parameters
sizeof object being constructed.
addresswhere the object is being placed.
knownsize of the location we are constructing the object in.

Definition at line 221 of file cpr.cpp.

◆ cpr_memswap()

void cpr_memswap ( void *  mem1,
void *  mem2,
size_t  size 
)

Portable swap code.

Parameters
mem1to swap.
mem2to swap.
sizeof swap area.

Definition at line 193 of file cpr.cpp.

Referenced by ucommon::swap().

◆ cpr_newp()

void * cpr_newp ( void **  handle,
size_t  size 
)

Definition at line 175 of file cpr.cpp.

Referenced by newp().

◆ cpr_runtime_error()

void cpr_runtime_error ( const char *  text)

Function to handle runtime errors.

When using the standard C library, runtime errors are handled by a simple abort. When using the stdc++ library with stdexcept, then std::runtime_error will be thrown.

Parameters
textof runtime error.

Definition at line 83 of file cpr.cpp.

Referenced by ucommon::shell::log(), and ucommon::shell::security().

◆ lsb_getlong()

uint32_t lsb_getlong ( uint8_t *  b)

Definition at line 123 of file cpr.cpp.

Referenced by process().

◆ lsb_getshort()

uint16_t lsb_getshort ( uint8_t *  b)

Definition at line 117 of file cpr.cpp.

◆ lsb_setlong()

void lsb_setlong ( uint8_t *  b,
uint32_t  v 
)

Definition at line 157 of file cpr.cpp.

Referenced by encodefile().

◆ lsb_setshort()

void lsb_setshort ( uint8_t *  b,
uint16_t  v 
)

Definition at line 141 of file cpr.cpp.

◆ msb_getlong()

uint32_t msb_getlong ( uint8_t *  b)

Definition at line 135 of file cpr.cpp.

◆ msb_getshort()

uint16_t msb_getshort ( uint8_t *  b)

Definition at line 129 of file cpr.cpp.

◆ msb_setlong()

void msb_setlong ( uint8_t *  b,
uint32_t  v 
)

Definition at line 166 of file cpr.cpp.

◆ msb_setshort()

void msb_setshort ( uint8_t *  b,
uint16_t  v 
)

Definition at line 148 of file cpr.cpp.

◆ stricmp()

int stricmp ( const char *  s1,
const char *  s2 
)

Definition at line 95 of file cpr.cpp.

References stricmp().

Referenced by ucommon::String::eq_case(), ost::MapTable::getObject(), ost::DSO::getObject(), ost::Assoc::getPointer(), ost::Slog::open(), ost::IPV4Address::setAddress(), and stricmp().

Here is the call graph for this function:

◆ strnicmp()

int strnicmp ( const char *  s1,
const char *  s2,
size_t  size 
)

Definition at line 104 of file cpr.cpp.

References strnicmp().

Referenced by ucommon::String::eq_case(), ucommon::String::ifind(), ucommon::fsys::is_device(), ost::XMLParser::parseTag(), and strnicmp().

Here is the call graph for this function: