Switch to C++ versions of standard C headers

This commit is contained in:
Alex Chernyakhovsky
2023-07-30 18:10:08 -04:00
committed by Alex Chernyakhovsky
parent 19ad493dcb
commit cf542739cc
56 changed files with 206 additions and 192 deletions
+2 -2
View File
@@ -30,8 +30,8 @@
also delete it here.
*/
#include <string.h>
#include <stdlib.h>
#include <cstdlib>
#include <cstring>
#include "src/util/fatal_assert.h"
#include "src/crypto/base64.h"
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <stdint.h>
#include <cstdint>
bool base64_decode( const char *b64, const size_t b64_len,
uint8_t *raw, size_t *raw_len );
+1 -1
View File
@@ -60,7 +60,7 @@
/* Use our fallback implementation, which is correct for any endianness. */
#include <stdint.h>
#include <cstdint>
/* Make sure they aren't macros */
#undef htobe64
+7 -6
View File
@@ -30,14 +30,15 @@
also delete it here.
*/
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/resource.h>
#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <sys/resource.h>
#include "src/crypto/byteorder.h"
#include "src/crypto/crypto.h"
#include "src/crypto/base64.h"
+5 -4
View File
@@ -34,11 +34,12 @@
#define CRYPTO_HPP
#include "src/crypto/ae.h"
#include <string>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <string>
long int myatoi( const char *str );
+2 -2
View File
@@ -87,8 +87,8 @@
#include "src/crypto/ae.h"
#include "src/crypto/crypto.h"
#include "src/util/fatal_assert.h"
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
+2 -2
View File
@@ -33,9 +33,9 @@
#ifndef PRNG_HPP
#define PRNG_HPP
#include <string>
#include <stdint.h>
#include <cstdint>
#include <fstream>
#include <string>
#include "src/crypto/crypto.h"
+12 -11
View File
@@ -32,19 +32,20 @@
#include "src/include/config.h"
#include <errno.h>
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <cerrno>
#include <climits>
#include <clocale>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <exception>
#include <pwd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <pwd.h>
#include <signal.h>
#include <time.h>
#include <limits.h>
#include <exception>
#include <unistd.h>
#if HAVE_PTY_H
#include <pty.h>
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <sstream>
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <sstream>
+2 -2
View File
@@ -30,11 +30,11 @@
also delete it here.
*/
#include <memory>
#include <termios.h>
#include <unistd.h>
#include <memory>
#include "src/statesync/user.h"
#include "src/util/fatal_assert.h"
#include "src/util/pty_compat.h"
+11 -10
View File
@@ -32,18 +32,19 @@
#include "src/include/config.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <locale.h>
#include <wchar.h>
#include <assert.h>
#include <wctype.h>
#include <cassert>
#include <cerrno>
#include <clocale>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <cwctype>
#include <typeinfo>
#include <termios.h>
#include <unistd.h>
#if HAVE_PTY_H
#include <pty.h>
+16 -15
View File
@@ -32,25 +32,26 @@
#include "src/include/config.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <locale.h>
#include <wchar.h>
#include <assert.h>
#include <wctype.h>
#include <cassert>
#include <cerrno>
#include <clocale>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <typeinfo>
#include <fcntl.h>
#include <pwd.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/types.h>
#include <pwd.h>
#include <sys/time.h>
#include <exception>
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
#if HAVE_PTY_H
#include <pty.h>
+2 -1
View File
@@ -33,7 +33,8 @@
#include "src/include/config.h"
#include "src/include/version.h"
#include <stdlib.h>
#include <cstdlib>
#include <unistd.h>
#include "stmclient.h"
+19 -18
View File
@@ -33,33 +33,34 @@
#include "src/include/config.h"
#include "src/include/version.h"
#include <err.h>
#include <errno.h>
#include <locale.h>
#include <string.h>
#include <strings.h>
#include <cerrno>
#include <clocale>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <sstream>
#include <typeinfo>
#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
#include <netdb.h>
#include <pwd.h>
#include <strings.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <pwd.h>
#include <typeinfo>
#include <signal.h>
#ifdef HAVE_UTEMPTER
#include <utempter.h>
#endif
#ifdef HAVE_SYSLOG
#include <syslog.h>
#endif
#include <sys/socket.h>
#include <netdb.h>
#include <time.h>
#include <sys/stat.h>
#include <inttypes.h>
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
+10 -9
View File
@@ -32,18 +32,19 @@
#include "src/include/config.h"
#include <cerrno>
#include <clocale>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <err.h>
#include <errno.h>
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <pwd.h>
#include <signal.h>
#include <time.h>
#include <unistd.h>
#if HAVE_PTY_H
#include <pty.h>
+3 -2
View File
@@ -33,11 +33,12 @@
#ifndef STM_CLIENT_HPP
#define STM_CLIENT_HPP
#include <sys/ioctl.h>
#include <termios.h>
#include <string>
#include <memory>
#include <sys/ioctl.h>
#include <termios.h>
#include "src/statesync/completeterminal.h"
#include "src/network/networktransport.h"
#include "src/statesync/user.h"
+2 -2
View File
@@ -31,10 +31,10 @@
*/
#include <algorithm>
#include <wchar.h>
#include <climits>
#include <cwchar>
#include <list>
#include <typeinfo>
#include <limits.h>
#include "src/frontend/terminaloverlay.h"
+1 -1
View File
@@ -38,8 +38,8 @@
#include "src/network/transportsender.h"
#include "src/terminal/parser.h"
#include <climits>
#include <vector>
#include <limits.h>
namespace Overlay {
using namespace Terminal;
+4 -3
View File
@@ -32,6 +32,10 @@
#include "src/include/config.h"
#include <cassert>
#include <cerrno>
#include <cstring>
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
@@ -39,9 +43,6 @@
#endif
#include <netdb.h>
#include <netinet/in.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "src/util/dos_assert.h"
+8 -7
View File
@@ -33,16 +33,17 @@
#ifndef NETWORK_HPP
#define NETWORK_HPP
#include <stdint.h>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <deque>
#include <exception>
#include <string>
#include <vector>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string>
#include <math.h>
#include <vector>
#include <assert.h>
#include <exception>
#include <string.h>
#include "src/crypto/crypto.h"
+3 -4
View File
@@ -33,17 +33,16 @@
#ifndef NETWORK_TRANSPORT_HPP
#define NETWORK_TRANSPORT_HPP
#include <string>
#include <signal.h>
#include <time.h>
#include <csignal>
#include <ctime>
#include <list>
#include <string>
#include <vector>
#include "src/network/network.h"
#include "src/network/transportsender.h"
#include "transportfragment.h"
namespace Network {
template <class MyState, class RemoteState>
class Transport
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <assert.h>
#include <cassert>
#include "src/crypto/byteorder.h"
#include "transportfragment.h"
+2 -2
View File
@@ -33,9 +33,9 @@
#ifndef TRANSPORT_FRAGMENT_HPP
#define TRANSPORT_FRAGMENT_HPP
#include <stdint.h>
#include <vector>
#include <cstdint>
#include <string>
#include <vector>
#include "src/protobufs/transportinstruction.pb.h"
+4 -5
View File
@@ -34,16 +34,15 @@
#define TRANSPORT_SENDER_IMPL_HPP
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <list>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "src/network/transportsender.h"
#include "transportfragment.h"
#include <limits.h>
using namespace Network;
template <class MyState>
+3 -4
View File
@@ -30,12 +30,11 @@
also delete it here.
*/
#include "src/statesync/completeterminal.h"
#include "src/util/fatal_assert.h"
#include <climits>
#include "src/protobufs/hostinput.pb.h"
#include <limits.h>
#include "src/statesync/completeterminal.h"
#include "src/util/fatal_assert.h"
using namespace std;
using namespace Parser;
+1 -1
View File
@@ -33,8 +33,8 @@
#ifndef COMPLETE_TERMINAL_HPP
#define COMPLETE_TERMINAL_HPP
#include <cstdint>
#include <list>
#include <stdint.h>
#include "src/terminal/parser.h"
#include "src/terminal/terminal.h"
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <assert.h>
#include <cassert>
#include <typeinfo>
#include "src/statesync/user.h"
+1 -1
View File
@@ -33,10 +33,10 @@
#ifndef USER_HPP
#define USER_HPP
#include <cassert>
#include <deque>
#include <list>
#include <string>
#include <assert.h>
#include "src/terminal/parseraction.h"
+4 -4
View File
@@ -30,11 +30,11 @@
also delete it here.
*/
#include <assert.h>
#include <cassert>
#include <cerrno>
#include <cstdint>
#include <cwchar>
#include <typeinfo>
#include <errno.h>
#include <wchar.h>
#include <stdint.h>
#include "src/terminal/parser.h"
+2 -2
View File
@@ -36,8 +36,8 @@
/* Based on Paul Williams's parser,
http://www.vt100.net/emu/dec_ansi_parser */
#include <wchar.h>
#include <string.h>
#include <cstring>
#include <cwchar>
#include "parsertransition.h"
#include "src/terminal/parseraction.h"
+2 -2
View File
@@ -30,8 +30,8 @@
also delete it here.
*/
#include <stdio.h>
#include <wctype.h>
#include <cstdio>
#include <cwctype>
#include "src/terminal/parseraction.h"
#include "src/terminal/terminal.h"
+1 -1
View File
@@ -33,7 +33,7 @@
#ifndef PARSERTRANSITION_HPP
#define PARSERTRANSITION_HPP
#include <stdlib.h>
#include <cstdlib>
#include "src/terminal/parseraction.h"
+5 -4
View File
@@ -30,12 +30,13 @@
also delete it here.
*/
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <unistd.h>
#include "src/terminal/terminal.h"
using namespace Terminal;
+3 -3
View File
@@ -33,10 +33,10 @@
#ifndef TERMINAL_CPP
#define TERMINAL_CPP
#include <wchar.h>
#include <stdio.h>
#include <vector>
#include <cstdio>
#include <cwchar>
#include <deque>
#include <vector>
#include "src/terminal/parseraction.h"
#include "src/terminal/terminalframebuffer.h"
+5 -5
View File
@@ -30,11 +30,11 @@
also delete it here.
*/
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "terminaldispatcher.h"
#include "src/terminal/parseraction.h"
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <stdio.h>
#include <cstdio>
#include "terminaldisplay.h"
#include "src/terminal/terminalframebuffer.h"
+2 -2
View File
@@ -57,8 +57,8 @@
#else
# error "SysV or X/Open-compatible Curses header file required"
#endif
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
using namespace Terminal;
+3 -3
View File
@@ -30,9 +30,9 @@
also delete it here.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include "src/terminal/terminalframebuffer.h"
+3 -4
View File
@@ -33,10 +33,9 @@
#ifndef TERMINALFB_HPP
#define TERMINALFB_HPP
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <cassert>
#include <climits>
#include <cstdint>
#include <deque>
#include <list>
#include <memory>
+3 -2
View File
@@ -30,10 +30,11 @@
also delete it here.
*/
#include <unistd.h>
#include <algorithm>
#include <cstdio>
#include <string>
#include <stdio.h>
#include <unistd.h>
#include "terminaldispatcher.h"
#include "src/terminal/terminalframebuffer.h"
+2 -1
View File
@@ -30,7 +30,8 @@
also delete it here.
*/
#include <assert.h>
#include <cassert>
#include "terminaluserinput.h"
using namespace Terminal;
+3 -3
View File
@@ -37,9 +37,9 @@
client and server. It does not particularly test any code written for
the Mosh project. */
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <cstdint>
#include <cstring>
#include <cstdlib>
#include "src/crypto/base64.h"
#include "base64_vector.h"
+2 -2
View File
@@ -34,10 +34,10 @@
messages, interspersed with some random bad ciphertexts which we need to
reject. */
#include <stdio.h>
#include <cstdio>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <cinttypes>
#include "src/crypto/crypto.h"
#include "src/crypto/prng.h"
+6 -5
View File
@@ -32,13 +32,14 @@
#include "src/include/config.h"
#include <cerrno>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <stdio.h>
#include <cstdio>
#include "src/util/locale_utils.h"
+3 -3
View File
@@ -37,9 +37,9 @@
client and server. It does not particularly test any code written for
the Mosh project. */
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <memory>
#include "src/crypto/ae.h"
+1 -1
View File
@@ -30,7 +30,7 @@
also delete it here.
*/
#include <stdio.h>
#include <cstdio>
#include "test_utils.h"
+2 -2
View File
@@ -33,8 +33,8 @@
#ifndef DOS_ASSERT_HPP
#define DOS_ASSERT_HPP
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "src/crypto/crypto.h"
+2 -2
View File
@@ -33,8 +33,8 @@
#ifndef FATAL_ASSERT_HPP
#define FATAL_ASSERT_HPP
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
static void fatal_error( const char *expression, const char *file, int line, const char *function )
{
+5 -5
View File
@@ -32,11 +32,11 @@
#include "src/include/config.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <errno.h>
#include <cerrno>
#include <clocale>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#if HAVE_LANGINFO_H
+5 -4
View File
@@ -33,14 +33,15 @@
#include "src/include/config.h"
#if !defined(HAVE_FORKPTY) || !defined(HAVE_CFMAKERAW)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/stropts.h>
#include <termios.h>
#include <unistd.h>
#include "src/util/pty_compat.h"
+5 -4
View File
@@ -33,11 +33,12 @@
#ifndef SELECT_HPP
#define SELECT_HPP
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <cassert>
#include <cerrno>
#include <csignal>
#include <cstring>
#include <sys/select.h>
#include <assert.h>
#include "src/util/fatal_assert.h"
#include "src/util/timestamp.h"
+3 -2
View File
@@ -30,9 +30,10 @@
also delete it here.
*/
#include <cstdio>
#include <cstring>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include "src/util/swrite.h"
+3 -3
View File
@@ -34,10 +34,10 @@
#include "src/util/timestamp.h"
#include <errno.h>
#include <cerrno>
#if HAVE_CLOCK_GETTIME
#include <time.h>
#include <ctime>
#endif
#if HAVE_MACH_ABSOLUTE_TIME
#include <mach/error.h>
@@ -45,7 +45,7 @@
#endif
#if HAVE_GETTIMEOFDAY
#include <sys/time.h>
#include <stdio.h>
#include <cstdio>
#endif
// On Apple systems CLOCK_MONOTONIC is unfortunately able to go
+1 -1
View File
@@ -33,7 +33,7 @@
#ifndef TIMESTAMP_HPP
#define TIMESTAMP_HPP
#include <stdint.h>
#include <cstdint>
void freeze_timestamp( void );
uint64_t frozen_timestamp( void );