Skip to content

Commit c8dcb35

Browse files
committed
Merge branch 'master_devel'
2 parents f8056f7 + 0f5eda0 commit c8dcb35

File tree

238 files changed

+62078
-13309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+62078
-13309
lines changed

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
*.a
2+
*.o
3+
*.lo
4+
*.so
5+
.deps/
6+
7+
Makefile
8+
Makefile.in
9+
10+
11+
/aclocal.m4
12+
/autom4te.cache/
13+
/common/gitversion.h
14+
/common/python_wrapper
15+
/common/tools_version.py
16+
/config.h
17+
/config.h.in
18+
/config.h.in~
19+
/config.log
20+
/config.status
21+
config/
22+
/configure
23+
flint/mstflint
24+
libtool
25+
/m4/*.m4
26+
/mlxconfig/mstconfig
27+
/mlxconfig/mstprivhost
28+
/mstdump/crd_main/mstregdump
29+
/mstflint.spec
30+
/resourcedump/mstresourcedump
31+
/small_utils/mstcongestion
32+
/small_utils/mstfwreset
33+
/small_utils/mstmcra
34+
/small_utils/mstmread
35+
/small_utils/mstmtserver
36+
/small_utils/mstmwrite
37+
/small_utils/mstvpd
38+
/stamp-h1
39+
/tracers/fwtrace/mstfwtrace

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# SOFTWARE.
3131
#--
3232

33-
SUBDIRS = common mft_utils ext_libs $(TOOLS_CRYPTO) tools_layouts ${MTCR_CONF_DIR} mtcr_py $(MAD_IFC) reg_access cmdif $(XZ_UTILS_DIR) dev_mgt tools_res_mgmt mvpd mflash fw_comps_mgr libmfa pldmlib mlxconfig mlxfwops cmdparser $(FW_MGR_TOOLS) flint small_utils mstdump ${ADABE_TOOLS} tracers resourcedump
33+
SUBDIRS = common mft_utils mft_utils/hsmclient ext_libs $(TOOLS_CRYPTO) tools_layouts ${MTCR_CONF_DIR} mtcr_py $(MAD_IFC) reg_access cmdif $(XZ_UTILS_DIR) dev_mgt tools_res_mgmt mvpd mflash fw_comps_mgr libmfa pldmlib mlxconfig mlxfwops cmdparser $(FW_MGR_TOOLS) flint small_utils mstdump ${ADABE_TOOLS} tracers resourcedump resourceparse
3434

3535
DIST_SUBDIRS = tracers
3636

adb_parser/adb_parser.cpp

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,10 @@ class AdbParser {
258258
private:
259259
// METHODS
260260
string findFile(string fileName);
261-
static bool is_relative(const string path);
262-
static void includeFile(AdbParser *adbParser, string fileName,
263-
int lineNumber = -1);
264-
static void startElement(void *adbParser, const XML_Char *name,
265-
const XML_Char **atts);
261+
static void addIncludePaths(Adb *adbCtxt, string includePaths);
262+
static void includeFile(AdbParser *adbParser, string fileName, int lineNumber = -1);
263+
static void startElement(void *adbParser, const XML_Char *name, const XML_Char **atts);
264+
266265
static void startNodesDefElement(const XML_Char **atts, AdbParser *adbParser);
267266
static void startEnumElement(const XML_Char **atts, AdbParser *adbParser, const int lineNumber);
268267
static void startConfigElement(const XML_Char **atts, AdbParser *adbParser, const int lineNumber);
@@ -271,9 +270,9 @@ class AdbParser {
271270
static void startInstOpAttrReplaceElement(const XML_Char **atts, AdbParser *adbParser, const int lineNumber);
272271
static void startNodeElement(const XML_Char **atts, AdbParser *adbParser, const int lineNumber);
273272
static void startFieldElement(const XML_Char **atts, AdbParser *adbParser, const int lineNumber);
273+
274274
static void endElement(void *adbParser, const XML_Char *name);
275-
static void addReserved(vector<AdbField*> &reserveds, u_int32_t offset,
276-
u_int32_t size);
275+
static void addReserved(vector<AdbField*> &reserveds, u_int32_t offset, u_int32_t size);
277276
static int attrCount(const XML_Char **atts);
278277
static string attrValue(const XML_Char **atts, const XML_Char *attrName);
279278
static string attrName(const XML_Char **atts, int i);
@@ -2058,16 +2057,6 @@ string AdbException::what_s() const {
20582057
return _msg;
20592058
}
20602059

2061-
/**
2062-
* Function: AdbParser::is_relative
2063-
**/
2064-
bool AdbParser::is_relative(const string path) {
2065-
if (path[0] == '/') {
2066-
return false;
2067-
}
2068-
return true;
2069-
}
2070-
20712060
/*************************** AdbParser Implementation ***************************/
20722061
/**
20732062
* Function: AdbParser::AdbParser
@@ -2081,8 +2070,28 @@ AdbParser::AdbParser(string fileName, Adb *adbCtxt, bool addReserved,
20812070
_currentConfig(0) {
20822071
_enforceExtraChecks = enforceExtraChecks;
20832072
if (includePath != "") {
2084-
vector < string > paths;
2085-
boost::algorithm::split(paths, includePath,
2073+
addIncludePaths(adbCtxt, includePath);
2074+
}
2075+
_xmlParser = XML_ParserCreate(0);
2076+
XML_SetUserData(_xmlParser, this);
2077+
XML_SetElementHandler(_xmlParser, startElement, endElement);
2078+
if (adbCtxt->includePaths.size() == 0) {
2079+
// first add the opened project path
2080+
adbCtxt->includePaths.push_back(
2081+
_fileName.find(OS_PATH_SEP) == string::npos ? "."
2082+
: _fileName.substr(0, _fileName.rfind(OS_PATH_SEP)));
2083+
vector < string > path;
2084+
boost::algorithm::split(path, fileName,
2085+
boost::is_any_of(string(OS_PATH_SEP)));
2086+
IncludeFileInfo info = { fileName, "ROOT", 0 };
2087+
_adbCtxt->includedFiles[path[path.size() - 1]] = info;
2088+
}
2089+
_instanceOps = false;
2090+
}
2091+
2092+
void AdbParser::addIncludePaths(Adb *adbCtxt, string includePaths) {
2093+
vector < string > paths;
2094+
boost::algorithm::split(paths, includePaths,
20862095
boost::is_any_of(string(";")));
20872096
adbCtxt->includePaths.insert(adbCtxt->includePaths.end(),
20882097
paths.begin(), paths.end());
@@ -2094,29 +2103,13 @@ AdbParser::AdbParser(string fileName, Adb *adbCtxt, bool addReserved,
20942103

20952104
for (StringVector::iterator it = adbCtxt->includePaths.begin(); it
20962105
!= adbCtxt->includePaths.end(); it++) {
2097-
if (AdbParser::is_relative(*it)) {
2106+
if (projPath != "" && projPath != *it && boost::filesystem::path(*it).is_relative()) {
20982107
relatives.push_back(projPath + OS_PATH_SEP + *it);
20992108
}
21002109
}
21012110

21022111
adbCtxt->includePaths.insert(adbCtxt->includePaths.end(),
21032112
relatives.begin(), relatives.end());
2104-
}
2105-
_xmlParser = XML_ParserCreate(0);
2106-
XML_SetUserData(_xmlParser, this);
2107-
XML_SetElementHandler(_xmlParser, startElement, endElement);
2108-
if (adbCtxt->includePaths.size() == 0) {
2109-
// first add the opened project path
2110-
adbCtxt->includePaths.push_back(
2111-
_fileName.find(OS_PATH_SEP) == string::npos ? "."
2112-
: _fileName.substr(0, _fileName.rfind(OS_PATH_SEP)));
2113-
vector < string > path;
2114-
boost::algorithm::split(path, fileName,
2115-
boost::is_any_of(string(OS_PATH_SEP)));
2116-
IncludeFileInfo info = { fileName, "ROOT", 0 };
2117-
_adbCtxt->includedFiles[path[path.size() - 1]] = info;
2118-
}
2119-
_instanceOps = false;
21202113
}
21212114

21222115
/**
@@ -2362,6 +2355,12 @@ string AdbParser::findFile(string fileName) {
23622355
if (f) {
23632356
fclose(f);
23642357
return filePath;
2358+
} else if (fileName.find(_adbCtxt->includePaths[i]) != string::npos) { // includePath is part of fileName
2359+
f = fopen(fileName.c_str(), "r");
2360+
if (f) {
2361+
fclose(f);
2362+
return fileName;
2363+
}
23652364
}
23662365
}
23672366
return string();
@@ -2462,7 +2461,7 @@ void AdbParser::includeFile(AdbParser *adbParser, string fileName,
24622461
string filePath;
24632462
FILE *probeFile = NULL;
24642463

2465-
if (!AdbParser::is_relative(fileName)) {
2464+
if (!boost::filesystem::path(fileName).is_relative()) {
24662465
probeFile = fopen(fileName.c_str(), "r");
24672466
}
24682467

@@ -2478,7 +2477,7 @@ void AdbParser::includeFile(AdbParser *adbParser, string fileName,
24782477

24792478
// Update filename to be only base name with extension to prevent duplications
24802479
boost::filesystem::path boostPath(filePath);
2481-
fileName = string(boostPath.filename().c_str());
2480+
fileName = boostPath.filename().string();
24822481

24832482
if (!adbParser->_adbCtxt->includedFiles.count(fileName)) {
24842483
IncludeFileInfo info = { filePath, adbParser->_fileName, lineNumber };
@@ -2487,7 +2486,7 @@ void AdbParser::includeFile(AdbParser *adbParser, string fileName,
24872486
// parse the included file
24882487
AdbParser p(filePath, adbParser->_adbCtxt, adbParser->_addReserved,
24892488
adbParser->_progressObj, adbParser->_strict,
2490-
adbParser->_includePath, adbParser->_enforceExtraChecks);
2489+
"", adbParser->_enforceExtraChecks);
24912490
if (!p.load()) {
24922491
throw AdbException(p.getError());
24932492
}
@@ -2506,6 +2505,7 @@ void AdbParser::includeAllFilesInDir(AdbParser *adbParser, string dirPath,
25062505
boost::filesystem::path fsPath(*pathIt);
25072506
if (boost::filesystem::exists(fsPath)
25082507
&& boost::filesystem::is_directory(fsPath)) {
2508+
addIncludePaths(adbParser->_adbCtxt, *pathIt);
25092509
boost::filesystem::directory_iterator filesIter(fsPath), dirEnd;
25102510
for (; filesIter != dirEnd; ++filesIter) {
25112511
if (boost::filesystem::is_regular_file(filesIter->status())
@@ -2679,7 +2679,7 @@ void AdbParser::startConfigElement(const XML_Char **atts, AdbParser *adbParser,
26792679
for (StringVector::iterator it =
26802680
adbParser->_adbCtxt->includePaths.begin(); it
26812681
!= adbParser->_adbCtxt->includePaths.end(); it++) {
2682-
if (AdbParser::is_relative(*it)) {
2682+
if (boost::filesystem::path(*it).is_relative()) {
26832683
relatives.push_back(projPath + OS_PATH_SEP + *it);
26842684
}
26852685
}

adb_parser/expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101

102102
#include <common/compatibility.h>
103103

104+
104105
class Expr
105106
{
106107
public:
@@ -157,7 +158,6 @@ class Expr
157158

158159
void ErrorReport(const std::string& msg);
159160

160-
161161
/*
162162
* Pure virtual methods. You must define them to use expr.
163163
*/

