2024-04-16 22:43 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000906Spring engineGeneralpublic2008-04-30 01:25
Reporterzenzike 
Assigned ToAuswaschbar 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000906: [patch] using namespace std; in header files removed
DescriptionThe std namespace is used in many header files. This leads to namespace pollution, and is discussed in (http://spring.clan-sy.com/phpbb/viewtopic.php?f=12&t=146330).

This patch removes all these using namespace statements, defines std:: types as appropriate in header files, and places using namespace std; statements in cpp files that require them.
Additional InformationIndex: /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h
===================================================================
--- /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h (revision 5796)
+++ /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h (working copy)
@@ -44,8 +44,6 @@
 
 const char AI_NAME[]="ABIC"; // probably should read this from config file or something
 
-using namespace std;
-
 #ifdef WIN32
     #define AILOG_PATH "AI\\Bot-libs\\"
 #else
@@ -92,8 +90,8 @@
     ::IGlobalAICallback* globalaicallback;
     ::IAICallback* aicallback;
 
- set<int> myUnits;
- set<int> enemies;
+ std::set<int> myUnits;
+ std::set<int> enemies;
     
 private:
   // FILE *logfile;
Index: /spring/rts/System/Platform/Win/DxSound.h
===================================================================
--- /spring/rts/System/Platform/Win/DxSound.h (revision 5796)
+++ /spring/rts/System/Platform/Win/DxSound.h (working copy)
@@ -25,7 +25,6 @@
 #include "OggStream.h"
 
 class CWorldObject;
-using namespace std;
 
 class CDxSound: public CSound
 {
@@ -33,7 +32,7 @@
     CDxSound();
     virtual ~CDxSound();
     void Update();
- unsigned int GetWaveId(const string& path, bool hardFail);
+ unsigned int GetWaveId(const std::string& path, bool hardFail);
     void PlaySample(int id, float volume = 1.0f);
     void PlaySample(int id, const float3& p, float volume = 1.0f);
 
@@ -57,7 +56,7 @@
     int InitFile(const string& name);
 
     struct SoundInfo {
- vector<int> freebufs;
+ std::vector<int> freebufs;
         int firstBuf;
     };
     struct PlayingSound {
@@ -65,10 +64,10 @@
         float volume;
     };
 
- map<string, int> waveid;
- vector<SoundInfo*> loadedSounds;
- list<PlayingSound> playingSounds;
- vector<int> buf2id;
+ std::map<std::string, int> waveid;
+ std::vector<SoundInfo*> loadedSounds;
+ std::list<PlayingSound> playingSounds;
+ std::vector<int> buf2id;
     float globalVolume;
 
     std::vector<LPDIRECTSOUNDBUFFER> buffers;
@@ -74,7 +73,7 @@
     std::vector<LPDIRECTSOUNDBUFFER> buffers;
 
     HRESULT RestoreBuffers(int num);
- bool CreateStaticBuffer(const string& name);
+ bool CreateStaticBuffer(const std::string& name);
     HRESULT FillBuffer();
     bool ReadWAV (const char* name, Uint8* buf, int fileSize, Uint8** soundData, Uint32* bufferSize, WAVEFORMATEX& wf);
 
Index: /spring/tools/MapConv/FeatureCreator.h
===================================================================
--- /spring/tools/MapConv/FeatureCreator.h (revision 5796)
+++ /spring/tools/MapConv/FeatureCreator.h (working copy)
@@ -6,8 +6,6 @@
 #include "mapfile.h"
 #include "Bitmap.h"
 
-using namespace std;
-
 class CFeatureCreator
 {
 public:
Index: /spring/tools/MapConv/jpeglib.h
===================================================================
--- /spring/tools/MapConv/jpeglib.h (revision 5796)
+++ /spring/tools/MapConv/jpeglib.h (working copy)
@@ -47,7 +47,6 @@
 #include <tchar.h>
 #include <windows.h>
 
-using namespace std;
 /*
  * jconfig.doc
  *
Index: /spring/tools/MapConv/TileHandler.h
===================================================================
--- /spring/tools/MapConv/TileHandler.h (revision 5796)
+++ /spring/tools/MapConv/TileHandler.h (working copy)
@@ -6,8 +6,6 @@
 #include <fstream>
 #include "Bitmap.h"
 
-using namespace std;
-
 #define MAX_MAP_SIZE 50
 #define MAX_TILES (MAX_MAP_SIZE*MAX_MAP_SIZE*16*16)
 
@@ -16,9 +14,9 @@
 public:
     CTileHandler();
     ~CTileHandler(void);
- void LoadTexture(string name,unsigned int x,unsigned int y,int filter);
+ void LoadTexture(std::string name,unsigned int x,unsigned int y,int filter);
     void ProcessTiles(float compressFactor,int quality,string format);
- void SaveData(ofstream& ofs);
+ void SaveData(std::ofstream& ofs);
     void ReadTile(int xpos, int ypos, char *destbuf, char *sourcebuf);
     int FindCloseTile(CBitmap* bm,int forbidden);
     void ProcessTiles2(void);
@@ -24,8 +22,8 @@
     void ProcessTiles2(void);
 
     int GetFileSize(void);
- void AddExternalTileFile(string file);
- void SetOutputFile(string file);
+ void AddExternalTileFile(std::string file);
+ void SetOutputFile(std::string file);
     
     int max_size,max_tiles;
     
@@ -34,7 +32,7 @@
     int ysize;
 
     CBitmap* tiles[MAX_TILES];
- vector<char*> newTiles;
+ std::vector<char*> newTiles;
     int tileUse[MAX_TILES];
     int usedTiles;
     int numExternalTile;
@@ -52,10 +50,10 @@
     int meanDirThreshold;
     int borderThreshold;
     
- vector<string> externalFiles;
- vector<int> externalFileTileSize;
+ std::vector<std::string> externalFiles;
+ std::vector<int> externalFileTileSize;
 
- string myTileFile;
+ std::string myTileFile;
 };
 
 extern CTileHandler tileHandler;
Index: /spring/tools/unitsync/javabind.cpp
===================================================================
--- /spring/tools/unitsync/javabind.cpp (revision 5796)
+++ /spring/tools/unitsync/javabind.cpp (working copy)
@@ -642,7 +642,7 @@
             std::vector<string> f = CFileHandler::FindFiles(path, patt);
             string s = "";
             if(f.empty()==false){
- for(vector<string>::iterator i = f.begin(); i != f.end(); ++i){
+ for(std::vector<std::string>::iterator i = f.begin(); i != f.end(); ++i){
                     string q = *i;
                     if(s != string("")){
                         s += ",";
Index: /spring/tools/unitsync/Syncer.cpp
===================================================================
--- /spring/tools/unitsync/Syncer.cpp (revision 5796)
+++ /spring/tools/unitsync/Syncer.cpp (working copy)
@@ -9,6 +9,7 @@
 #include <algorithm>
 #include <sstream>
 
+using namespace std;
 
 CSyncer::CSyncer(int id)
 : unitsLeft(-1)
Index: /spring/tools/unitsync/Syncer.h
===================================================================
--- /spring/tools/unitsync/Syncer.h (revision 5796)
+++ /spring/tools/unitsync/Syncer.h (working copy)
@@ -5,9 +5,6 @@
 #include <vector>
 #include <set>
 
-using namespace std;
-
-
 typedef unsigned int crc_t;
 
 
@@ -17,7 +14,7 @@
     crc_t cob;
     crc_t model;
 
- string fullName;
+ std::string fullName;
 };
 
 
@@ -22,7 +19,7 @@
 
 
 struct DisabledUnit {
- set<int> clients;
+ std::set<int> clients;
 };
 
 
@@ -31,13 +28,13 @@
     public:
         CSyncer(int id);
         ~CSyncer(void);
- string GetCurrentList();
- void InstallClientDiff(const string& diff);
+ std::string GetCurrentList();
+ void InstallClientDiff(const std::string& diff);
         virtual int ProcessUnits(bool checksum = true);
         
         int GetUnitCount();
- string GetUnitName(int unit);
- string GetFullUnitName(int unit);
+ std::string GetUnitName(int unit);
+ std::string GetFullUnitName(int unit);
         bool IsUnitDisabled(int unit);
         bool IsUnitDisabledByClient(int unit, int clientId);
 
@@ -44,7 +41,7 @@
     protected:
         void LoadUnits(bool checksum);
         void RemoveClient(int id);
- crc_t CalculateCRC(const string& fileName);
+ crc_t CalculateCRC(const std::string& fileName);
 
     protected:
         int localId;
@@ -50,9 +47,9 @@
         int localId;
         int unitsLeft; // decrements for each ProcessUnits() call,
                        // causes LoadUnits() to be called when set to -1
- vector<string> unitIds;
- map<string, Unit> units;
- map<string, DisabledUnit> disabledUnits;
+ std::vector<std::string> unitIds;
+ std::map<std::string, Unit> units;
+ std::map<std::string, DisabledUnit> disabledUnits;
 };
 
 #endif
Index: /spring/tools/unitsync/SyncServer.cpp
===================================================================
--- /spring/tools/unitsync/SyncServer.cpp (revision 5796)
+++ /spring/tools/unitsync/SyncServer.cpp (working copy)
@@ -2,6 +2,8 @@
 #include "SyncServer.h"
 #include <sstream>
 
+using namespace std;
+
 CSyncServer::CSyncServer(int id) :
     CSyncer(id)
 {
Index: /spring/tools/unitsync/SyncServer.h
===================================================================
--- /spring/tools/unitsync/SyncServer.h (revision 5796)
+++ /spring/tools/unitsync/SyncServer.h (working copy)
@@ -5,10 +5,10 @@
 #include <string>
 #include <set>
 
-typedef map<string, Unit> unitlist_t;
+typedef std::map<std::string, Unit> unitlist_t;
 
 struct MissingList {
- set<int> clients;
+ std::set<int> clients;
 };
 
 class CSyncServer :
@@ -15,10 +15,10 @@
     public CSyncer
 {
 protected:
- map<int, unitlist_t> clientLists;
+ std::map<int, unitlist_t> clientLists;
     int lastDiffClient;
     bool lastWasRemove;
- map<string, MissingList> curDiff;
+ std::map<std::string, MissingList> curDiff;
     void InitMasterList();
 public:
     CSyncServer(int id);
@@ -23,9 +23,9 @@
 public:
     CSyncServer(int id);
     ~CSyncServer(void);
- void AddClient(int id, const string& unitList);
+ void AddClient(int id, const std::string& unitList);
     void RemoveClient(int id);
- const string GetClientDiff(int id);
+ const std::string GetClientDiff(int id);
     virtual int ProcessUnits();
 };
 
Index: /spring/tools/Upspring/src/upspring/EditorDef.h
===================================================================
--- /spring/tools/Upspring/src/upspring/EditorDef.h (revision 5796)
+++ /spring/tools/Upspring/src/upspring/EditorDef.h (working copy)
@@ -16,8 +16,6 @@
 #pragma warning(disable: 4312 4311)

 #endif

 

-using namespace std;

-

 typedef unsigned char uchar;

 typedef unsigned long ulong;

 typedef unsigned int uint;

@@ -34,10 +32,10 @@
  */

 #ifdef _MSC_VER

     #define UPS_HASH_SET stdext::hash_set

- #define UPS_HASH_SET_H <hash_set>

+ #define UPS_HASH_SET_H <std::hash_set>

 

     #define UPS_HASH_MAP stdext::hash_map

- #define UPS_HASH_MAP_H <hash_map>

+ #define UPS_HASH_MAP_H <std::hash_map>

 #elif defined(__GNUC__)

     #define UPS_HASH_SET __gnu_cxx::hash_set

     #define UPS_HASH_SET_H <ext/hash_set>

@@ -117,7 +115,7 @@
     bool Load ();

     bool Save ();

 

- set<string> archives;

+ std::set<std::string> archives;

 };

 

 class content_error : public std::exception

@@ -123,13 +121,13 @@
 class content_error : public std::exception

 {

 public:

- content_error(const string& s) :

+ content_error(const std::string& s) :

       errMsg (s) {}

 

- string errMsg;

+ std::string errMsg;

 };

 

-inline void stringlwr(string& str) {

+inline void stringlwr(std::string& str) {

     transform (str.begin(),str.end(), str.begin(), tolower);

 }

 

@@ -134,11 +132,11 @@
 }

 

 

-bool FileSaveDlg (const char *msg, const char *pattern, string& fn);

-bool FileOpenDlg (const char *msg, const char *pattern, string& fn);

+bool FileSaveDlg (const char *msg, const char *pattern, std::string& fn);

+bool FileOpenDlg (const char *msg, const char *pattern, std::string& fn);

 bool SelectDirectory(const char *msg, std::string& dir);

 

-extern string applicationPath;

+extern std::string applicationPath;

 

 template<typename InputIterator, typename EqualityComparable>

 int element_index(InputIterator first, InputIterator last, const EqualityComparable& value) {

Index: /spring/tools/Upspring/src/upspring/Model.h
===================================================================
--- /spring/tools/Upspring/src/upspring/Model.h (revision 5796)
+++ /spring/tools/Upspring/src/upspring/Model.h (working copy)
@@ -20,8 +20,6 @@
     class Object;

 };

 

-using namespace std;

-

 class Texture;

 

 struct Poly;

@@ -61,7 +59,7 @@
     void RotateVerts();

 

     vector <int> verts;

- string texname;

+ std::string texname;

     Vector3 color;

     int taColor; // TA indexed color

     RefPtr<Texture> texture;

@@ -173,8 +171,8 @@
 

     ~PolyMesh();

 

- vector <Vertex> verts;

- vector <Poly*> poly;

+ std::vector <Vertex> verts;

+ std::vector <Poly*> poly;

 

     void Draw(ModelDrawer* drawer, Model* mdl, MdlObject* o);

     Geometry* Clone();

@@ -180,7 +178,7 @@
     Geometry* Clone();

     void Transform(const Matrix& transform);

     PolyMesh* ToPolyMesh(); // clones

- vector<Triangle> MakeTris();

+ std::vector<Triangle> MakeTris();

 

     static bool IsEqualVertexTC(Vertex& a, Vertex& b);

     static bool IsEqualVertexTCNormal(Vertex& a, Vertex& b);

@@ -266,7 +264,7 @@
 

     AnimationInfo animInfo;

 

- string name;

+ std::string name;

     bool isSelected;

     bool isOpen; // childs visible in object browser

     IKinfo ikInfo;

@@ -272,7 +270,7 @@
     IKinfo ikInfo;

 

     MdlObject *parent;

- vector <MdlObject*> childs;

+ std::vector <MdlObject*> childs;

 

 #ifndef SWIG

     csurf::Object* csurfobj;

@@ -352,9 +350,9 @@
     bool ImportUVCoords (Model* other, IProgressCtl& progctl=IProgressCtl());

 

     void InsertModel (MdlObject *obj, Model *sub);

- vector<MdlObject*> GetSelectedObjects ();

- vector<MdlObject*> GetObjectList (); // returns all objects

- vector<PolyMesh*> GetPolyMeshList ();

+ std::vector<MdlObject*> GetSelectedObjects ();

+ std::vector<MdlObject*> GetObjectList (); // returns all objects

+ std::vector<PolyMesh*> GetPolyMeshList ();

     void DeleteObject (MdlObject *obj);

     void ReplaceObject (MdlObject *oldObj, MdlObject *newObj);

     void EstimateMidPosition ();

TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon std_headers.patch (12,739 bytes) 2008-04-28 16:39 -
    Index: /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h
    ===================================================================
    --- /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h	(revision 5796)
    +++ /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h	(working copy)
    @@ -44,8 +44,6 @@
     
     const char AI_NAME[]="ABIC"; // probably should read this from config file or something
     
    -using namespace std;
    -
     #ifdef WIN32
     	#define AILOG_PATH "AI\\Bot-libs\\"
     #else
    @@ -92,8 +90,8 @@
     	::IGlobalAICallback* globalaicallback;
     	::IAICallback* aicallback;
     
    -	set<int> myUnits;
    -	set<int> enemies;
    +	std::set<int> myUnits;
    +	std::set<int> enemies;
         
     private:
       //  FILE *logfile;
    Index: /spring/rts/System/Platform/Win/DxSound.h
    ===================================================================
    --- /spring/rts/System/Platform/Win/DxSound.h	(revision 5796)
    +++ /spring/rts/System/Platform/Win/DxSound.h	(working copy)
    @@ -25,7 +25,6 @@
     #include "OggStream.h"
     
     class CWorldObject;
    -using namespace std;
     
     class CDxSound: public CSound
     {
    @@ -33,7 +32,7 @@
     	CDxSound();
     	virtual ~CDxSound();
     	void Update();
    -	unsigned int GetWaveId(const string& path, bool hardFail);
    +	unsigned int GetWaveId(const std::string& path, bool hardFail);
     	void PlaySample(int id, float volume = 1.0f);
     	void PlaySample(int id, const float3& p, float volume = 1.0f);
     
    @@ -57,7 +56,7 @@
     	int InitFile(const string& name);
     
     	struct SoundInfo {
    -		vector<int> freebufs;
    +	    std::vector<int> freebufs;
     		int firstBuf;
     	};
     	struct PlayingSound {
    @@ -65,10 +64,10 @@
     		float volume;
     	};
     
    -	map<string, int> waveid;
    -	vector<SoundInfo*> loadedSounds;
    -	list<PlayingSound> playingSounds;
    -	vector<int> buf2id;
    +	std::map<std::string, int> waveid;
    +	std::vector<SoundInfo*> loadedSounds;
    +	std::list<PlayingSound> playingSounds;
    +	std::vector<int> buf2id;
     	float globalVolume;
     
     	std::vector<LPDIRECTSOUNDBUFFER> buffers;
    @@ -74,7 +73,7 @@
     	std::vector<LPDIRECTSOUNDBUFFER> buffers;
     
     	HRESULT RestoreBuffers(int num);
    -	bool CreateStaticBuffer(const string& name);
    +	bool CreateStaticBuffer(const std::string& name);
     	HRESULT FillBuffer();
     	bool ReadWAV (const char* name, Uint8* buf, int fileSize, Uint8** soundData, Uint32* bufferSize, WAVEFORMATEX& wf);
     
    Index: /spring/tools/MapConv/FeatureCreator.h
    ===================================================================
    --- /spring/tools/MapConv/FeatureCreator.h	(revision 5796)
    +++ /spring/tools/MapConv/FeatureCreator.h	(working copy)
    @@ -6,8 +6,6 @@
     #include "mapfile.h"
     #include "Bitmap.h"
     
    -using namespace std;
    -
     class CFeatureCreator
     {
     public:
    Index: /spring/tools/MapConv/jpeglib.h
    ===================================================================
    --- /spring/tools/MapConv/jpeglib.h	(revision 5796)
    +++ /spring/tools/MapConv/jpeglib.h	(working copy)
    @@ -47,7 +47,6 @@
     #include <tchar.h>
     #include <windows.h>
     
    -using namespace std;
     /*
      * jconfig.doc
      *
    Index: /spring/tools/MapConv/TileHandler.h
    ===================================================================
    --- /spring/tools/MapConv/TileHandler.h	(revision 5796)
    +++ /spring/tools/MapConv/TileHandler.h	(working copy)
    @@ -6,8 +6,6 @@
     #include <fstream>
     #include "Bitmap.h"
     
    -using namespace std;
    -
     #define MAX_MAP_SIZE 50	
     #define MAX_TILES (MAX_MAP_SIZE*MAX_MAP_SIZE*16*16)
     
    @@ -16,9 +14,9 @@
     public:
     	CTileHandler();
     	~CTileHandler(void);
    -	void LoadTexture(string name,unsigned int x,unsigned int y,int filter);
    +	void LoadTexture(std::string name,unsigned int x,unsigned int y,int filter);
     	void ProcessTiles(float compressFactor,int quality,string format);
    -	void SaveData(ofstream& ofs);
    +	void SaveData(std::ofstream& ofs);
     	void ReadTile(int xpos, int ypos, char *destbuf, char *sourcebuf);
     	int FindCloseTile(CBitmap* bm,int forbidden);
     	void ProcessTiles2(void);
    @@ -24,8 +22,8 @@
     	void ProcessTiles2(void);
     
     	int GetFileSize(void);
    -	void AddExternalTileFile(string file);
    -	void SetOutputFile(string file);	
    +	void AddExternalTileFile(std::string file);
    +	void SetOutputFile(std::string file);	
     	
     	int max_size,max_tiles;
     	
    @@ -34,7 +32,7 @@
     	int ysize;
     
         CBitmap* tiles[MAX_TILES];
    -	vector<char*> newTiles;
    +    std::vector<char*> newTiles;
         int tileUse[MAX_TILES];
     	int usedTiles;
     	int numExternalTile;
    @@ -52,10 +50,10 @@
     	int meanDirThreshold;
     	int borderThreshold;	
     	
    -	vector<string> externalFiles;
    -	vector<int> externalFileTileSize;
    +	std::vector<std::string> externalFiles;
    +	std::vector<int> externalFileTileSize;
     
    -	string myTileFile;
    +	std::string myTileFile;
     };
     
     extern CTileHandler tileHandler;
    Index: /spring/tools/unitsync/javabind.cpp
    ===================================================================
    --- /spring/tools/unitsync/javabind.cpp	(revision 5796)
    +++ /spring/tools/unitsync/javabind.cpp	(working copy)
    @@ -642,7 +642,7 @@
     			std::vector<string> f = CFileHandler::FindFiles(path, patt);
     			string s = "";
     			if(f.empty()==false){
    -				for(vector<string>::iterator i = f.begin(); i != f.end(); ++i){
    +				for(std::vector<std::string>::iterator i = f.begin(); i != f.end(); ++i){
     					string q = *i;
     					if(s != string("")){
     						s += ",";
    Index: /spring/tools/unitsync/Syncer.cpp
    ===================================================================
    --- /spring/tools/unitsync/Syncer.cpp	(revision 5796)
    +++ /spring/tools/unitsync/Syncer.cpp	(working copy)
    @@ -9,6 +9,7 @@
     #include <algorithm>
     #include <sstream>
     
    +using namespace std;
     
     CSyncer::CSyncer(int id)
     : unitsLeft(-1)
    Index: /spring/tools/unitsync/Syncer.h
    ===================================================================
    --- /spring/tools/unitsync/Syncer.h	(revision 5796)
    +++ /spring/tools/unitsync/Syncer.h	(working copy)
    @@ -5,9 +5,6 @@
     #include <vector>
     #include <set>
     
    -using namespace std;
    -
    -
     typedef unsigned int crc_t;
     
     
    @@ -17,7 +14,7 @@
     	crc_t cob;
     	crc_t model;
     
    -	string fullName;
    +	std::string fullName;
     };
     
     
    @@ -22,7 +19,7 @@
     
     
     struct DisabledUnit {
    -	set<int> clients;
    +    std::set<int> clients;
     };
     
     
    @@ -31,13 +28,13 @@
     	public:
     		CSyncer(int id);
     		~CSyncer(void);
    -		string GetCurrentList();
    -		void InstallClientDiff(const string& diff);
    +		std::string GetCurrentList();
    +		void InstallClientDiff(const std::string& diff);
     		virtual int ProcessUnits(bool checksum = true);
     		
     		int GetUnitCount();
    -		string GetUnitName(int unit);
    -		string GetFullUnitName(int unit);
    +		std::string GetUnitName(int unit);
    +		std::string GetFullUnitName(int unit);
     		bool IsUnitDisabled(int unit);
     		bool IsUnitDisabledByClient(int unit, int clientId);
     
    @@ -44,7 +41,7 @@
     	protected:
     		void LoadUnits(bool checksum);
     		void RemoveClient(int id);
    -		crc_t CalculateCRC(const string& fileName);
    +		crc_t CalculateCRC(const std::string& fileName);
     
     	protected:
     		int localId;
    @@ -50,9 +47,9 @@
     		int localId;
     		int unitsLeft; // decrements for each ProcessUnits() call,
     		               // causes LoadUnits() to be called when set to -1
    -		vector<string> unitIds;
    -		map<string, Unit> units;
    -		map<string, DisabledUnit> disabledUnits;
    +		std::vector<std::string> unitIds;
    +		std::map<std::string, Unit> units;
    +		std::map<std::string, DisabledUnit> disabledUnits;
     };
     
     #endif
    Index: /spring/tools/unitsync/SyncServer.cpp
    ===================================================================
    --- /spring/tools/unitsync/SyncServer.cpp	(revision 5796)
    +++ /spring/tools/unitsync/SyncServer.cpp	(working copy)
    @@ -2,6 +2,8 @@
     #include "SyncServer.h"
     #include <sstream>
     
    +using namespace std;
    +
     CSyncServer::CSyncServer(int id) :
     	CSyncer(id)
     {
    Index: /spring/tools/unitsync/SyncServer.h
    ===================================================================
    --- /spring/tools/unitsync/SyncServer.h	(revision 5796)
    +++ /spring/tools/unitsync/SyncServer.h	(working copy)
    @@ -5,10 +5,10 @@
     #include <string>
     #include <set>
     
    -typedef map<string, Unit> unitlist_t;
    +typedef std::map<std::string, Unit> unitlist_t;
     
     struct MissingList {
    -	set<int> clients;
    +    std::set<int> clients;
     };
     
     class CSyncServer : 
    @@ -15,10 +15,10 @@
     	public CSyncer
     {
     protected:
    -	map<int, unitlist_t> clientLists;
    +    std::map<int, unitlist_t> clientLists;
     	int lastDiffClient;
     	bool lastWasRemove;
    -	map<string, MissingList> curDiff;
    +	std::map<std::string, MissingList> curDiff;
     	void InitMasterList();
     public:
     	CSyncServer(int id);
    @@ -23,9 +23,9 @@
     public:
     	CSyncServer(int id);
     	~CSyncServer(void);
    -	void AddClient(int id, const string& unitList);
    +	void AddClient(int id, const std::string& unitList);
     	void RemoveClient(int id);
    -	const string GetClientDiff(int id);
    +	const std::string GetClientDiff(int id);
     	virtual int ProcessUnits();
     };
     
    Index: /spring/tools/Upspring/src/upspring/EditorDef.h
    ===================================================================
    --- /spring/tools/Upspring/src/upspring/EditorDef.h	(revision 5796)
    +++ /spring/tools/Upspring/src/upspring/EditorDef.h	(working copy)
    @@ -16,8 +16,6 @@
     #pragma warning(disable: 4312 4311)
    
     #endif 
    
     
    
    -using namespace std;
    
    -
    
     typedef unsigned char uchar;
    
     typedef unsigned long ulong;
    
     typedef unsigned int uint;
    
    @@ -34,10 +32,10 @@
      */
    
     #ifdef _MSC_VER
    
     	#define UPS_HASH_SET stdext::hash_set
    
    -	#define UPS_HASH_SET_H <hash_set>
    
    +	#define UPS_HASH_SET_H <std::hash_set>
    
     
    
     	#define UPS_HASH_MAP stdext::hash_map
    
    -	#define UPS_HASH_MAP_H <hash_map>
    
    +	#define UPS_HASH_MAP_H <std::hash_map>
    
     #elif defined(__GNUC__)
    
     	#define UPS_HASH_SET __gnu_cxx::hash_set
    
     	#define UPS_HASH_SET_H <ext/hash_set>
    
    @@ -117,7 +115,7 @@
     	bool Load ();
    
     	bool Save ();
    
     
    
    -	set<string> archives;
    
    +	std::set<std::string> archives;
    
     };
    
     
    
     class content_error : public std::exception
    
    @@ -123,13 +121,13 @@
     class content_error : public std::exception
    
     {
    
     public:
    
    -	content_error(const string& s) :
    
    +	content_error(const std::string& s) :
    
     	  errMsg (s) {}
    
     
    
    -    string errMsg;
    
    +	std::string errMsg;
    
     };
    
     
    
    -inline void stringlwr(string& str) {
    
    +inline void stringlwr(std::string& str) {
    
     	transform (str.begin(),str.end(), str.begin(), tolower);
    
     }
    
     
    
    @@ -134,11 +132,11 @@
     }
    
     
    
     
    
    -bool FileSaveDlg (const char *msg, const char *pattern, string& fn);
    
    -bool FileOpenDlg (const char *msg, const char *pattern, string& fn);
    
    +bool FileSaveDlg (const char *msg, const char *pattern, std::string& fn);
    
    +bool FileOpenDlg (const char *msg, const char *pattern, std::string& fn);
    
     bool SelectDirectory(const char *msg, std::string& dir);
    
     
    
    -extern string applicationPath;
    
    +extern std::string applicationPath;
    
     
    
     template<typename InputIterator, typename EqualityComparable>
    
     int element_index(InputIterator first, InputIterator last, const EqualityComparable& value) {
    
    Index: /spring/tools/Upspring/src/upspring/Model.h
    ===================================================================
    --- /spring/tools/Upspring/src/upspring/Model.h	(revision 5796)
    +++ /spring/tools/Upspring/src/upspring/Model.h	(working copy)
    @@ -20,8 +20,6 @@
     	class Object;
    
     };
    
     
    
    -using namespace std;
    
    -
    
     class Texture;
    
     
    
     struct Poly;
    
    @@ -61,7 +59,7 @@
     	void RotateVerts();
    
     
    
     	vector <int> verts;
    
    -	string texname;
    
    +	std::string texname;
    
     	Vector3 color;
    
     	int taColor; // TA indexed color
    
     	RefPtr<Texture> texture;
    
    @@ -173,8 +171,8 @@
     
    
     	~PolyMesh();
    
     
    
    -	vector <Vertex> verts;
    
    -	vector <Poly*> poly;
    
    +	std::vector <Vertex> verts;
    
    +	std::vector <Poly*> poly;
    
     
    
     	void Draw(ModelDrawer* drawer, Model* mdl, MdlObject* o);
    
     	Geometry* Clone();
    
    @@ -180,7 +178,7 @@
     	Geometry* Clone();
    
     	void Transform(const Matrix& transform);
    
     	PolyMesh* ToPolyMesh(); // clones
    
    -	vector<Triangle> MakeTris();
    
    +	std::vector<Triangle> MakeTris();
    
     
    
     	static bool IsEqualVertexTC(Vertex& a, Vertex& b);
    
     	static bool IsEqualVertexTCNormal(Vertex& a, Vertex& b);
    
    @@ -266,7 +264,7 @@
     
    
     	AnimationInfo animInfo;
    
     
    
    -	string name;
    
    +	std::string name;
    
     	bool isSelected;
    
     	bool isOpen; // childs visible in object browser
    
     	IKinfo ikInfo;
    
    @@ -272,7 +270,7 @@
     	IKinfo ikInfo;
    
     
    
     	MdlObject *parent;
    
    -	vector <MdlObject*> childs;
    
    +	std::vector <MdlObject*> childs;
    
     
    
     #ifndef SWIG
    
     	csurf::Object* csurfobj;
    
    @@ -352,9 +350,9 @@
     	bool ImportUVCoords (Model* other, IProgressCtl& progctl=IProgressCtl());
    
     
    
     	void InsertModel (MdlObject *obj, Model *sub);
    
    -	vector<MdlObject*> GetSelectedObjects ();
    
    -	vector<MdlObject*> GetObjectList (); // returns all objects
    
    -	vector<PolyMesh*> GetPolyMeshList ();
    
    +	std::vector<MdlObject*> GetSelectedObjects ();
    
    +	std::vector<MdlObject*> GetObjectList (); // returns all objects
    
    +	std::vector<PolyMesh*> GetPolyMeshList ();
    
     	void DeleteObject (MdlObject *obj);
    
     	void ReplaceObject (MdlObject *oldObj, MdlObject *newObj);
    
     	void EstimateMidPosition ();
    
    
    
    patch file icon std_headers.patch (12,739 bytes) 2008-04-28 16:39 +

-Relationships
+Relationships

-Notes

~0002175

zenzike (reporter)

Index: /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h
===================================================================
--- /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h (revision 5796)
+++ /spring/rts/ExternalAI/GlobalAICInterface/AbicProxy.h (working copy)
@@ -44,8 +44,6 @@
 
 const char AI_NAME[]="ABIC"; // probably should read this from config file or something
 
-using namespace std;
-
 #ifdef WIN32
     #define AILOG_PATH "AI\\Bot-libs\\"
 #else
@@ -92,8 +90,8 @@
     ::IGlobalAICallback* globalaicallback;
     ::IAICallback* aicallback;
 
- set<int> myUnits;
- set<int> enemies;
+ std::set<int> myUnits;
+ std::set<int> enemies;
     
 private:
   // FILE *logfile;
Index: /spring/rts/System/Platform/Win/DxSound.h
===================================================================
--- /spring/rts/System/Platform/Win/DxSound.h (revision 5796)
+++ /spring/rts/System/Platform/Win/DxSound.h (working copy)
@@ -25,7 +25,6 @@
 #include "OggStream.h"
 
 class CWorldObject;
-using namespace std;
 
 class CDxSound: public CSound
 {
@@ -33,7 +32,7 @@
     CDxSound();
     virtual ~CDxSound();
     void Update();
- unsigned int GetWaveId(const string& path, bool hardFail);
+ unsigned int GetWaveId(const std::string& path, bool hardFail);
     void PlaySample(int id, float volume = 1.0f);
     void PlaySample(int id, const float3& p, float volume = 1.0f);
 
@@ -57,7 +56,7 @@
     int InitFile(const string& name);
 
     struct SoundInfo {
- vector<int> freebufs;
+ std::vector<int> freebufs;
         int firstBuf;
     };
     struct PlayingSound {
@@ -65,10 +64,10 @@
         float volume;
     };
 
- map<string, int> waveid;
- vector<SoundInfo*> loadedSounds;
- list<PlayingSound> playingSounds;
- vector<int> buf2id;
+ std::map<std::string, int> waveid;
+ std::vector<SoundInfo*> loadedSounds;
+ std::list<PlayingSound> playingSounds;
+ std::vector<int> buf2id;
     float globalVolume;
 
     std::vector<LPDIRECTSOUNDBUFFER> buffers;
@@ -74,7 +73,7 @@
     std::vector<LPDIRECTSOUNDBUFFER> buffers;
 
     HRESULT RestoreBuffers(int num);
- bool CreateStaticBuffer(const string& name);
+ bool CreateStaticBuffer(const std::string& name);
     HRESULT FillBuffer();
     bool ReadWAV (const char* name, Uint8* buf, int fileSize, Uint8** soundData, Uint32* bufferSize, WAVEFORMATEX& wf);
 
Index: /spring/tools/MapConv/FeatureCreator.h
===================================================================
--- /spring/tools/MapConv/FeatureCreator.h (revision 5796)
+++ /spring/tools/MapConv/FeatureCreator.h (working copy)
@@ -6,8 +6,6 @@
 #include "mapfile.h"
 #include "Bitmap.h"
 
-using namespace std;
-
 class CFeatureCreator
 {
 public:
Index: /spring/tools/MapConv/jpeglib.h
===================================================================
--- /spring/tools/MapConv/jpeglib.h (revision 5796)
+++ /spring/tools/MapConv/jpeglib.h (working copy)
@@ -47,7 +47,6 @@
 #include <tchar.h>
 #include <windows.h>
 
-using namespace std;
 /*
  * jconfig.doc
  *
Index: /spring/tools/MapConv/TileHandler.h
===================================================================
--- /spring/tools/MapConv/TileHandler.h (revision 5796)
+++ /spring/tools/MapConv/TileHandler.h (working copy)
@@ -6,8 +6,6 @@
 #include <fstream>
 #include "Bitmap.h"
 
-using namespace std;
-
 #define MAX_MAP_SIZE 50
 #define MAX_TILES (MAX_MAP_SIZE*MAX_MAP_SIZE*16*16)
 
@@ -16,9 +14,9 @@
 public:
     CTileHandler();
     ~CTileHandler(void);
- void LoadTexture(string name,unsigned int x,unsigned int y,int filter);
+ void LoadTexture(std::string name,unsigned int x,unsigned int y,int filter);
     void ProcessTiles(float compressFactor,int quality,string format);
- void SaveData(ofstream& ofs);
+ void SaveData(std::ofstream& ofs);
     void ReadTile(int xpos, int ypos, char *destbuf, char *sourcebuf);
     int FindCloseTile(CBitmap* bm,int forbidden);
     void ProcessTiles2(void);
@@ -24,8 +22,8 @@
     void ProcessTiles2(void);
 
     int GetFileSize(void);
- void AddExternalTileFile(string file);
- void SetOutputFile(string file);
+ void AddExternalTileFile(std::string file);
+ void SetOutputFile(std::string file);
     
     int max_size,max_tiles;
     
@@ -34,7 +32,7 @@
     int ysize;
 
     CBitmap* tiles[MAX_TILES];
- vector<char*> newTiles;
+ std::vector<char*> newTiles;
     int tileUse[MAX_TILES];
     int usedTiles;
     int numExternalTile;
@@ -52,10 +50,10 @@
     int meanDirThreshold;
     int borderThreshold;
     
- vector<string> externalFiles;
- vector<int> externalFileTileSize;
+ std::vector<std::string> externalFiles;
+ std::vector<int> externalFileTileSize;
 
- string myTileFile;
+ std::string myTileFile;
 };
 
 extern CTileHandler tileHandler;
Index: /spring/tools/unitsync/javabind.cpp
===================================================================
--- /spring/tools/unitsync/javabind.cpp (revision 5796)
+++ /spring/tools/unitsync/javabind.cpp (working copy)
@@ -642,7 +642,7 @@
             std::vector<string> f = CFileHandler::FindFiles(path, patt);
             string s = "";
             if(f.empty()==false){
- for(vector<string>::iterator i = f.begin(); i != f.end(); ++i){
+ for(std::vector<std::string>::iterator i = f.begin(); i != f.end(); ++i){
                     string q = *i;
                     if(s != string("")){
                         s += ",";
Index: /spring/tools/unitsync/Syncer.cpp
===================================================================
--- /spring/tools/unitsync/Syncer.cpp (revision 5796)
+++ /spring/tools/unitsync/Syncer.cpp (working copy)
@@ -9,6 +9,7 @@
 #include <algorithm>
 #include <sstream>
 
+using namespace std;
 
 CSyncer::CSyncer(int id)
 : unitsLeft(-1)
Index: /spring/tools/unitsync/Syncer.h
===================================================================
--- /spring/tools/unitsync/Syncer.h (revision 5796)
+++ /spring/tools/unitsync/Syncer.h (working copy)
@@ -5,9 +5,6 @@
 #include <vector>
 #include <set>
 
-using namespace std;
-
-
 typedef unsigned int crc_t;
 
 
@@ -17,7 +14,7 @@
     crc_t cob;
     crc_t model;
 
- string fullName;
+ std::string fullName;
 };
 
 
@@ -22,7 +19,7 @@
 
 
 struct DisabledUnit {
- set<int> clients;
+ std::set<int> clients;
 };
 
 
@@ -31,13 +28,13 @@
     public:
         CSyncer(int id);
         ~CSyncer(void);
- string GetCurrentList();
- void InstallClientDiff(const string& diff);
+ std::string GetCurrentList();
+ void InstallClientDiff(const std::string& diff);
         virtual int ProcessUnits(bool checksum = true);
         
         int GetUnitCount();
- string GetUnitName(int unit);
- string GetFullUnitName(int unit);
+ std::string GetUnitName(int unit);
+ std::string GetFullUnitName(int unit);
         bool IsUnitDisabled(int unit);
         bool IsUnitDisabledByClient(int unit, int clientId);
 
@@ -44,7 +41,7 @@
     protected:
         void LoadUnits(bool checksum);
         void RemoveClient(int id);
- crc_t CalculateCRC(const string& fileName);
+ crc_t CalculateCRC(const std::string& fileName);
 
     protected:
         int localId;
@@ -50,9 +47,9 @@
         int localId;
         int unitsLeft; // decrements for each ProcessUnits() call,
                        // causes LoadUnits() to be called when set to -1
- vector<string> unitIds;
- map<string, Unit> units;
- map<string, DisabledUnit> disabledUnits;
+ std::vector<std::string> unitIds;
+ std::map<std::string, Unit> units;
+ std::map<std::string, DisabledUnit> disabledUnits;
 };
 
 #endif
Index: /spring/tools/unitsync/SyncServer.cpp
===================================================================
--- /spring/tools/unitsync/SyncServer.cpp (revision 5796)
+++ /spring/tools/unitsync/SyncServer.cpp (working copy)
@@ -2,6 +2,8 @@
 #include "SyncServer.h"
 #include <sstream>
 
+using namespace std;
+
 CSyncServer::CSyncServer(int id) :
     CSyncer(id)
 {
Index: /spring/tools/unitsync/SyncServer.h
===================================================================
--- /spring/tools/unitsync/SyncServer.h (revision 5796)
+++ /spring/tools/unitsync/SyncServer.h (working copy)
@@ -5,10 +5,10 @@
 #include <string>
 #include <set>
 
-typedef map<string, Unit> unitlist_t;
+typedef std::map<std::string, Unit> unitlist_t;
 
 struct MissingList {
- set<int> clients;
+ std::set<int> clients;
 };
 
 class CSyncServer :
@@ -15,10 +15,10 @@
     public CSyncer
 {
 protected:
- map<int, unitlist_t> clientLists;
+ std::map<int, unitlist_t> clientLists;
     int lastDiffClient;
     bool lastWasRemove;
- map<string, MissingList> curDiff;
+ std::map<std::string, MissingList> curDiff;
     void InitMasterList();
 public:
     CSyncServer(int id);
@@ -23,9 +23,9 @@
 public:
     CSyncServer(int id);
     ~CSyncServer(void);
- void AddClient(int id, const string& unitList);
+ void AddClient(int id, const std::string& unitList);
     void RemoveClient(int id);
- const string GetClientDiff(int id);
+ const std::string GetClientDiff(int id);
     virtual int ProcessUnits();
 };
 
Index: /spring/tools/Upspring/src/upspring/EditorDef.h
===================================================================
--- /spring/tools/Upspring/src/upspring/EditorDef.h (revision 5796)
+++ /spring/tools/Upspring/src/upspring/EditorDef.h (working copy)
@@ -16,8 +16,6 @@
 #pragma warning(disable: 4312 4311)

 #endif

 

-using namespace std;

-

 typedef unsigned char uchar;

 typedef unsigned long ulong;

 typedef unsigned int uint;

@@ -34,10 +32,10 @@
  */

 #ifdef _MSC_VER

     #define UPS_HASH_SET stdext::hash_set

- #define UPS_HASH_SET_H <hash_set>

+ #define UPS_HASH_SET_H <std::hash_set>

 

     #define UPS_HASH_MAP stdext::hash_map

- #define UPS_HASH_MAP_H <hash_map>

+ #define UPS_HASH_MAP_H <std::hash_map>

 #elif defined(__GNUC__)

     #define UPS_HASH_SET __gnu_cxx::hash_set

     #define UPS_HASH_SET_H <ext/hash_set>

@@ -117,7 +115,7 @@
     bool Load ();

     bool Save ();

 

- set<string> archives;

+ std::set<std::string> archives;

 };

 

 class content_error : public std::exception

@@ -123,13 +121,13 @@
 class content_error : public std::exception

 {

 public:

- content_error(const string& s) :

+ content_error(const std::string& s) :

       errMsg (s) {}

 

- string errMsg;

+ std::string errMsg;

 };

 

-inline void stringlwr(string& str) {

+inline void stringlwr(std::string& str) {

     transform (str.begin(),str.end(), str.begin(), tolower);

 }

 

@@ -134,11 +132,11 @@
 }

 

 

-bool FileSaveDlg (const char *msg, const char *pattern, string& fn);

-bool FileOpenDlg (const char *msg, const char *pattern, string& fn);

+bool FileSaveDlg (const char *msg, const char *pattern, std::string& fn);

+bool FileOpenDlg (const char *msg, const char *pattern, std::string& fn);

 bool SelectDirectory(const char *msg, std::string& dir);

 

-extern string applicationPath;

+extern std::string applicationPath;

 

 template<typename InputIterator, typename EqualityComparable>

 int element_index(InputIterator first, InputIterator last, const EqualityComparable& value) {

Index: /spring/tools/Upspring/src/upspring/Model.h
===================================================================
--- /spring/tools/Upspring/src/upspring/Model.h (revision 5796)
+++ /spring/tools/Upspring/src/upspring/Model.h (working copy)
@@ -20,8 +20,6 @@
     class Object;

 };

 

-using namespace std;

-

 class Texture;

 

 struct Poly;

@@ -61,7 +59,7 @@
     void RotateVerts();

 

     vector <int> verts;

- string texname;

+ std::string texname;

     Vector3 color;

     int taColor; // TA indexed color

     RefPtr<Texture> texture;

@@ -173,8 +171,8 @@
 

     ~PolyMesh();

 

- vector <Vertex> verts;

- vector <Poly*> poly;

+ std::vector <Vertex> verts;

+ std::vector <Poly*> poly;

 

     void Draw(ModelDrawer* drawer, Model* mdl, MdlObject* o);

     Geometry* Clone();

@@ -180,7 +178,7 @@
     Geometry* Clone();

     void Transform(const Matrix& transform);

     PolyMesh* ToPolyMesh(); // clones

- vector<Triangle> MakeTris();

+ std::vector<Triangle> MakeTris();

 

     static bool IsEqualVertexTC(Vertex& a, Vertex& b);

     static bool IsEqualVertexTCNormal(Vertex& a, Vertex& b);

@@ -266,7 +264,7 @@
 

     AnimationInfo animInfo;

 

- string name;

+ std::string name;

     bool isSelected;

     bool isOpen; // childs visible in object browser

     IKinfo ikInfo;

@@ -272,7 +270,7 @@
     IKinfo ikInfo;

 

     MdlObject *parent;

- vector <MdlObject*> childs;

+ std::vector <MdlObject*> childs;

 

 #ifndef SWIG

     csurf::Object* csurfobj;

@@ -352,9 +350,9 @@
     bool ImportUVCoords (Model* other, IProgressCtl& progctl=IProgressCtl());

 

     void InsertModel (MdlObject *obj, Model *sub);

- vector<MdlObject*> GetSelectedObjects ();

- vector<MdlObject*> GetObjectList (); // returns all objects

- vector<PolyMesh*> GetPolyMeshList ();

+ std::vector<MdlObject*> GetSelectedObjects ();

+ std::vector<MdlObject*> GetObjectList (); // returns all objects

+ std::vector<PolyMesh*> GetPolyMeshList ();

     void DeleteObject (MdlObject *obj);

     void ReplaceObject (MdlObject *oldObj, MdlObject *newObj);

     void EstimateMidPosition ();

~0002177

zenzike (reporter)

Oddly enough, although the patch was pasted into the "Additional Information" section, and then later in the empty note above, Mantis isn't displaying it. It's probably because there were too many characters. Nevertheless, it didn't complain. Never mind, the patch is now uploaded as the file you should be able to see.

~0002178

Auswaschbar (reporter)

Your patch contains patches for upspring and mapconv. These are not build by scons, and at least mapconv doesn't compile. (can't test upspring because its windows-only)

However I included the rest after I made DxSound.cpp compiling on mingw.

~0002179

zenzike (reporter)

I built this with Linux and all seemed well; though didn't realise that scons wasn't looking at upspring and mapconv. How did you realise they weren't part of the scons?

~0002180

Auswaschbar (reporter)

Scons only build the following:
Engine (rts/)
Unitsync(tools/Unitsync/)
AIs (AI/*)

The other things have their own makefiles.

~0002184

zenzike (reporter)

Thanks for patching, much appreciated - this has annoyed me for a while. Consider this [fixed].

~0002185

LordMatt (reporter)

Status changed to resolved.
+Notes

-Issue History
Date Modified Username Field Change
2008-04-28 16:29 zenzike New Issue
2008-04-28 16:37 zenzike Note Added: 0002175
2008-04-28 16:39 zenzike File Added: std_headers.patch
2008-04-28 16:40 zenzike Note Added: 0002177
2008-04-28 17:34 Auswaschbar Status new => assigned
2008-04-28 17:34 Auswaschbar Assigned To => Auswaschbar
2008-04-28 17:59 Auswaschbar Note Added: 0002178
2008-04-28 18:20 zenzike Note Added: 0002179
2008-04-28 18:31 Auswaschbar Note Added: 0002180
2008-04-29 23:43 zenzike Note Added: 0002184
2008-04-30 01:25 LordMatt Status assigned => resolved
2008-04-30 01:25 LordMatt Resolution open => fixed
2008-04-30 01:25 LordMatt Note Added: 0002185
+Issue History