|
|
@ -70,7 +70,7 @@ inline bool isASCII (uint8 c)
|
|
|
|
bool isASCII(vector<char> &fileArray)
|
|
|
|
bool isASCII(vector<char> &fileArray)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Array size
|
|
|
|
// Array size
|
|
|
|
uint size = fileArray.size();
|
|
|
|
uint size = (uint)fileArray.size();
|
|
|
|
|
|
|
|
|
|
|
|
if (size)
|
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -110,7 +110,7 @@ void removeBeginEndSpaces (string &str)
|
|
|
|
str = str.substr (index, str.length ()-index);
|
|
|
|
str = str.substr (index, str.length ()-index);
|
|
|
|
|
|
|
|
|
|
|
|
// Remove end space
|
|
|
|
// Remove end space
|
|
|
|
index=str.length ()-1;
|
|
|
|
index=(sint)str.length ()-1;
|
|
|
|
while ( (index>0) && (str[index]==' ') )
|
|
|
|
while ( (index>0) && (str[index]==' ') )
|
|
|
|
index--;
|
|
|
|
index--;
|
|
|
|
str.resize (index+1);
|
|
|
|
str.resize (index+1);
|
|
|
@ -128,17 +128,17 @@ void removeChar (string &str, char ch)
|
|
|
|
void removeDirectory (string &str)
|
|
|
|
void removeDirectory (string &str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Remove begin space
|
|
|
|
// Remove begin space
|
|
|
|
int pos = str.rfind ('\\');
|
|
|
|
string::size_type pos = str.rfind ('\\');
|
|
|
|
int pos2 = str.rfind ('/');
|
|
|
|
string::size_type pos2 = str.rfind ('/');
|
|
|
|
pos = std::max (pos, pos2);
|
|
|
|
pos = std::max (pos, pos2);
|
|
|
|
if (pos>=0)
|
|
|
|
if (pos != string::npos)
|
|
|
|
str = str.substr (pos+1, str.size());
|
|
|
|
str = str.substr (pos+1, str.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool filterExtension (const char *str, const vector<string> &extensions)
|
|
|
|
bool filterExtension (const char *str, const vector<string> &extensions)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// String size
|
|
|
|
// String size
|
|
|
|
uint size = strlen (str);
|
|
|
|
uint size = (uint)strlen (str);
|
|
|
|
|
|
|
|
|
|
|
|
// For each filter
|
|
|
|
// For each filter
|
|
|
|
for (uint i=0; i<extensions.size(); i++)
|
|
|
|
for (uint i=0; i<extensions.size(); i++)
|
|
|
@ -164,14 +164,14 @@ const char *getExtension (const char *filename)
|
|
|
|
|
|
|
|
|
|
|
|
void removeExtension (string &filename)
|
|
|
|
void removeExtension (string &filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int index = filename.rfind ('.');
|
|
|
|
string::size_type index = filename.rfind ('.');
|
|
|
|
filename.resize (index);
|
|
|
|
filename.resize (index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions)
|
|
|
|
void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Array size
|
|
|
|
// Array size
|
|
|
|
uint size = fileArray.size();
|
|
|
|
uint size = (uint)fileArray.size();
|
|
|
|
|
|
|
|
|
|
|
|
// Array pointer
|
|
|
|
// Array pointer
|
|
|
|
const char *arrayPointer = &fileArray[0];
|
|
|
|
const char *arrayPointer = &fileArray[0];
|
|
|
@ -238,7 +238,7 @@ void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filen
|
|
|
|
void extractStringsFromASCII (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions)
|
|
|
|
void extractStringsFromASCII (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Array size
|
|
|
|
// Array size
|
|
|
|
uint size = fileArray.size();
|
|
|
|
uint size = (uint)fileArray.size();
|
|
|
|
if (size)
|
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Array pointer
|
|
|
|
// Array pointer
|
|
|
@ -470,7 +470,7 @@ void progress (const char *message, float progress)
|
|
|
|
pgId= min(pgId, (uint)(BAR_LENGTH-1));
|
|
|
|
pgId= min(pgId, (uint)(BAR_LENGTH-1));
|
|
|
|
sprintf (msg, "\r%s %s", progressbar[pgId], message );
|
|
|
|
sprintf (msg, "\r%s %s", progressbar[pgId], message );
|
|
|
|
uint i;
|
|
|
|
uint i;
|
|
|
|
for (i=strlen(msg); i<79; i++)
|
|
|
|
for (i=(uint)strlen(msg); i<79; i++)
|
|
|
|
msg[i]=' ';
|
|
|
|
msg[i]=' ';
|
|
|
|
msg[i]=0;
|
|
|
|
msg[i]=0;
|
|
|
|
printf (msg);
|
|
|
|
printf (msg);
|
|
|
@ -506,7 +506,7 @@ int main(int argc, char* argv[])
|
|
|
|
printf ("\rScaning files... \n");
|
|
|
|
printf ("\rScaning files... \n");
|
|
|
|
|
|
|
|
|
|
|
|
uint size = 0;
|
|
|
|
uint size = 0;
|
|
|
|
uint maxSize = inputFiles.size();
|
|
|
|
uint maxSize = (uint)inputFiles.size();
|
|
|
|
set<string>::iterator ite = inputFiles.begin();
|
|
|
|
set<string>::iterator ite = inputFiles.begin();
|
|
|
|
while (ite != inputFiles.end())
|
|
|
|
while (ite != inputFiles.end())
|
|
|
|
{
|
|
|
|
{
|
|
|
|