Skip to content

Commit

Permalink
Switch to C++ versions of standard C headers
Browse files Browse the repository at this point in the history
  • Loading branch information
achernya committed Jul 30, 2023
1 parent 68024ad commit 1eb3d2c
Show file tree
Hide file tree
Showing 56 changed files with 205 additions and 191 deletions.
4 changes: 2 additions & 2 deletions src/crypto/base64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions src/crypto/crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions src/crypto/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/ocb_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/prng.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
23 changes: 12 additions & 11 deletions src/examples/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/examples/decrypt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
also delete it here.
*/

#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <sstream>

Expand Down
2 changes: 1 addition & 1 deletion src/examples/encrypt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
also delete it here.
*/

#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <sstream>

Expand Down
4 changes: 2 additions & 2 deletions src/examples/ntester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 11 additions & 10 deletions src/examples/parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
31 changes: 16 additions & 15 deletions src/examples/termemu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/ioctl.h>
#include <sys/stat.h>

#include <fcntl.h>
#include <termios.h>
#include <sys/types.h>
#include <pwd.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <exception>
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>

#if HAVE_PTY_H
#include <pty.h>
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/mosh-client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
35 changes: 18 additions & 17 deletions src/frontend/mosh-server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <termios.h>
#include <unistd.h>
#include <typeinfo>

#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.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 <pwd.h>
#include <typeinfo>
#include <signal.h>
#include <termios.h>
#include <unistd.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>
Expand Down
19 changes: 10 additions & 9 deletions src/frontend/stmclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 3 additions & 2 deletions src/frontend/stmclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/terminaloverlay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/terminaloverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/network/network.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@

#include "src/include/config.h"

#include <cassert>
#include <cerrno>
#include <cstring>

#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#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"
Expand Down
Loading

0 comments on commit 1eb3d2c

Please sign in to comment.