cmdif/icmd_cif_open.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ enum {
6262
#ifdef MST_UL
6363
// instead of cib_cif.h in mstflint
6464
enum {
65-
GET_ICMD_QUERY_CAP = 0x8400,
66-
SET_ITRACE = 0xf003,
67-
SET_PORT_SNIFFER = 0xc002,
65+
GET_ICMD_QUERY_CAP = 0x8400,
66+
SET_ITRACE = 0xf003,
67+
SET_PORT_SNIFFER = 0xc002,
6868
};
6969
#endif
7070

@@ -79,7 +79,6 @@ int gcif_mh_sync_status(mfile *mf, struct connectx4_icmd_mh_sync *mh_sync);
7979

8080
int gcif_set_port_sniffer(mfile *mf, struct connectib_icmd_set_port_sniffer *set_port_sniffer);
8181

82-
8382
#ifdef __cplusplus
8483
}
8584
#endif

cmdparser/my_getopt.c

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#endif
4141

4242
#include <stdio.h>
43+
#include <stdlib.h>
4344

4445
/* Comment out all this code if we are using the GNU C Library, and are not
4546
actually compiling the library itself. This code is part of the GNU C
@@ -208,12 +209,7 @@ static char *posixly_correct;
208209
/* Avoid depending on library functions or files
209210
whose names are inconsistent. */
210211

