mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-19 07:21:20 +03:00
import KernelEx-4.5-RC4
This commit is contained in:
@ -294,12 +294,14 @@ void FileDeclParser::parse_forward_to_unicows(const string& line) throw(exceptio
|
||||
int FileDeclParser::find_matching_export(const string& s)
|
||||
{
|
||||
int count = 0;
|
||||
size_t pos;
|
||||
|
||||
//try named exports first
|
||||
vector<export_entry_named>::iterator itn = exports_named.begin();
|
||||
while (itn != exports_named.end())
|
||||
{
|
||||
if (s.find(itn->source_name) != string::npos)
|
||||
pos = s.find(itn->source_name);
|
||||
if (pos != string::npos && is_full_decl(s, pos, itn->source_name.length()))
|
||||
count++;
|
||||
itn++;
|
||||
}
|
||||
@ -307,13 +309,23 @@ int FileDeclParser::find_matching_export(const string& s)
|
||||
vector<export_entry_ordinal>::iterator ito = exports_ordinal.begin();
|
||||
while (ito != exports_ordinal.end())
|
||||
{
|
||||
if (s.find(ito->source_name) != string::npos)
|
||||
pos = s.find(ito->source_name);
|
||||
if (pos != string::npos && is_full_decl(s, pos, ito->source_name.length()))
|
||||
count++;
|
||||
ito++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
bool FileDeclParser::is_full_decl(const string& s, int beg, int len)
|
||||
{
|
||||
if (beg > 0 && (isalnum(s[beg-1]) || s[beg-1] == '_'))
|
||||
return false;
|
||||
if (beg + len < s.length() && (isalnum(s[beg+len]) || s[beg+len] == '_'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileDeclParser::prefilter() throw(exception)
|
||||
{
|
||||
//erase C-style comments
|
||||
|
@ -101,6 +101,9 @@ protected:
|
||||
void parse_forward_to_unicows(const string& line) throw(exception);
|
||||
int find_matching_export(const string& s);
|
||||
void filter_declaration(string& s);
|
||||
|
||||
private:
|
||||
bool is_full_decl(const string& s, int beg, int len);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user