Ignore:
Timestamp:
Oct 31, 2011, 4:33:29 PM (14 years ago)
Author:
dmik
Message:

ImpDef: Quote generated export names and avoid duplicates.

Both conditions are the requirements of emximp (quoting is necessary
to screen symbols like @ which emx tools don't allow in the export name).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/tools/impdef/ImpDef.cpp

    r21763 r21766  
    1414#include <string.h>
    1515#include <stdlib.h>
     16
     17#include <string>
     18#include <set>
    1619
    1720#include "kTypes.h"
     
    186189static long processFile(const char *pszInput, const char *pszOutput, const POPTIONS pOptions)
    187190{
     191    std::set<std::string> exports;
     192
    188193    long lRc = 0;
    189194
     
    215220                    do
    216221                    {
    217                         char        szName[MAXEXPORTNAME];
     222                        char        szName[MAXEXPORTNAME + 2 /*quotes*/];
    218223                        const char *pszName;
    219224
     
    237242
    238243                        /* real work */
    239                         pszName = generateExportName(&exp, &szName[0], pOptions);
    240 
    241                         pOutput->printf("    %-*s  @%ld\n", 40, pszName, exp.ulOrdinal);
     244                        pszName = generateExportName(&exp, &szName[1], pOptions);
     245                        if (exports.count(pszName) == 0) {
     246                            exports.insert(pszName);
     247                            szName[0] = '"';
     248                            strcat(szName, "\"");
     249                            pszName = szName;
     250
     251                            pOutput->printf("    %-*s  @%ld\n", 40, pszName, exp.ulOrdinal);
     252                        }
    242253                    } while (pDefFile->exportFindNext(&exp));
    243254                pOutput->setSize();
Note: See TracChangeset for help on using the changeset viewer.