Replace deprecated C header includes with the C++ ones.

This commit is contained in:
Peter Keresztes Schmidt 2021-02-03 23:56:42 +01:00
parent d4e83620b2
commit 5a57efdfe2
40 changed files with 71 additions and 113 deletions

View File

@ -2,9 +2,8 @@
#define ZM_ANALYSIS_THREAD_H
#include "zm_thread.h"
#include <signal.h>
#include "zm_monitor.h"
#include <csignal>
class AnalysisThread : public Thread {
private:

View File

@ -22,12 +22,7 @@
#include "zm.h"
#include "zm_coord.h"
#ifndef SOLARIS
#include <math.h>
#else
#include <cmath>
#endif
//
// Class used for storing a box, which is defined as a region
@ -61,8 +56,8 @@ public:
inline int Area() const { return size.X()*size.Y(); }
inline const Coord Centre() const {
int mid_x = int(round(lo.X()+(size.X()/2.0)));
int mid_y = int(round(lo.Y()+(size.Y()/2.0)));
int mid_x = int(std::round(lo.X()+(size.X()/2.0)));
int mid_y = int(std::round(lo.Y()+(size.Y()/2.0)));
return Coord( mid_x, mid_y );
}
inline bool Inside( const Coord &coord ) const

View File

@ -21,8 +21,7 @@
#define ZM_BUFFER_H
#include "zm.h"
#include <string.h>
#include <cstring>
class Buffer
{
@ -42,12 +41,12 @@ public:
}
Buffer(const unsigned char *pStorage, unsigned int pSize) : mAllocation(pSize), mSize(pSize) {
mHead = mStorage = new unsigned char[mSize];
memcpy(mStorage, pStorage, mSize);
std::memcpy(mStorage, pStorage, mSize);
mTail = mHead + mSize;
}
Buffer(const Buffer &buffer) : mAllocation(buffer.mSize), mSize(buffer.mSize) {
mHead = mStorage = new unsigned char[mSize];
memcpy(mStorage, buffer.mHead, mSize);
std::memcpy(mStorage, buffer.mHead, mSize);
mTail = mHead + mSize;
}
~Buffer() {
@ -116,7 +115,7 @@ public:
// Add bytes to the end of the buffer
unsigned int append(const unsigned char *pStorage, unsigned int pSize) {
expand(pSize);
memcpy(mTail, pStorage, pSize);
std::memcpy(mTail, pStorage, pSize);
mTail += pSize;
mSize += pSize;
return mSize;
@ -133,7 +132,7 @@ public:
mHead = mTail = mStorage;
else if ( level ) {
if ( ((uintptr_t)mHead-(uintptr_t)mStorage) > mSize ) {
memcpy( mStorage, mHead, mSize );
std::memcpy( mStorage, mHead, mSize );
mHead = mStorage;
mTail = mHead + mSize;
}

View File

@ -20,22 +20,15 @@
#include "zm_comms.h"
#include "zm_logger.h"
#include <errno.h>
#include <cerrno>
#include <fcntl.h>
#include <stdarg.h>
#include <cstdarg>
#include <utility>
#if defined(BSD)
#include <stdlib.h>
#else
#include <alloca.h>
#endif
#include <sys/ioctl.h>
#include <sys/param.h>
#include <netinet/tcp.h>
#include <arpa/inet.h> // for debug output
#include <stdio.h> // for snprintf
#include <cstdio> // for snprintf
#ifdef SOLARIS
#include <sys/filio.h> // define FIONREAD

View File

@ -23,12 +23,9 @@
#include "zm_logger.h"
#include "zm_exception.h"
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include <sys/un.h>
#include <set>
#include <vector>
#include <sys/uio.h>

View File

@ -20,10 +20,7 @@
#include "zm.h"
#include "zm_db.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <cstring>
#include <dirent.h>
#include <glob.h>

View File

@ -13,7 +13,6 @@
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#endif
#include <string.h>
// returns username if valid, "" if not
#if HAVE_LIBJWT

View File

@ -20,10 +20,8 @@
#ifndef ZM_CRYPT_H
#define ZM_CRYPT_H
#include <string.h>
#include <string>
#include <utility>
bool verifyPassword( const char *username, const char *input_password, const char *db_password_hash);

View File

@ -17,8 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include "zm.h"
#include "zm_db.h"

View File

@ -22,8 +22,6 @@
#include <arpa/inet.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <getopt.h>
#include <arpa/inet.h>
#include <glob.h>

View File

@ -20,12 +20,11 @@
#ifndef ZM_EVENT_H
#define ZM_EVENT_H
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <unistd.h>
#include <errno.h>
#include <limits.h>
#include <time.h>
#include <cerrno>
#include <climits>
#include <ctime>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>

View File

@ -19,9 +19,9 @@
#include <fcntl.h>
#include <sys/file.h>
#include <stdio.h>
#include <stdarg.h>
#include <signal.h>
#include <cstdio>
#include <cstdarg>
#include <csignal>
#include "zm.h"
#include "zm_time.h"

View File

@ -17,14 +17,9 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include <ctime>
#include <cerrno>
#include <sys/stat.h>
#include "zm.h"

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <sys/stat.h>
#include "zm.h"

View File

@ -22,8 +22,8 @@
#include "zm_group.h"
#include <string.h>
#include <stdlib.h>
#include <cstring>
#include <cstdlib>
Group::Group() {
Warning("Instantiating default Group Object. Should not happen.");

View File

@ -25,7 +25,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <cerrno>
static unsigned char y_table_global[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 154, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 225, 227, 228, 229, 230, 231, 232, 234, 235, 236, 237, 238, 239, 241, 242, 243, 244, 245, 246, 248, 249, 250, 251, 252, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255};

View File

@ -34,7 +34,7 @@ extern "C" {
class Image;
#include "zm_ffmpeg.h"
#include <errno.h>
#include <cerrno>
#if HAVE_ZLIB_H
#include <zlib.h>

View File

@ -24,14 +24,14 @@
#include "zm_db.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <syslog.h>
#include <signal.h>
#include <stdarg.h>
#include <errno.h>
#include <csignal>
#include <cstdarg>
#include <cerrno>
#include <libgen.h>
#ifdef __FreeBSD__
#include <sys/thr.h>

View File

@ -20,7 +20,7 @@
#ifndef ZM_MEM_UTILS_H
#define ZM_MEM_UTILS_H
#include <stdlib.h>
#include <cstdlib>
#include "zm.h"
inline void* zm_mallocaligned(unsigned int reqalignment, size_t reqsize) {

View File

@ -17,8 +17,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#include "zm.h"
#include "zm_rgb.h"

View File

@ -20,11 +20,7 @@
#include "zm.h"
#include "zm_poly.h"
#ifndef SOLARIS
#include <math.h>
#else
#include <cmath>
#endif
void Polygon::calcArea() {
double float_area = 0.0L;

View File

@ -24,7 +24,7 @@
#include "zm_coord.h"
#include "zm_box.h"
#include <math.h>
#include <cmath>
//
// Class used for storing a box, which is defined as a region

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string.h>
#include <cstring>
#include "zm.h"
#include "zm_regexp.h"

View File

@ -25,7 +25,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <cerrno>
#include <netdb.h>
#ifdef SOLARIS

View File

@ -23,7 +23,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <cerrno>
#include <netdb.h>
#ifdef SOLARIS

View File

@ -26,7 +26,7 @@
#include "zm_time.h"
#include "zm_rtsp.h"
#include <errno.h>
#include <cerrno>
RtpCtrlThread::RtpCtrlThread( RtspThread &rtspThread, RtpSource &rtpSource )
: mRtspThread( rtspThread ), mRtpSource( rtpSource ), mStop( false )

View File

@ -20,9 +20,8 @@
#include "zm_utils.h"
#include "zm_rtsp_auth.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstring>
namespace zm {

View File

@ -4,8 +4,8 @@
#if HAVE_RTSP_SERVER
#include <sys/time.h>
#include <string.h>
#include <ctime>
#include <cstring>
// ---------------------------------
// Captured frame
// ---------------------------------

View File

@ -5,7 +5,7 @@
#define ZM_RTSP_SERVER_THREAD_H
#include "zm_thread.h"
#include <signal.h>
#include <csignal>
#include "zm_monitor.h"

View File

@ -26,7 +26,7 @@
#include "zm_exception.h"
#include "zm_ffmpeg.h"
#include <stdlib.h>
#include <cstdlib>
#include <string>
#include <vector>

View File

@ -20,9 +20,9 @@
#include "zm.h"
#include "zm_signal.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define TRACE_SIZE 16

View File

@ -20,7 +20,7 @@
#ifndef ZM_SIGNAL_H
#define ZM_SIGNAL_H
#include <signal.h>
#include <csignal>
#if HAVE_EXECINFO_H
#include <execinfo.h>

View File

@ -22,9 +22,9 @@
#include "zm_storage.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cstdio>
Storage::Storage() : id(0) {
Warning("Instantiating default Storage Object. Should not happen.");

View File

@ -22,10 +22,10 @@
#include "zm_logger.h"
#include "zm_utils.h"
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <sys/time.h>
#include <cstring>
#include <csignal>
#include <cerrno>
#include <ctime>
struct timespec getTimeout( int secs ) {
struct timespec timeout;

View File

@ -22,10 +22,10 @@
#include "zm_user.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <utility>
#if HAVE_GNUTLS_GNUTLS_H

View File

@ -21,10 +21,10 @@
#include "zm.h"
#include "zm_utils.h"
#include <string.h>
#include <cstring>
#include <algorithm>
#include <stdio.h>
#include <stdarg.h>
#include <cstdio>
#include <cstdarg>
#include <fcntl.h> /* Definition of AT_* constants */
#include <sys/stat.h>
#if defined(__arm__)

View File

@ -20,7 +20,7 @@
#ifndef ZM_UTILS_H
#define ZM_UTILS_H
#include <time.h>
#include <ctime>
#include <sys/time.h>
#include <string>
#include <sstream>

View File

@ -24,9 +24,6 @@
#include "zm.h"
#include "zm_videostore.h"
#include <stdlib.h>
#include <string.h>
extern "C" {
#include "libavutil/time.h"
}

View File

@ -54,7 +54,7 @@ possible, this should run at more or less constant speed.
*/
#include <getopt.h>
#include <signal.h>
#include <csignal>
#if defined(__FreeBSD__)
#include <limits.h>
#else

View File

@ -17,8 +17,6 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include <sys/ipc.h>
#include <sys/msg.h>
#include <string>
#include "zm.h"