diff --git a/reactos/lib/rtl/unicode.c b/reactos/lib/rtl/unicode.c index 6819b61c734..7c39bdee69f 100644 --- a/reactos/lib/rtl/unicode.c +++ b/reactos/lib/rtl/unicode.c @@ -2105,7 +2105,7 @@ RtlDuplicateUnicodeString( if (SourceString == NULL || DestinationString == NULL || SourceString->Length > SourceString->MaximumLength || (SourceString->Length == 0 && SourceString->MaximumLength > 0 && SourceString->Buffer == NULL) || - Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING || Flags >= 4 || Flags < 0) { + Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING || Flags >= 4) { return STATUS_INVALID_PARAMETER; } diff --git a/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp b/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp index 8b3e6d5c2a7..ef3800b24e4 100644 --- a/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp +++ b/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -31,6 +32,7 @@ using std::string; using std::vector; +using std::map; using std::ifstream; #ifdef OUT @@ -83,15 +85,18 @@ DepMapBackend::_clean_project_files ( void ) remove ( "dependencymap.xml" ); } + void DepMapBackend::_generate_depmap ( FILE* OUT ) { - /* add dependencies */ + + typedef map ModuleMap; + ModuleMap module_map; + for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) { Module& module = *ProjectNode.modules[i]; - if ((module.type != Iso) && (module.type != LiveIso) && (module.type != IsoRegTest) && @@ -100,6 +105,21 @@ DepMapBackend::_generate_depmap ( FILE* OUT ) vector ifs_list; ifs_list.push_back ( &module.project.non_if_data ); ifs_list.push_back ( &module.non_if_data ); + + module_data * current_data; + ModuleMap::iterator mod_it = module_map.find ( module.name ); + if (mod_it != module_map.end ()) + { + current_data = mod_it->second; + } + else + { + current_data = new module_data(); + if (current_data) + { + module_map.insert (std::make_pair(module.name, current_data)); + } + } while ( ifs_list.size() ) { const IfableData& data = *ifs_list.back(); @@ -107,15 +127,68 @@ DepMapBackend::_generate_depmap ( FILE* OUT ) const vector& libs = data.libraries; for ( size_t j = 0; j < libs.size(); j++ ) { - //add module.name and libs[j]->name + ModuleMap::iterator it = module_map.find ( libs[j]->name ); + + if ( it != module_map.end ()) + { + module_data * data = it->second; + data->references.push_back ( module.name ); + } + else + { + module_data * data = new module_data(); + if ( data ) + { + data->references.push_back ( module.name ); + } + module_map.insert ( std::make_pair( libs[j]->name, data ) ); + } + current_data->libraries.push_back ( libs[j]->name ); } } } } + + fprintf ( m_DepMapFile, "\r\n" ); + fprintf ( m_DepMapFile, "\r\n" ); + fprintf ( m_DepMapFile, "" ); -/* save data to file - fprintf ( OUT, "\r\n" ); -*/ + for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) + { + Module& module = *ProjectNode.modules[i]; + + ModuleMap::iterator it = module_map.find ( module.name ); + if ( it != module_map.end () ) + { + module_data * data = it->second; + + fprintf ( m_DepMapFile, "\r\n", module.name.c_str(), module.GetBasePath ().c_str (), data->references.size (), data->libraries.size () ); + + if ( data->references.size () ) + { + fprintf ( m_DepMapFile, "\t\r\n" ); + for ( size_t j = 0; j < data->references.size (); j++ ) + { + fprintf ( m_DepMapFile, "\t\t\r\n", data->references[j].c_str () ); + } + fprintf ( m_DepMapFile, "\t\r\n" ); + } + + if ( data->libraries.size () ) + { + fprintf ( m_DepMapFile, "\t\r\n" ); + for ( size_t j = 0; j < data->libraries.size (); j++ ) + { + fprintf ( m_DepMapFile, "\t\t\r\n", data->libraries[j].c_str () ); + } + fprintf ( m_DepMapFile, "\t\r\n" ); + } + + fprintf ( m_DepMapFile, "\r\n" ); + } + } + + fprintf ( m_DepMapFile, "" ); } diff --git a/reactos/tools/rbuild/backend/dependencymap/dependencymap.h b/reactos/tools/rbuild/backend/dependencymap/dependencymap.h index 493daf6ba9b..1c08fac1247 100644 --- a/reactos/tools/rbuild/backend/dependencymap/dependencymap.h +++ b/reactos/tools/rbuild/backend/dependencymap/dependencymap.h @@ -50,6 +50,17 @@ class DepMapBackend : public Backend void _generate_depmap ( FILE* OUT ); void _clean_project_files ( void ); + struct module_data + { + std::vector libraries; + std::vector references; + + module_data() + {} + ~module_data() + {} + }; + };