Merge lp:~nicolas-planel/kicad/kicad into lp:kicad/product

Proposed by Nicolas PLANEL
Status: Merged
Merged at revision: 5744
Proposed branch: lp:~nicolas-planel/kicad/kicad
Merge into: lp:kicad/product
Diff against target: 106 lines (+14/-6)
3 files modified
CMakeModules/PerformFeatureChecks.cmake (+3/-0)
utils/idftools/CMakeLists.txt (+3/-0)
utils/idftools/idf2vrml.cpp (+8/-6)
To merge this branch: bzr merge lp:~nicolas-planel/kicad/kicad
Reviewer Review Type Date Requested Status
Wayne Stambaugh Approve
Review via email: mp+261889@code.launchpad.net

Description of the change

5735: Nicolas PLANEL 2015-06-12 Avoid memleak on ColorMap during normal usage
5734: Nicolas PLANEL 2015-06-11 Add missing CXX check : HAVE_STRCASECMP, HAVE_STRNCASECMP on string.h

To post a comment you must log in.
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Looks good. I will commit this patch. Thank you for your contribution to kicad.

review: Approve
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

You merge request was committed in the product branch r5744.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeModules/PerformFeatureChecks.cmake'
--- CMakeModules/PerformFeatureChecks.cmake 2015-02-19 01:47:34 +0000
+++ CMakeModules/PerformFeatureChecks.cmake 2015-06-12 22:41:08 +0000
@@ -83,6 +83,9 @@
83 check_symbol_exists( strncasecmp "strings.h" HAVE_STRNCASECMP )83 check_symbol_exists( strncasecmp "strings.h" HAVE_STRNCASECMP )
84 check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )84 check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
8585
86 check_cxx_symbol_exists( strcasecmp "string.h" HAVE_STRCASECMP )
87 check_cxx_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
88
86 # Some platforms define malloc and free in malloc.h instead of stdlib.h.89 # Some platforms define malloc and free in malloc.h instead of stdlib.h.
87 check_symbol_exists( malloc "stdlib.h" MALLOC_IN_STDLIB_H )90 check_symbol_exists( malloc "stdlib.h" MALLOC_IN_STDLIB_H )
8891
8992
=== modified file 'utils/idftools/CMakeLists.txt'
--- utils/idftools/CMakeLists.txt 2015-03-03 10:50:50 +0000
+++ utils/idftools/CMakeLists.txt 2015-06-12 22:41:08 +0000
@@ -2,6 +2,7 @@
2 "${CMAKE_SOURCE_DIR}/lib_dxf"2 "${CMAKE_SOURCE_DIR}/lib_dxf"
3 "${CMAKE_SOURCE_DIR}/utils/idftools"3 "${CMAKE_SOURCE_DIR}/utils/idftools"
4 ${OPENGL_INCLUDE_DIR}4 ${OPENGL_INCLUDE_DIR}
5 ${Boost_INCLUDE_DIR}
5 )6 )
67
7link_directories(8link_directories(
@@ -17,6 +18,8 @@
17add_executable( dxf2idf dxf2idfmain.cpp dxf2idf.cpp )18add_executable( dxf2idf dxf2idfmain.cpp dxf2idf.cpp )
18add_executable( idf2vrml idf2vrml.cpp )19add_executable( idf2vrml idf2vrml.cpp )
1920
21add_dependencies( idf2vrml boost )
22
20target_link_libraries( dxf2idf lib_dxf idf3 ${wxWidgets_LIBRARIES} )23target_link_libraries( dxf2idf lib_dxf idf3 ${wxWidgets_LIBRARIES} )
2124
22target_link_libraries( idf2vrml idf3 ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} )25target_link_libraries( idf2vrml idf3 ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} )
2326
=== modified file 'utils/idftools/idf2vrml.cpp'
--- utils/idftools/idf2vrml.cpp 2014-06-02 10:46:29 +0000
+++ utils/idftools/idf2vrml.cpp 2015-06-12 22:41:08 +0000
@@ -49,6 +49,7 @@
49#include <algorithm>49#include <algorithm>
50#include <libgen.h>50#include <libgen.h>
51#include <unistd.h>51#include <unistd.h>
52#include <boost/ptr_container/ptr_map.hpp>
5253
53#include <idf_helpers.h>54#include <idf_helpers.h>
54#include <idf_common.h>55#include <idf_common.h>
@@ -63,6 +64,7 @@
63extern int optopt;64extern int optopt;
6465
65using namespace std;66using namespace std;
67using namespace boost;
6668
67#define CLEANUP do { \69#define CLEANUP do { \
68setlocale( LC_ALL, "C" ); \70setlocale( LC_ALL, "C" ); \
@@ -122,7 +124,7 @@
122 bool top, double top_z, double bottom_z, int precision, bool compact );124 bool top, double top_z, double bottom_z, int precision, bool compact );
123inline void TransformPoint( IDF_SEGMENT& seg, double frac, bool bottom,125inline void TransformPoint( IDF_SEGMENT& seg, double frac, bool bottom,
124 double dX, double dY, double angle );126 double dX, double dY, double angle );
125VRML_IDS* GetColor( std::map<std::string, VRML_IDS*>& cmap,127VRML_IDS* GetColor( boost::ptr_map<const std::string, VRML_IDS>& cmap,
126 int& index, const std::string& uid );128 int& index, const std::string& uid );
127129
128130
@@ -743,7 +745,7 @@
743 bool bottom;745 bool bottom;
744 IDF3::IDF_LAYER lyr;746 IDF3::IDF_LAYER lyr;
745747
746 std::map< std::string, VRML_IDS*> cmap; // map colors by outline UID748 boost::ptr_map< const std::string, VRML_IDS> cmap; // map colors by outline UID
747 VRML_IDS* vcp;749 VRML_IDS* vcp;
748 IDF3_COMP_OUTLINE* pout;750 IDF3_COMP_OUTLINE* pout;
749751
@@ -861,14 +863,14 @@
861}863}
862864
863865
864VRML_IDS* GetColor( std::map<std::string, VRML_IDS*>& cmap, int& index, const std::string& uid )866VRML_IDS* GetColor( boost::ptr_map<const std::string, VRML_IDS>& cmap, int& index, const std::string& uid )
865{867{
866 static int refnum = 0;868 static int refnum = 0;
867869
868 if( index < 2 )870 if( index < 2 )
869 index = 2; // 0 and 1 are special (BOARD, UID=NOGEOM_NOPART)871 index = 2; // 0 and 1 are special (BOARD, UID=NOGEOM_NOPART)
870872
871 std::map<std::string, VRML_IDS*>::iterator cit = cmap.find( uid );873 boost::ptr_map<const std::string, VRML_IDS>::iterator cit = cmap.find( uid );
872874
873 if( cit == cmap.end() )875 if( cit == cmap.end() )
874 {876 {
@@ -886,7 +888,7 @@
886 if( showObjectMapping )888 if( showObjectMapping )
887 cout << "* " << ostr.str() << " = '" << uid << "'\n";889 cout << "* " << ostr.str() << " = '" << uid << "'\n";
888890
889 cmap.insert( std::pair<std::string, VRML_IDS*>(uid, id) );891 cmap.insert( uid, id );
890892
891 if( index >= NCOLORS )893 if( index >= NCOLORS )
892 index = 2;894 index = 2;
@@ -922,7 +924,7 @@
922 bool bottom;924 bool bottom;
923 int nvcont;925 int nvcont;
924926
925 std::map< std::string, VRML_IDS*> cmap; // map colors by outline UID927 boost::ptr_map< const std::string, VRML_IDS> cmap; // map colors by outline UID
926 VRML_IDS* vcp;928 VRML_IDS* vcp;
927 OTHER_OUTLINE* pout;929 OTHER_OUTLINE* pout;
928930