211-
char* getenv();
212-
213-
static char* my_index(str, chr)
214-
const char *str;
215-
int chr;
216-
{
212+
static char* my_index(const char *str, const char chr) {
217213
while (*str) {
218214
if (*str == chr) {
219215
return (char*) str;
@@ -298,8 +294,7 @@ text_set_element(__libc_subinit, store_args_and_env);
298294
static void exchange(char**);
299295
#endif
300296

301-
static void exchange(argv)
302-
char **argv;
297+
static void exchange(char **argv)
303298
{
304299
int bottom = first_nonopt;
305300
int middle = last_nonopt;
@@ -374,10 +369,7 @@ char **argv;
374369
#if defined(__STDC__) && __STDC__
375370
static const char* _getopt_initialize(int, char*const*, const char*);
376371
#endif
377-
static const char* _getopt_initialize(argc, argv, optstring)
378-
int argc;
379-
char*const *argv;
380-
const char *optstring;
372+
static const char* _getopt_initialize(int argc, char* const *argv, const char *optstring)
381373
{
382374
/* Start processing options with ARGV-element 1 (since ARGV-element 0
383375
is the program name); the sequence of previously skipped
@@ -493,13 +485,7 @@ const char *optstring;
493485
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
494486
long-named options. */
495487

496-
int _getopt_internal(argc, argv, optstring, longopts, longind, long_only)
497-
int argc;
498-
char*const *argv;
499-
const char *optstring;
500-
const struct option *longopts;
501-
int *longind;
502-
int long_only;
488+
int _getopt_internal(int argc, char* const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only)
503489
{
504490
tools_optarg = NULL;
505491

@@ -918,23 +904,15 @@ int long_only;
918904
}
919905
}
920906

921-
int tools_getopt(argc, argv, optstring)
922-
int argc;
923-
char*const *argv;
924-
const char *optstring;
907+
int tools_getopt(int argc, char* const *argv, const char *optstring)
925908
{
926909
return _getopt_internal(argc, argv, optstring,
927910
(const struct option*) 0,
928911
(int*) 0,
929912
0);
930913
}
931914

932-
int tools_getopt_long(argc, argv, optstring, longopts, longindex)
933-
int argc;
934-
char*const *argv;
935-
const char *optstring;
936-
const struct option *longopts;
937-
int *longindex;
915+
int tools_getopt_long(int argc, char* const *argv, const char *optstring, const struct option *longopts, int *longindex)
938916
{
939917
return _getopt_internal(argc, argv, optstring,
940918
longopts,
@@ -943,12 +921,7 @@ int *longindex;
943921
}
944922

945923

946-
int tools_getopt_long_only(argc, argv, optstring, longopts, longindex)
947-
int argc;
948-
char*const *argv;
949-
const char *optstring;
950-
const struct option *longopts;
951-
int *longindex;
924+
int tools_getopt_long_only(int argc, char* const *argv, const char *optstring, const struct option *longopts, int *longindex)
952925
{
953926
return _getopt_internal(argc, argv, optstring,
954927
longopts,
@@ -962,9 +935,7 @@ int *longindex;
962935
/* Compile with -DTEST to make an executable for use in testing
963936
the above definition of `getopt'. */
964937

965-
int main(argc, argv)
966-
int argc;
967-
char **argv;
938+
int main(int argc, char **argv)
968939
{
969940
int c;
970941
int digit_optind = 0;

0 commit comments

Comments
 (0)