diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-02-26 11:50:43 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-02-26 11:50:43 +0100 |
commit | fbfbd2145aa6ec9f234fae72a26f995bedb1fa39 (patch) | |
tree | 7f4470278a351b2a19ea84e19239d708f1695fee /MSVC_Net2013 | |
parent | 15fb34c7d93ce64a9463654b98f09a1d5f7fcc02 (diff) | |
download | glibmm-fbfbd2145aa6ec9f234fae72a26f995bedb1fa39.tar.gz |
Run clang-format on gendef.cc
Diffstat (limited to 'MSVC_Net2013')
-rw-r--r-- | MSVC_Net2013/gendef/gendef.cc | 80 |
1 files changed, 45 insertions, 35 deletions
diff --git a/MSVC_Net2013/gendef/gendef.cc b/MSVC_Net2013/gendef/gendef.cc index cf665604..d18ac9fb 100644 --- a/MSVC_Net2013/gendef/gendef.cc +++ b/MSVC_Net2013/gendef/gendef.cc @@ -22,68 +22,78 @@ /* Modified by Cedric Gustin <cedric.gustin@gmail.com> on 2006/01/13 : * Redirect the output of dumpbin to dumpbin.out instead of reading the - * output stream of popen, as it fails with Visual Studio 2005 in + * output stream of popen, as it fails with Visual Studio 2005 in * pre-link build events. */ -#include <iostream> #include <fstream> +#include <iostream> #include <stdio.h> using namespace std; -int main(int argc,char** argv) +int +main(int argc, char** argv) { - if (argc < 4) { - cerr << "Usage: " << argv[0] << " <def-file-name> <dll-base-name> <obj-file> ...." << endl; - return 2; + if (argc < 4) + { + cerr << "Usage: " << argv[0] << " <def-file-name> <dll-base-name> <obj-file> ...." << endl; + return 2; } // CG : Explicitly redirect stdout to dumpbin.out. string dumpbin = "dumpbin /SYMBOLS /OUT:dumpbin.out"; int i = 3; - for(;i<argc;) { - dumpbin += " "; - dumpbin += argv[i++]; + for (; i < argc;) + { + dumpbin += " "; + dumpbin += argv[i++]; } - FILE * dump; - - if( (dump = _popen(dumpbin.c_str(),"r")) == NULL ) { - cerr << "could not popen dumpbin" << endl; - return 3; + FILE* dump; + + if ((dump = _popen(dumpbin.c_str(), "r")) == NULL) + { + cerr << "could not popen dumpbin" << endl; + return 3; } // CG : Wait for the dumpbin process to finish and open dumpbin.out. _pclose(dump); - dump=fopen("dumpbin.out","r"); + dump = fopen("dumpbin.out", "r"); ofstream def_file(argv[1]); def_file << "LIBRARY " << argv[2] << endl; def_file << "EXPORTS" << endl; - i=0; - while( !feof(dump)) { - char buf [65000]; - - if( fgets( buf, 64999, dump ) != NULL ) { - if(!strstr(buf," UNDEF ") && strstr(buf," External ")) { - char *s = strchr(buf,'|') + 1; - while(*s == ' ' || *s == '\t') s++; - char *e=s; - while(*e != ' ' && *e != '\t' && *e != '\0' && *e!= '\n') e++; - *e = '\0'; - - if(strchr(s,'?')==0 && s[0]=='_' && strchr(s,'@') == 0 )//this is a C export type: _fct -> fct - def_file << " " << (s+1) << endl; - else - if(strchr(s,'?')!=0 && strncmp(s,"??_G",4)!=0 && strncmp(s,"??_E",4)!=0) { - def_file << " " << s << endl; - } - } - } + i = 0; + while (!feof(dump)) + { + char buf[65000]; + + if (fgets(buf, 64999, dump) != NULL) + { + if (!strstr(buf, " UNDEF ") && strstr(buf, " External ")) + { + char* s = strchr(buf, '|') + 1; + while (*s == ' ' || *s == '\t') + s++; + char* e = s; + while (*e != ' ' && *e != '\t' && *e != '\0' && *e != '\n') + e++; + *e = '\0'; + + if (strchr(s, '?') == 0 && s[0] == '_' && + strchr(s, '@') == 0) // this is a C export type: _fct -> fct + def_file << " " << (s + 1) << endl; + else if (strchr(s, '?') != 0 && strncmp(s, "??_G", 4) != 0 && strncmp(s, "??_E", 4) != 0) + { + def_file << " " << s << endl; + } + } + } } // CG : Close dumpbin.out and delete it. |