Skip to content

Commit

Permalink
Use C++ includes (#308)
Browse files Browse the repository at this point in the history
Replaces stdio.h, stdlib.h, string.h, math.h, time.h, limits.h and othters with their C++ equivalents.
  • Loading branch information
wolfy1339 authored and jacob1 committed Jul 18, 2016
1 parent eafd811 commit b65e949
Show file tree
Hide file tree
Showing 26 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/Format.cpp
Expand Up @@ -5,7 +5,7 @@
#include <iostream>
#include <iterator>
#include <zlib.h>
#include <stdio.h>
#include <cstdio>
#include "Format.h"
#include "graphics/Graphics.h"

Expand Down
6 changes: 3 additions & 3 deletions src/Misc.cpp
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/types.h>
#include <cmath>
#include "Config.h"
Expand Down
4 changes: 2 additions & 2 deletions src/Misc.h
@@ -1,7 +1,7 @@
#ifndef UTILS_H
#define UTILS_H
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <sstream>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/Platform.cpp
Expand Up @@ -7,7 +7,7 @@
#include <windows.h>
#else
#include <unistd.h>
#include <time.h>
#include <ctime>
#include <sys/time.h>
#endif
#ifdef MACOSX
Expand Down
2 changes: 1 addition & 1 deletion src/PowderToyRenderer.cpp
@@ -1,6 +1,6 @@
#if defined(RENDERER)

#include <time.h>
#include <ctime>
#include <iostream>
#include <sstream>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/PowderToySDL.cpp
Expand Up @@ -2,7 +2,7 @@

#include <map>
#include <string>
#include <time.h>
#include <ctime>
#ifdef SDL_INC
#include "SDL/SDL.h"
#else
Expand Down
6 changes: 3 additions & 3 deletions src/Update.cpp
@@ -1,12 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#ifndef WIN
#include <sys/param.h>
#endif
#if !defined(MACOSX) && !defined(BSD)
#include <malloc.h>
#endif
#include <string.h>
#include <cstring>

#ifdef WIN
#include <windows.h>
Expand Down
10 changes: 5 additions & 5 deletions src/bson/BSON.cpp
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <limits.h>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <climits>

#include "BSON.h"

Expand Down
10 changes: 5 additions & 5 deletions src/bson/BSON.h
Expand Up @@ -21,11 +21,11 @@
#ifndef _BSON_H_
#define _BSON_H_

#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cstdarg>
#include "Config.h"

#if defined(LIN) || defined(USE_STDINT)
Expand Down
6 changes: 3 additions & 3 deletions src/client/Client.cpp
@@ -1,12 +1,12 @@
#include <stdlib.h>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <time.h>
#include <stdio.h>
#include <ctime>
#include <cstdio>
#include <deque>
#include <fstream>
#include <dirent.h>
Expand Down
2 changes: 1 addition & 1 deletion src/client/Download.cpp
@@ -1,4 +1,4 @@
#include <stdlib.h>
#include <cstdlib>
#include "Download.h"
#include "DownloadManager.h"
#include "HTTP.h"
Expand Down
2 changes: 1 addition & 1 deletion src/client/DownloadManager.h
@@ -1,7 +1,7 @@
#ifndef DOWNLOADMANAGER_H
#define DOWNLOADMANAGER_H
#include "common/tpt-thread.h"
#include <time.h>
#include <ctime>
#include <vector>
#include "common/Singleton.h"

Expand Down
8 changes: 4 additions & 4 deletions src/client/HTTP.cpp
Expand Up @@ -22,16 +22,16 @@

#include <string>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#ifndef WIN
#include <sys/param.h>
#endif
#if !defined(MACOSX) && !defined(BSD)
#include <malloc.h>
#endif
#include <time.h>
#include <ctime>
#ifdef WIN
#define _WIN32_WINNT 0x0501
//#include <iphlpapi.h>
Expand Down
2 changes: 1 addition & 1 deletion src/client/MD5.cpp
@@ -1,5 +1,5 @@
// based on public-domain code from Colin Plumb (1993)
#include <string.h>
#include <cstring>
#include "MD5.h"

static unsigned getu32(const unsigned char *addr)
Expand Down
2 changes: 1 addition & 1 deletion src/client/SaveInfo.h
Expand Up @@ -4,7 +4,7 @@
#include <list>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cstdlib>
#include <iostream>

class GameSave;
Expand Down
2 changes: 1 addition & 1 deletion src/client/requestbroker/ImageRequest.cpp
@@ -1,6 +1,6 @@
#include <iostream>
#include <typeinfo>
#include <time.h>
#include <ctime>
#include "ImageRequest.h"
#include "graphics/Graphics.h"
#include "client/HTTP.h"
Expand Down
2 changes: 1 addition & 1 deletion src/client/requestbroker/RequestBroker.cpp
Expand Up @@ -2,7 +2,7 @@
#include <iostream>
#include <typeinfo>
#include <sstream>
#include <time.h>
#include <ctime>
#include "RequestBroker.h"
#include "RequestListener.h"
#include "ThumbRenderRequest.h"
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/OpenGLDrawMethods.inl
@@ -1,5 +1,5 @@
#include "../data/font.h"
#include <math.h>
#include <cmath>

int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, const char *s, int r, int g, int b, int a)
{
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/RasterDrawMethods.inl
@@ -1,5 +1,5 @@
#include "font.h"
#include <math.h>
#include <cmath>

int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, const char *s, int r, int g, int b, int a)
{
Expand Down
4 changes: 2 additions & 2 deletions src/graphics/Renderer.cpp
@@ -1,8 +1,8 @@
#include <cmath>
#include <iostream>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "Config.h"
#include "Renderer.h"
#include "Graphics.h"
Expand Down
2 changes: 1 addition & 1 deletion src/gui/options/OptionsView.cpp
@@ -1,4 +1,4 @@
#include <stdio.h>
#include <cstdio>
#ifdef WIN
#include <direct.h>
#define getcwd _getcwd
Expand Down
2 changes: 1 addition & 1 deletion src/lua/CommandInterface.cpp
@@ -1,6 +1,6 @@
#include <iostream>
#include <string>
#include <string.h>
#include <cstring>
#if !defined(WIN) || defined(__GNUC__)
#include <strings.h>
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/lua/TPTScriptInterface.cpp
Expand Up @@ -2,11 +2,11 @@
#include <iostream>
#include <string>
#include <deque>
#include <string.h>
#include <cstring>
#ifdef MACOSX
#include <strings.h>
#endif
#include <stdlib.h>
#include <cstdlib>
#include "TPTScriptInterface.h"
#include "gui/game/GameModel.h"
#include "simulation/Air.h"
Expand Down
2 changes: 1 addition & 1 deletion src/powdertoyjava/OpenGLCanvasWin32.h
Expand Up @@ -2,7 +2,7 @@
#import <jawt_md.h>

#include <windows.h>
#include <assert.h>
#include <cassert>
#include <gl/gl.h>

int defaultPixelFormat(PIXELFORMATDESCRIPTOR* pfd);
Expand Down
2 changes: 1 addition & 1 deletion src/powdertoyjava/PowderToyJava.cpp
@@ -1,6 +1,6 @@
#if defined(USE_JNI)

#include <time.h>
#include <ctime>
#include <iostream>
#include <sstream>
#include <string>
Expand Down
10 changes: 5 additions & 5 deletions src/resampler/resampler.cpp
Expand Up @@ -12,11 +12,11 @@
// Dec. 31, 2008: v2.2: Bit more cleanup, released as public domain.
// June 4, 2012: v2.21: Switched to unlicense.org, integrated GCC fixes supplied by Peter Nagy <petern@crytek.com>, Anteru at anteru.net, and clay@coge.net,
// added Codeblocks project (for testing with MinGW and GCC), VS2008 static code analysis pass.
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#include <string.h>
#include <cstdlib>
#include <cmath>
#include <cfloat>
#include <cassert>
#include <cstring>
#include "resampler.h"

#define resampler_assert assert
Expand Down

0 comments on commit b65e949

Please sign in to comment.