Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 884185 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/cite.cpp (-3 / +3 lines)
Lines 123-129 void CitationManager::insertCrossReferencesForBibFile(const QCString &bibFile) Link Here
123
    err("bib file %s not found!\n",qPrint(bibFile));
123
    err("bib file %s not found!\n",qPrint(bibFile));
124
    return;
124
    return;
125
  }
125
  }
126
  std::ifstream f(bibFile.str(), std::ifstream::in);
126
  std::ifstream f = Portable::openInputStream(bibFile);
127
  if (!f.is_open())
127
  if (!f.is_open())
128
  {
128
  {
129
    err("could not open file %s for reading\n",qPrint(bibFile));
129
    err("could not open file %s for reading\n",qPrint(bibFile));
Lines 217-223 void CitationManager::generatePage() Link Here
217
  QCString outputDir = Config_getString(OUTPUT_DIRECTORY);
217
  QCString outputDir = Config_getString(OUTPUT_DIRECTORY);
218
  QCString citeListFile = outputDir+"/citelist.doc";
218
  QCString citeListFile = outputDir+"/citelist.doc";
219
  {
219
  {
220
    std::ofstream t(citeListFile.str(),std::ofstream::out | std::ofstream::binary);
220
    std::ofstream t = Portable::openOutputStream(citeListFile);
221
    if (!t.is_open())
221
    if (!t.is_open())
222
    {
222
    {
223
      err("could not open file %s for writing\n",qPrint(citeListFile));
223
      err("could not open file %s for writing\n",qPrint(citeListFile));
Lines 292-298 void CitationManager::generatePage() Link Here
292
  // 6. read back the file
292
  // 6. read back the file
293
  QCString doc;
293
  QCString doc;
294
  {
294
  {
295
    std::ifstream f(citeListFile.str(),std::ifstream::in);
295
    std::ifstream f = Portable::openInputStream(citeListFile);
296
    if (!f.is_open())
296
    if (!f.is_open())
297
    {
297
    {
298
      err("could not open file %s for reading\n",qPrint(citeListFile));
298
      err("could not open file %s for reading\n",qPrint(citeListFile));
(-)a/src/configimpl.l (-2 / +1 lines)
Lines 28-34 Link Here
28
#include <errno.h>
28
#include <errno.h>
29
#include <thread>
29
#include <thread>
30
#include <algorithm>
30
#include <algorithm>
31
#include <fstream>
32
#include <iostream>
31
#include <iostream>
33
#include <iomanip>
32
#include <iomanip>
34
33
Lines 1554-1560 static QCString configFileToString(const QCString &name) Link Here
1554
  }
1553
  }
1555
  else // read from file
1554
  else // read from file
1556
  {
1555
  {
1557
    std::ifstream f(name.str(),std::istream::in);
1556
    std::ifstream f = Portable::openInputStream(name);
1558
    if (!f.is_open())
1557
    if (!f.is_open())
1559
    {
1558
    {
1560
      config_term("file '%s' not found or could not be opened\n",qPrint(name));
1559
      config_term("file '%s' not found or could not be opened\n",qPrint(name));
(-)a/src/defgen.cpp (-3 / +2 lines)
Lines 18-25 Link Here
18
18
19
#include <stdlib.h>
19
#include <stdlib.h>
20
20
21
#include <fstream>
21
#include "portable.h"
22
23
#include "defgen.h"
22
#include "defgen.h"
24
#include "doxygen.h"
23
#include "doxygen.h"
25
#include "message.h"
24
#include "message.h"
Lines 534-540 void generateDEF() Link Here
534
  }
533
  }
535
534
536
  QCString fileName=outputDirectory+"/doxygen.def";
535
  QCString fileName=outputDirectory+"/doxygen.def";
537
  std::ofstream f(fileName.str(),std::ostream::out | std::ostream::binary);
536
  std::ofstream f = Portable::openOutputStream(fileName);
538
  if (!f.is_open())
537
  if (!f.is_open())
539
  {
538
  {
540
    err("Cannot open file %s for writing!\n",qPrint(fileName));
539
    err("Cannot open file %s for writing!\n",qPrint(fileName));
(-)a/src/diagram.cpp (-2 / +1 lines)
Lines 15-21 Link Here
15
15
16
#include <stdio.h>
16
#include <stdio.h>
17
#include <stdlib.h>
17
#include <stdlib.h>
18
#include <fstream>
19
#include <algorithm>
18
#include <algorithm>
20
19
21
#include "diagram.h"
20
#include "diagram.h"
Lines 1090-1096 void ClassDiagram::writeFigure(TextStream &output,const QCString &path, Link Here
1090
1089
1091
  QCString epsBaseName=QCString(path)+"/"+fileName;
1090
  QCString epsBaseName=QCString(path)+"/"+fileName;
1092
  QCString epsName=epsBaseName+".eps";
1091
  QCString epsName=epsBaseName+".eps";
1093
  std::ofstream f(epsName.str(),std::ofstream::out | std::ofstream::binary);
1092
  std::ofstream f = Portable::openOutputStream(epsName);
1094
  if (!f.is_open())
1093
  if (!f.is_open())
1095
  {
1094
  {
1096
    term("Could not open file %s for writing\n",qPrint(epsName));
1095
    term("Could not open file %s for writing\n",qPrint(epsName));
(-)a/src/docbookvisitor.cpp (-10 / +9 lines)
Lines 13-20 Link Here
13
 *
13
 *
14
 */
14
 */
15
15
16
#include <fstream>
17
18
#include "docbookvisitor.h"
16
#include "docbookvisitor.h"
19
#include "docparser.h"
17
#include "docparser.h"
20
#include "language.h"
18
#include "language.h"
Lines 35-40 Link Here
35
#include "plantuml.h"
33
#include "plantuml.h"
36
#include "growbuf.h"
34
#include "growbuf.h"
37
#include "fileinfo.h"
35
#include "fileinfo.h"
36
#include "portable.h"
38
37
39
#if 0
38
#if 0
40
#define DB_VIS_C DB_VIS_C1(m_t)
39
#define DB_VIS_C DB_VIS_C1(m_t)
Lines 371-387 DB_VIS_C Link Here
371
            qPrint(Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_"),
370
            qPrint(Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_"),
372
            dotindex++
371
            dotindex++
373
            );
372
            );
374
        std::string fileName = baseName.str()+".dot";
373
        QCString fileName = baseName+".dot";
375
        std::ofstream file(fileName,std::ofstream::out | std::ofstream::binary);
374
        std::ofstream file = Portable::openOutputStream(fileName);
376
        if (!file.is_open())
375
        if (!file.is_open())
377
        {
376
        {
378
          err("Could not open file %s for writing\n",fileName.c_str());
377
          err("Could not open file %s for writing\n",qPrint(fileName));
379
        }
378
        }
380
        file.write( stext.data(), stext.length() );
379
        file.write( stext.data(), stext.length() );
381
        file.close();
380
        file.close();
382
        writeDotFile(baseName, s);
381
        writeDotFile(baseName, s);
383
        m_t << "</para>\n";
382
        m_t << "</para>\n";
384
        if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName);
383
        if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str());
385
      }
384
      }
386
      break;
385
      break;
387
    case DocVerbatim::Msc:
386
    case DocVerbatim::Msc:
Lines 396-406 DB_VIS_C Link Here
396
            (Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_").data(),
395
            (Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_").data(),
397
            mscindex++
396
            mscindex++
398
            );
397
            );
399
        std::string fileName = baseName.str()+".msc";
398
        QCString fileName = baseName+".msc";
400
        std::ofstream file(fileName,std::ofstream::out | std::ofstream::binary);
399
        std::ofstream file = Portable::openOutputStream(fileName);
401
        if (!file.is_open())
400
        if (!file.is_open())
402
        {
401
        {
403
          err("Could not open file %s for writing\n",fileName.c_str());
402
          err("Could not open file %s for writing\n",qPrint(fileName));
404
        }
403
        }
405
        QCString text = "msc {";
404
        QCString text = "msc {";
406
        text+=stext;
405
        text+=stext;
Lines 409-415 DB_VIS_C Link Here
409
        file.close();
408
        file.close();
410
        writeMscFile(baseName,s);
409
        writeMscFile(baseName,s);
411
        m_t << "</para>\n";
410
        m_t << "</para>\n";
412
        if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName);
411
        if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str());
413
      }
412
      }
414
      break;
413
      break;
415
    case DocVerbatim::PlantUML:
414
    case DocVerbatim::PlantUML:
(-)a/src/docsets.cpp (-5 / +5 lines)
Lines 15-21 Link Here
15
15
16
#include <set>
16
#include <set>
17
#include <stack>
17
#include <stack>
18
#include <fstream>
19
18
20
#include "docsets.h"
19
#include "docsets.h"
21
#include "config.h"
20
#include "config.h"
Lines 28-33 Link Here
28
#include "namespacedef.h"
27
#include "namespacedef.h"
29
#include "util.h"
28
#include "util.h"
30
#include "textstream.h"
29
#include "textstream.h"
30
#include "portable.h"
31
31
32
struct DocSets::Private
32
struct DocSets::Private
33
{
33
{
Lines 66-72 void DocSets::initialize() Link Here
66
  // -- write Makefile
66
  // -- write Makefile
67
  {
67
  {
68
    QCString mfName = Config_getString(HTML_OUTPUT) + "/Makefile";
68
    QCString mfName = Config_getString(HTML_OUTPUT) + "/Makefile";
69
    std::ofstream ts(mfName.str(),std::ofstream::out | std::ofstream::binary);
69
    std::ofstream ts = Portable::openOutputStream(mfName);
70
    if (!ts.is_open())
70
    if (!ts.is_open())
71
    {
71
    {
72
      term("Could not open file %s for writing\n",qPrint(mfName));
72
      term("Could not open file %s for writing\n",qPrint(mfName));
Lines 115-121 void DocSets::initialize() Link Here
115
  // -- write Info.plist
115
  // -- write Info.plist
116
  {
116
  {
117
    QCString plName = Config_getString(HTML_OUTPUT) + "/Info.plist";
117
    QCString plName = Config_getString(HTML_OUTPUT) + "/Info.plist";
118
    std::ofstream ts(plName.str(),std::ofstream::out | std::ofstream::binary);
118
    std::ofstream ts = Portable::openOutputStream(plName);
119
    if (!ts.is_open())
119
    if (!ts.is_open())
120
    {
120
    {
121
      term("Could not open file %s for writing\n",qPrint(plName));
121
      term("Could not open file %s for writing\n",qPrint(plName));
Lines 151-157 void DocSets::initialize() Link Here
151
151
152
  // -- start Nodes.xml
152
  // -- start Nodes.xml
153
  QCString notes = Config_getString(HTML_OUTPUT) + "/Nodes.xml";
153
  QCString notes = Config_getString(HTML_OUTPUT) + "/Nodes.xml";
154
  p->ntf.open(notes.str(),std::ofstream::out | std::ofstream::binary);
154
  p->ntf = Portable::openOutputStream(notes);
155
  if (!p->ntf.is_open())
155
  if (!p->ntf.is_open())
156
  {
156
  {
157
    term("Could not open file %s for writing\n",qPrint(notes));
157
    term("Could not open file %s for writing\n",qPrint(notes));
Lines 169-175 void DocSets::initialize() Link Here
169
  p->indentStack.push(true);
169
  p->indentStack.push(true);
170
170
171
  QCString tokens = Config_getString(HTML_OUTPUT) + "/Tokens.xml";
171
  QCString tokens = Config_getString(HTML_OUTPUT) + "/Tokens.xml";
172
  p->ttf.open(tokens.str(),std::ofstream::out | std::ofstream::binary);
172
  p->ttf = Portable::openOutputStream(tokens);
173
  if (!p->ttf.is_open())
173
  if (!p->ttf.is_open())
174
  {
174
  {
175
    term("Could not open file %s for writing\n",qPrint(tokens));
175
    term("Could not open file %s for writing\n",qPrint(tokens));
(-)a/src/dotfilepatcher.cpp (-17 / +15 lines)
Lines 13-20 Link Here
13
*
13
*
14
*/
14
*/
15
15
16
#include <sstream>
17
18
#include "dotfilepatcher.h"
16
#include "dotfilepatcher.h"
19
#include "dotrunner.h"
17
#include "dotrunner.h"
20
#include "config.h"
18
#include "config.h"
Lines 25-30 Link Here
25
#include "util.h"
23
#include "util.h"
26
#include "dot.h"
24
#include "dot.h"
27
#include "dir.h"
25
#include "dir.h"
26
#include "portable.h"
28
27
29
static const char svgZoomHeader[] =
28
static const char svgZoomHeader[] =
30
"<svg id=\"main\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" onload=\"init(evt)\">\n"
29
"<svg id=\"main\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" onload=\"init(evt)\">\n"
Lines 218-224 bool DotFilePatcher::convertMapFile(TextStream &t,const QCString &mapName, Link Here
218
                    const QCString &relPath, bool urlOnly,
217
                    const QCString &relPath, bool urlOnly,
219
                    const QCString &context)
218
                    const QCString &context)
220
{
219
{
221
  std::ifstream f(mapName.str(),std::ifstream::in);
220
  std::ifstream f = Portable::openInputStream(mapName);
222
  if (!f.is_open())
221
  if (!f.is_open())
223
  {
222
  {
224
    err("problems opening map file %s for inclusion in the docs!\n"
223
    err("problems opening map file %s for inclusion in the docs!\n"
Lines 308-333 bool DotFilePatcher::run() const Link Here
308
    //printf("DotFilePatcher::addSVGConversion: file=%s zoomable=%d\n",
307
    //printf("DotFilePatcher::addSVGConversion: file=%s zoomable=%d\n",
309
    //    qPrint(m_patchFile),map->zoomable);
308
    //    qPrint(m_patchFile),map->zoomable);
310
  }
309
  }
311
  std::string tmpName = m_patchFile.str()+".tmp";
310
  QCString tmpName = m_patchFile+".tmp";
312
  std::string patchFile = m_patchFile.str();
313
  Dir thisDir;
311
  Dir thisDir;
314
  if (!thisDir.rename(patchFile,tmpName))
312
  if (!thisDir.rename(m_patchFile.str(),tmpName.str()))
315
  {
313
  {
316
    err("Failed to rename file %s to %s!\n",qPrint(m_patchFile),tmpName.c_str());
314
    err("Failed to rename file %s to %s!\n",qPrint(m_patchFile),qPrint(tmpName));
317
    return FALSE;
315
    return FALSE;
318
  }
316
  }
319
  std::ifstream fi(tmpName, std::ifstream::in);
317
  std::ifstream fi = Portable::openInputStream(tmpName);
320
  std::ofstream fo(patchFile, std::ofstream::out | std::ofstream::binary);
318
  std::ofstream fo = Portable::openOutputStream(m_patchFile);
321
  if (!fi.is_open())
319
  if (!fi.is_open())
322
  {
320
  {
323
    err("problem opening file %s for patching!\n",tmpName.c_str());
321
    err("problem opening file %s for patching!\n",qPrint(tmpName));
324
    thisDir.rename(tmpName,patchFile);
322
    thisDir.rename(tmpName.str(),m_patchFile.str());
325
    return FALSE;
323
    return FALSE;
326
  }
324
  }
327
  if (!fo.is_open())
325
  if (!fo.is_open())
328
  {
326
  {
329
    err("problem opening file %s for patching!\n",qPrint(m_patchFile));
327
    err("problem opening file %s for patching!\n",qPrint(m_patchFile));
330
    thisDir.rename(tmpName,patchFile);
328
    thisDir.rename(tmpName.str(),m_patchFile.str());
331
    return FALSE;
329
    return FALSE;
332
  }
330
  }
333
  TextStream t(&fo);
331
  TextStream t(&fo);
Lines 474-484 bool DotFilePatcher::run() const Link Here
474
    fo.close();
472
    fo.close();
475
    // keep original SVG file so we can refer to it, we do need to replace
473
    // keep original SVG file so we can refer to it, we do need to replace
476
    // dummy link by real ones
474
    // dummy link by real ones
477
    fi.open(tmpName,std::ifstream::in);
475
    fi = Portable::openInputStream(tmpName);
478
    fo.open(orgName.str(),std::ofstream::out | std::ofstream::binary);
476
    fo = Portable::openOutputStream(orgName);
479
    if (!fi.is_open())
477
    if (!fi.is_open())
480
    {
478
    {
481
      err("problem opening file %s for reading!\n",tmpName.c_str());
479
      err("problem opening file %s for reading!\n",qPrint(tmpName));
482
      return FALSE;
480
      return FALSE;
483
    }
481
    }
484
    if (!fo.is_open())
482
    if (!fo.is_open())
Lines 498-504 bool DotFilePatcher::run() const Link Here
498
    fo.close();
496
    fo.close();
499
  }
497
  }
500
  // remove temporary file
498
  // remove temporary file
501
  thisDir.remove(tmpName);
499
  thisDir.remove(tmpName.str());
502
  return TRUE;
500
  return TRUE;
503
}
501
}
504
502
Lines 509-515 bool DotFilePatcher::run() const Link Here
509
static bool readSVGSize(const QCString &fileName,int *width,int *height)
507
static bool readSVGSize(const QCString &fileName,int *width,int *height)
510
{
508
{
511
  bool found=FALSE;
509
  bool found=FALSE;
512
  std::ifstream f(fileName.str(),std::ifstream::in);
510
  std::ifstream f = Portable::openInputStream(fileName);
513
  if (!f.is_open())
511
  if (!f.is_open())
514
  {
512
  {
515
    return false;
513
    return false;
(-)a/src/dotgraph.cpp (-3 / +3 lines)
Lines 13-19 Link Here
13
*
13
*
14
*/
14
*/
15
15
16
#include <sstream>
17
#include <mutex>
16
#include <mutex>
18
#include <regex>
17
#include <regex>
19
18
Lines 30-35 Link Here
30
#include "dotnode.h"
29
#include "dotnode.h"
31
#include "dotfilepatcher.h"
30
#include "dotfilepatcher.h"
32
#include "fileinfo.h"
31
#include "fileinfo.h"
32
#include "portable.h"
33
33
34
#define MAP_CMD "cmapx"
34
#define MAP_CMD "cmapx"
35
35
Lines 46-52 static bool sameMd5Signature(const QCString &baseName, Link Here
46
  bool same = false;
46
  bool same = false;
47
  char md5stored[33];
47
  char md5stored[33];
48
  md5stored[0]=0;
48
  md5stored[0]=0;
49
  std::ifstream f(baseName.str()+".md5",std::ifstream::in | std::ifstream::binary);
49
  std::ifstream f = Portable::openInputStream(baseName+".md5",true);
50
  if (f.is_open())
50
  if (f.is_open())
51
  {
51
  {
52
    // read checksum
52
    // read checksum
Lines 177-183 bool DotGraph::prepareDotFile() Link Here
177
  // need to rebuild the image
177
  // need to rebuild the image
178
178
179
  // write .dot file because image was new or has changed
179
  // write .dot file because image was new or has changed
180
  std::ofstream f(absDotName().str(),std::ofstream::out | std::ofstream::binary);
180
  std::ofstream f = Portable::openOutputStream(absDotName());
181
  if (!f.is_open())
181
  if (!f.is_open())
182
  {
182
  {
183
    err("Could not open file %s for writing\n",qPrint(absDotName()));
183
    err("Could not open file %s for writing\n",qPrint(absDotName()));
(-)a/src/dotrunner.cpp (-8 / +8 lines)
Lines 66-91 static void checkPngResult(const QCString &imgName) Link Here
66
66
67
static bool resetPDFSize(const int width,const int height, const QCString &base)
67
static bool resetPDFSize(const int width,const int height, const QCString &base)
68
{
68
{
69
  std::string tmpName   = base.str()+".tmp";
69
  QCString tmpName   = base+".tmp";
70
  std::string patchFile = base.str()+".dot";
70
  QCString patchFile = base+".dot";
71
  Dir thisDir;
71
  Dir thisDir;
72
  if (!thisDir.rename(patchFile,tmpName))
72
  if (!thisDir.rename(patchFile.str(),tmpName.str()))
73
  {
73
  {
74
    err("Failed to rename file %s to %s!\n",qPrint(patchFile),qPrint(tmpName));
74
    err("Failed to rename file %s to %s!\n",qPrint(patchFile),qPrint(tmpName));
75
    return FALSE;
75
    return FALSE;
76
  }
76
  }
77
  std::ifstream fi(tmpName,std::ifstream::in);
77
  std::ifstream fi = Portable::openInputStream(tmpName);
78
  std::ofstream t(patchFile,std::ofstream::out | std::ofstream::binary);
78
  std::ofstream t  = Portable::openOutputStream(patchFile);
79
  if (!fi.is_open())
79
  if (!fi.is_open())
80
  {
80
  {
81
    err("problem opening file %s for patching!\n",qPrint(tmpName));
81
    err("problem opening file %s for patching!\n",qPrint(tmpName));
82
    thisDir.rename(tmpName,patchFile);
82
    thisDir.rename(tmpName.str(),patchFile.str());
83
    return FALSE;
83
    return FALSE;
84
  }
84
  }
85
  if (!t.is_open())
85
  if (!t.is_open())
86
  {
86
  {
87
    err("problem opening file %s for patching!\n",qPrint(patchFile));
87
    err("problem opening file %s for patching!\n",qPrint(patchFile));
88
    thisDir.rename(tmpName,patchFile);
88
    thisDir.rename(tmpName.str(),patchFile.str());
89
    return FALSE;
89
    return FALSE;
90
  }
90
  }
91
  std::string line;
91
  std::string line;
Lines 102-108 static bool resetPDFSize(const int width,const int height, const QCString &base) Link Here
102
  fi.close();
102
  fi.close();
103
  t.close();
103
  t.close();
104
  // remove temporary file
104
  // remove temporary file
105
  thisDir.remove(tmpName);
105
  thisDir.remove(tmpName.str());
106
  return TRUE;
106
  return TRUE;
107
}
107
}
108
108
(-)a/src/doxygen.cpp (-2 / +4 lines)
Lines 10699-10705 static void dumpSymbol(TextStream &t,Definition *d) Link Here
10699
10699
10700
static void dumpSymbolMap()
10700
static void dumpSymbolMap()
10701
{
10701
{
10702
  std::ofstream f("symbols.sql",std::ofstream::out | std::ofstream::binary);
10702
  std::ofstream f = Portable::openOutputStream("symbols.sql");
10703
  if (f.is_open())
10703
  if (f.is_open())
10704
  {
10704
  {
10705
    TextStream t(&f);
10705
    TextStream t(&f);
Lines 11527-11533 static void writeTagFile() Link Here
11527
  QCString generateTagFile = Config_getString(GENERATE_TAGFILE);
11527
  QCString generateTagFile = Config_getString(GENERATE_TAGFILE);
11528
  if (generateTagFile.isEmpty()) return;
11528
  if (generateTagFile.isEmpty()) return;
11529
11529
11530
  std::ofstream f(generateTagFile.str(),std::ofstream::out | std::ofstream::binary);
11530
  std::ofstream f = Portable::openOutputStream(generateTagFile);
11531
  if (!f.is_open())
11531
  if (!f.is_open())
11532
  {
11532
  {
11533
    err("cannot open tag file %s for writing\n",
11533
    err("cannot open tag file %s for writing\n",
Lines 11982-11987 void parseInput() Link Here
11982
    {
11982
    {
11983
      Portable::setenv("DOTFONTPATH",qPrint(curFontPath));
11983
      Portable::setenv("DOTFONTPATH",qPrint(curFontPath));
11984
    }
11984
    }
11985
    // issue 9319
11986
    Portable::setenv("CAIRO_DEBUG_PDF","1");
11985
  }
11987
  }
11986
11988
11987
11989
(-)a/src/eclipsehelp.cpp (-4 / +3 lines)
Lines 13-25 Link Here
13
 *
13
 *
14
 */
14
 */
15
15
16
#include <fstream>
17
18
#include "eclipsehelp.h"
16
#include "eclipsehelp.h"
19
#include "util.h"
17
#include "util.h"
20
#include "config.h"
18
#include "config.h"
21
#include "message.h"
19
#include "message.h"
22
#include "doxygen.h"
20
#include "doxygen.h"
21
#include "portable.h"
23
22
24
struct EclipseHelp::Private
23
struct EclipseHelp::Private
25
{
24
{
Lines 71-77 void EclipseHelp::initialize() Link Here
71
{
70
{
72
  // -- open the contents file
71
  // -- open the contents file
73
  QCString name = Config_getString(HTML_OUTPUT) + "/toc.xml";
72
  QCString name = Config_getString(HTML_OUTPUT) + "/toc.xml";
74
  p->tocstream.open(name.str(), std::ofstream::out | std::ofstream::binary);
73
  p->tocstream = Portable::openOutputStream(name);
75
  if (!p->tocstream.is_open())
74
  if (!p->tocstream.is_open())
76
  {
75
  {
77
    term("Could not open file %s for writing\n", qPrint(name));
76
    term("Could not open file %s for writing\n", qPrint(name));
Lines 107-113 void EclipseHelp::finalize() Link Here
107
  p->tocstream.close();
106
  p->tocstream.close();
108
107
109
  QCString name = Config_getString(HTML_OUTPUT) + "/plugin.xml";
108
  QCString name = Config_getString(HTML_OUTPUT) + "/plugin.xml";
110
  std::ofstream t(name.str(),std::ofstream::out | std::ofstream::binary);
109
  std::ofstream t = Portable::openOutputStream(name);
111
  if (t.is_open())
110
  if (t.is_open())
112
  {
111
  {
113
    QCString docId = Config_getString(ECLIPSE_DOC_ID);
112
    QCString docId = Config_getString(ECLIPSE_DOC_ID);
(-)a/src/formula.cpp (-13 / +12 lines)
Lines 13-18 Link Here
13
 *
13
 *
14
 */
14
 */
15
15
16
#include <map>
17
#include <vector>
18
#include <string>
19
#include <utility>
20
16
#include "formula.h"
21
#include "formula.h"
17
#include "message.h"
22
#include "message.h"
18
#include "config.h"
23
#include "config.h"
Lines 23-34 Link Here
23
#include "dir.h"
28
#include "dir.h"
24
#include "regex.h"
29
#include "regex.h"
25
#include "linkedmap.h"
30
#include "linkedmap.h"
26
31
#include "portable.h"
27
#include <map>
28
#include <vector>
29
#include <string>
30
#include <utility>
31
#include <fstream>
32
32
33
// TODO: remove these dependencies
33
// TODO: remove these dependencies
34
#include "doxygen.h"   // for Doxygen::indexList
34
#include "doxygen.h"   // for Doxygen::indexList
Lines 60-66 FormulaManager &FormulaManager::instance() Link Here
60
60
61
void FormulaManager::initFromRepository(const QCString &dir)
61
void FormulaManager::initFromRepository(const QCString &dir)
62
{
62
{
63
  std::ifstream f(dir.str()+"/formula.repository",std::ifstream::in);
63
  std::ifstream f = Portable::openInputStream(dir+"/formula.repository");
64
  if (f.is_open())
64
  if (f.is_open())
65
  {
65
  {
66
    uint formulaCount=0;
66
    uint formulaCount=0;
Lines 196-202 void FormulaManager::createLatexFile(const QCString &fileName,Format format,Mode Link Here
196
196
197
  // generate a latex file containing one formula per page.
197
  // generate a latex file containing one formula per page.
198
  QCString texName=fileName+".tex";
198
  QCString texName=fileName+".tex";
199
  std::ofstream f(texName.str(),std::ofstream::out | std::ofstream::binary);
199
  std::ofstream f = Portable::openOutputStream(texName);
200
  if (f.is_open())
200
  if (f.is_open())
201
  {
201
  {
202
    TextStream t(&f);
202
    TextStream t(&f);
Lines 442-449 static bool updateEPSBoundingBox(const QCString &formBase, Link Here
442
{
442
{
443
  // read back %s_tmp.eps and replace
443
  // read back %s_tmp.eps and replace
444
  // bounding box values with x1,y1,x2,y2 and remove the HiResBoundingBox
444
  // bounding box values with x1,y1,x2,y2 and remove the HiResBoundingBox
445
  std::ifstream epsIn(formBase.str()+"_tmp.eps",std::ifstream::in);
445
  std::ifstream epsIn  = Portable::openInputStream(formBase+"_tmp.eps");
446
  std::ofstream epsOut(formBase.str()+"_tmp_corr.eps",std::ofstream::out | std::ofstream::binary);
446
  std::ofstream epsOut = Portable::openOutputStream(formBase+"_tmp_corr.eps");
447
  if (epsIn.is_open() && epsOut.is_open())
447
  if (epsIn.is_open() && epsOut.is_open())
448
  {
448
  {
449
    std::string line;
449
    std::string line;
Lines 592-599 void FormulaManager::createFormulasTexFile(Dir &thisDir,Format format,HighDPI hd Link Here
592
  // generated images represent (we use this next time to avoid regeneration
592
  // generated images represent (we use this next time to avoid regeneration
593
  // of the images, and to avoid forcing the user to delete all images in order
593
  // of the images, and to avoid forcing the user to delete all images in order
594
  // to let a browser refresh the images).
594
  // to let a browser refresh the images).
595
  std::ofstream f;
595
  std::ofstream f = Portable::openOutputStream("formula.repository");
596
  f.open("formula.repository",std::ofstream::out | std::ofstream::binary);
597
  if (f.is_open())
596
  if (f.is_open())
598
  {
597
  {
599
    TextStream t(&f);
598
    TextStream t(&f);
Lines 709-715 static int determineInkscapeVersion(Dir &thisDir) Link Here
709
      }
708
      }
710
    }
709
    }
711
    // read version file and determine major version
710
    // read version file and determine major version
712
    std::ifstream inkscapeVersionIn(inkscapeVersionFile.str(),std::ifstream::in);
711
    std::ifstream inkscapeVersionIn = Portable::openInputStream(inkscapeVersionFile);
713
    if (inkscapeVersionIn.is_open())
712
    if (inkscapeVersionIn.is_open())
714
    {
713
    {
715
      std::string line;
714
      std::string line;
(-)a/src/ftvhelp.cpp (-6 / +7 lines)
Lines 36-41 Link Here
36
#include "classdef.h"
36
#include "classdef.h"
37
#include "util.h"
37
#include "util.h"
38
#include "resourcemgr.h"
38
#include "resourcemgr.h"
39
#include "portable.h"
39
40
40
static int folderId=1;
41
static int folderId=1;
41
42
Lines 627-633 static bool generateJSTree(NavIndexEntryList &navIndex,TextStream &t, Link Here
627
          fileId+="_dup";
628
          fileId+="_dup";
628
        }
629
        }
629
        QCString fileName = htmlOutput+"/"+fileId+".js";
630
        QCString fileName = htmlOutput+"/"+fileId+".js";
630
        std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
631
        std::ofstream f = Portable::openOutputStream(fileName);
631
        if (f.is_open())
632
        if (f.is_open())
632
        {
633
        {
633
          TextStream tt(&f);
634
          TextStream tt(&f);
Lines 661-667 static bool generateJSTree(NavIndexEntryList &navIndex,TextStream &t, Link Here
661
static void generateJSNavTree(const FTVNodes &nodeList)
662
static void generateJSNavTree(const FTVNodes &nodeList)
662
{
663
{
663
  QCString htmlOutput = Config_getString(HTML_OUTPUT);
664
  QCString htmlOutput = Config_getString(HTML_OUTPUT);
664
  std::ofstream f(htmlOutput.str()+"/navtreedata.js",std::ofstream::out | std::ofstream::binary);
665
  std::ofstream f = Portable::openOutputStream(htmlOutput+"/navtreedata.js");
665
  NavIndexEntryList navIndex;
666
  NavIndexEntryList navIndex;
666
  if (f.is_open())
667
  if (f.is_open())
667
  {
668
  {
Lines 713-719 static void generateJSNavTree(const FTVNodes &nodeList) Link Here
713
    int subIndex=0;
714
    int subIndex=0;
714
    int elemCount=0;
715
    int elemCount=0;
715
    const int maxElemCount=250;
716
    const int maxElemCount=250;
716
    std::ofstream tsidx(htmlOutput.str()+"/navtreeindex0.js",std::ofstream::out | std::ofstream::binary);
717
    std::ofstream tsidx = Portable::openOutputStream(htmlOutput+"/navtreeindex0.js");
717
    if (tsidx.is_open())
718
    if (tsidx.is_open())
718
    {
719
    {
719
      t << "var NAVTREEINDEX =\n";
720
      t << "var NAVTREEINDEX =\n";
Lines 750-756 static void generateJSNavTree(const FTVNodes &nodeList) Link Here
750
          tsidx.close();
751
          tsidx.close();
751
          subIndex++;
752
          subIndex++;
752
          QCString fileName = htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js";
753
          QCString fileName = htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js";
753
          tsidx.open(fileName.str(),std::ofstream::out | std::ofstream::binary);
754
          tsidx = Portable::openOutputStream(fileName);
754
          if (!tsidx.is_open()) break;
755
          if (!tsidx.is_open()) break;
755
          tsidx << "var NAVTREEINDEX" << subIndex << " =\n";
756
          tsidx << "var NAVTREEINDEX" << subIndex << " =\n";
756
          tsidx << "{\n";
757
          tsidx << "{\n";
Lines 791-797 void FTVHelp::generateTreeViewScripts() Link Here
791
  // copy resize.js & navtree.css
792
  // copy resize.js & navtree.css
792
  auto &mgr = ResourceMgr::instance();
793
  auto &mgr = ResourceMgr::instance();
793
  {
794
  {
794
    std::ofstream f(htmlOutput.str()+"/resize.js",std::ofstream::out | std::ofstream::binary);
795
    std::ofstream f = Portable::openOutputStream(htmlOutput+"/resize.js");
795
    if (f.is_open())
796
    if (f.is_open())
796
    {
797
    {
797
      TextStream t(&f);
798
      TextStream t(&f);
Lines 799-805 void FTVHelp::generateTreeViewScripts() Link Here
799
    }
800
    }
800
  }
801
  }
801
  {
802
  {
802
    std::ofstream f(htmlOutput.str()+"/navtree.css",std::ofstream::out | std::ofstream::binary);
803
    std::ofstream f = Portable::openOutputStream(htmlOutput+"/navtree.css");
803
    if (f.is_open())
804
    if (f.is_open())
804
    {
805
    {
805
      TextStream t(&f);
806
      TextStream t(&f);
(-)a/src/htags.cpp (-1 / +1 lines)
Lines 123-129 bool Htags::loadFilemap(const QCString &htmlDir) Link Here
123
   */
123
   */
124
  if (fi.exists() && fi.isReadable())
124
  if (fi.exists() && fi.isReadable())
125
  {
125
  {
126
    std::ifstream f(fileMapName.str(),std::ifstream::in);
126
    std::ifstream f = Portable::openInputStream(fileMapName);
127
    if (f.is_open())
127
    if (f.is_open())
128
    {
128
    {
129
      std::string lineStr;
129
      std::string lineStr;
(-)a/src/htmldocvisitor.cpp (-2 / +3 lines)
Lines 36-41 Link Here
36
#include "fileinfo.h"
36
#include "fileinfo.h"
37
#include "indexlist.h"
37
#include "indexlist.h"
38
#include "growbuf.h"
38
#include "growbuf.h"
39
#include "portable.h"
39
40
40
static const int NUM_HTML_LIST_TYPES = 4;
41
static const int NUM_HTML_LIST_TYPES = 4;
41
static const char types[][NUM_HTML_LIST_TYPES] = {"1", "a", "i", "A"};
42
static const char types[][NUM_HTML_LIST_TYPES] = {"1", "a", "i", "A"};
Lines 605-611 void HtmlDocVisitor::operator()(const DocVerbatim &s) Link Here
605
            dotindex++,
606
            dotindex++,
606
            ".dot"
607
            ".dot"
607
           );
608
           );
608
        std::ofstream file(fileName.str(),std::ofstream::out | std::ofstream::binary);
609
        std::ofstream file = Portable::openOutputStream(fileName);
609
        if (!file.is_open())
610
        if (!file.is_open())
610
        {
611
        {
611
          err("Could not open file %s for writing\n",qPrint(fileName));
612
          err("Could not open file %s for writing\n",qPrint(fileName));
Lines 637-643 void HtmlDocVisitor::operator()(const DocVerbatim &s) Link Here
637
            qPrint(Config_getString(HTML_OUTPUT)+"/inline_mscgraph_"),
638
            qPrint(Config_getString(HTML_OUTPUT)+"/inline_mscgraph_"),
638
            mscindex++
639
            mscindex++
639
            );
640
            );
640
        std::ofstream file(baseName.str()+".msc",std::ofstream::out | std::ofstream::binary);
641
        std::ofstream file = Portable::openOutputStream(baseName.str()+".msc");
641
        if (!file.is_open())
642
        if (!file.is_open())
642
        {
643
        {
643
          err("Could not open file %s.msc for writing\n",qPrint(baseName));
644
          err("Could not open file %s.msc for writing\n",qPrint(baseName));
(-)a/src/htmlgen.cpp (-10 / +10 lines)
Lines 17-23 Link Here
17
#include <assert.h>
17
#include <assert.h>
18
18
19
#include <mutex>
19
#include <mutex>
20
#include <sstream>
21
20
22
#include "message.h"
21
#include "message.h"
23
#include "htmlgen.h"
22
#include "htmlgen.h"
Lines 55-60 Link Here
55
#include "utf8.h"
54
#include "utf8.h"
56
#include "textstream.h"
55
#include "textstream.h"
57
#include "indexlist.h"
56
#include "indexlist.h"
57
#include "portable.h"
58
58
59
//#define DBG_HTML(x) x;
59
//#define DBG_HTML(x) x;
60
#define DBG_HTML(x)
60
#define DBG_HTML(x)
Lines 1088-1094 void HtmlGenerator::init() Link Here
1088
      tabsCss = mgr.getAsString("fixed_tabs.css");
1088
      tabsCss = mgr.getAsString("fixed_tabs.css");
1089
    }
1089
    }
1090
1090
1091
    std::ofstream f(dname.str()+"/tabs.css",std::ofstream::out | std::ofstream::binary);
1091
    std::ofstream f = Portable::openOutputStream(dname+"/tabs.css");
1092
    if (f.is_open())
1092
    if (f.is_open())
1093
    {
1093
    {
1094
      TextStream t(&f);
1094
      TextStream t(&f);
Lines 1111-1117 void HtmlGenerator::init() Link Here
1111
  if (colorStyle==HTML_COLORSTYLE_t::TOGGLE)
1111
  if (colorStyle==HTML_COLORSTYLE_t::TOGGLE)
1112
  {
1112
  {
1113
    //mgr.copyResource("darkmode_toggle.js",dname);
1113
    //mgr.copyResource("darkmode_toggle.js",dname);
1114
    std::ofstream f(dname.str()+"/darkmode_toggle.js",std::ofstream::out | std::ofstream::binary);
1114
    std::ofstream f = Portable::openOutputStream(dname+"/darkmode_toggle.js");
1115
    if (f.is_open())
1115
    if (f.is_open())
1116
    {
1116
    {
1117
      TextStream t(&f);
1117
      TextStream t(&f);
Lines 1120-1126 void HtmlGenerator::init() Link Here
1120
  }
1120
  }
1121
1121
1122
  {
1122
  {
1123
    std::ofstream f(dname.str()+"/dynsections.js",std::ofstream::out | std::ofstream::binary);
1123
    std::ofstream f = Portable::openOutputStream(dname+"/dynsections.js");
1124
    if (f.is_open())
1124
    if (f.is_open())
1125
    {
1125
    {
1126
      TextStream t(&f);
1126
      TextStream t(&f);
Lines 1200-1206 void HtmlGenerator::writeSearchData(const QCString &dname) Link Here
1200
  Doxygen::indexList->addImageFile("search/mag_seld.svg");
1200
  Doxygen::indexList->addImageFile("search/mag_seld.svg");
1201
1201
1202
  QCString searchDirName = dname;
1202
  QCString searchDirName = dname;
1203
  std::ofstream f(searchDirName.str()+"/search.css",std::ofstream::out | std::ofstream::binary);
1203
  std::ofstream f = Portable::openOutputStream(searchDirName+"/search.css");
1204
  if (f.is_open())
1204
  if (f.is_open())
1205
  {
1205
  {
1206
    TextStream t(&f);
1206
    TextStream t(&f);
Lines 2844-2850 void HtmlGenerator::writeSearchPage() Link Here
2844
2844
2845
  // OPENSEARCH_PROVIDER {
2845
  // OPENSEARCH_PROVIDER {
2846
  QCString configFileName = htmlOutput+"/search_config.php";
2846
  QCString configFileName = htmlOutput+"/search_config.php";
2847
  std::ofstream f(configFileName.str(),std::ofstream::out | std::ofstream::binary);
2847
  std::ofstream f = Portable::openOutputStream(configFileName);
2848
  if (f.is_open())
2848
  if (f.is_open())
2849
  {
2849
  {
2850
    TextStream t(&f);
2850
    TextStream t(&f);
Lines 2875-2881 void HtmlGenerator::writeSearchPage() Link Here
2875
  // OPENSEARCH_PROVIDER }
2875
  // OPENSEARCH_PROVIDER }
2876
2876
2877
  QCString fileName = htmlOutput+"/search.php";
2877
  QCString fileName = htmlOutput+"/search.php";
2878
  f.open(fileName.str(),std::ofstream::out | std::ofstream::binary);
2878
  f = Portable::openOutputStream(fileName);
2879
  if (f.is_open())
2879
  if (f.is_open())
2880
  {
2880
  {
2881
    TextStream t(&f);
2881
    TextStream t(&f);
Lines 2914-2920 void HtmlGenerator::writeSearchPage() Link Here
2914
  f.close();
2914
  f.close();
2915
2915
2916
  QCString scriptName = htmlOutput+"/search/search.js";
2916
  QCString scriptName = htmlOutput+"/search/search.js";
2917
  f.open(scriptName.str(),std::ofstream::out | std::ofstream::binary);
2917
  f = Portable::openOutputStream(scriptName);
2918
  if (f.is_open())
2918
  if (f.is_open())
2919
  {
2919
  {
2920
    TextStream t(&f);
2920
    TextStream t(&f);
Lines 2931-2937 void HtmlGenerator::writeExternalSearchPage() Link Here
2931
  bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2931
  bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2932
  QCString dname = Config_getString(HTML_OUTPUT);
2932
  QCString dname = Config_getString(HTML_OUTPUT);
2933
  QCString fileName = dname+"/search"+Doxygen::htmlFileExtension;
2933
  QCString fileName = dname+"/search"+Doxygen::htmlFileExtension;
2934
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
2934
  std::ofstream f = Portable::openOutputStream(fileName);
2935
  if (f.is_open())
2935
  if (f.is_open())
2936
  {
2936
  {
2937
    TextStream t(&f);
2937
    TextStream t(&f);
Lines 2987-2993 void HtmlGenerator::writeExternalSearchPage() Link Here
2987
  f.close();
2987
  f.close();
2988
2988
2989
  QCString scriptName = dname+"/search/search.js";
2989
  QCString scriptName = dname+"/search/search.js";
2990
  f.open(scriptName.str(),std::ofstream::out | std::ofstream::binary);
2990
  f = Portable::openOutputStream(scriptName);
2991
  if (f.is_open())
2991
  if (f.is_open())
2992
  {
2992
  {
2993
    TextStream t(&f);
2993
    TextStream t(&f);
(-)a/src/htmlhelp.cpp (-3 / +3 lines)
Lines 347-353 void HtmlHelp::initialize() Link Here
347
347
348
  /* open the contents file */
348
  /* open the contents file */
349
  QCString fName = Config_getString(HTML_OUTPUT) + "/" + hhcFileName;
349
  QCString fName = Config_getString(HTML_OUTPUT) + "/" + hhcFileName;
350
  p->cts.open(fName.str(),std::ofstream::out | std::ofstream::binary);
350
  p->cts = Portable::openOutputStream(fName);
351
  if (!p->cts.is_open())
351
  if (!p->cts.is_open())
352
  {
352
  {
353
    term("Could not open file %s for writing\n",qPrint(fName));
353
    term("Could not open file %s for writing\n",qPrint(fName));
Lines 362-368 void HtmlHelp::initialize() Link Here
362
362
363
  /* open the index file */
363
  /* open the index file */
364
  fName = Config_getString(HTML_OUTPUT) + "/" + hhkFileName;
364
  fName = Config_getString(HTML_OUTPUT) + "/" + hhkFileName;
365
  p->kts.open(fName.str(),std::ofstream::out | std::ofstream::binary);
365
  p->kts = Portable::openOutputStream(fName);
366
  if (!p->kts.is_open())
366
  if (!p->kts.is_open())
367
  {
367
  {
368
    term("Could not open file %s for writing\n",qPrint(fName));
368
    term("Could not open file %s for writing\n",qPrint(fName));
Lines 381-387 void HtmlHelp::Private::createProjectFile() Link Here
381
{
381
{
382
  /* Write the project file */
382
  /* Write the project file */
383
  QCString fName = Config_getString(HTML_OUTPUT) + "/" + hhpFileName;
383
  QCString fName = Config_getString(HTML_OUTPUT) + "/" + hhpFileName;
384
  std::ofstream t(fName.str(),std::ofstream::out | std::ofstream::binary);
384
  std::ofstream t = Portable::openOutputStream(fName);
385
  if (t.is_open())
385
  if (t.is_open())
386
  {
386
  {
387
    QCString hhcFile = "\"" + hhcFileName  + "\"";
387
    QCString hhcFile = "\"" + hhcFileName  + "\"";
(-)a/src/index.cpp (-2 / +2 lines)
Lines 18-24 Link Here
18
 */
18
 */
19
19
20
#include <cstdlib>
20
#include <cstdlib>
21
#include <sstream>
22
#include <array>
21
#include <array>
23
22
24
#include <assert.h>
23
#include <assert.h>
Lines 49-54 Link Here
49
#include "filename.h"
48
#include "filename.h"
50
#include "tooltip.h"
49
#include "tooltip.h"
51
#include "utf8.h"
50
#include "utf8.h"
51
#include "portable.h"
52
52
53
#define MAX_ITEMS_BEFORE_MULTIPAGE_INDEX 200
53
#define MAX_ITEMS_BEFORE_MULTIPAGE_INDEX 200
54
#define MAX_ITEMS_BEFORE_QUICK_INDEX 30
54
#define MAX_ITEMS_BEFORE_QUICK_INDEX 30
Lines 5159-5165 static void writeMenuData() Link Here
5159
  if (!Config_getBool(GENERATE_HTML) || Config_getBool(DISABLE_INDEX)) return;
5159
  if (!Config_getBool(GENERATE_HTML) || Config_getBool(DISABLE_INDEX)) return;
5160
  QCString outputDir = Config_getBool(HTML_OUTPUT);
5160
  QCString outputDir = Config_getBool(HTML_OUTPUT);
5161
  LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry();
5161
  LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry();
5162
  std::ofstream t(outputDir.str()+"/menudata.js",std::ofstream::out | std::ofstream::binary);
5162
  std::ofstream t = Portable::openOutputStream(outputDir+"/menudata.js");
5163
  if (t.is_open())
5163
  if (t.is_open())
5164
  {
5164
  {
5165
    t << JAVASCRIPT_LICENSE_TEXT;
5165
    t << JAVASCRIPT_LICENSE_TEXT;
(-)a/src/latexdocvisitor.cpp (-9 / +7 lines)
Lines 1-9 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 *
2
 *
3
 *
3
 * Copyright (C) 1997-2022 by Dimitri van Heesch.
4
 *
5
 *
6
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
7
 *
4
 *
8
 * Permission to use, copy, modify, and distribute this software and its
5
 * Permission to use, copy, modify, and distribute this software and its
9
 * documentation under the terms of the GNU General Public License is hereby
6
 * documentation under the terms of the GNU General Public License is hereby
Lines 39-44 Link Here
39
#include "plantuml.h"
36
#include "plantuml.h"
40
#include "fileinfo.h"
37
#include "fileinfo.h"
41
#include "regex.h"
38
#include "regex.h"
39
#include "portable.h"
42
40
43
const int maxLevels=5;
41
const int maxLevels=5;
44
static const char *secLabels[maxLevels] =
42
static const char *secLabels[maxLevels] =
Lines 436-442 void LatexDocVisitor::operator()(const DocVerbatim &s) Link Here
436
            dotindex++,
434
            dotindex++,
437
            ".dot"
435
            ".dot"
438
           );
436
           );
439
        std::ofstream file(fileName.str(),std::ofstream::out | std::ofstream::binary);
437
        std::ofstream file = Portable::openOutputStream(fileName);
440
        if (!file.is_open())
438
        if (!file.is_open())
441
        {
439
        {
442
          err("Could not open file %s for writing\n",qPrint(fileName));
440
          err("Could not open file %s for writing\n",qPrint(fileName));
Lines 463-473 void LatexDocVisitor::operator()(const DocVerbatim &s) Link Here
463
            qPrint(Config_getString(LATEX_OUTPUT)+"/inline_mscgraph_"),
461
            qPrint(Config_getString(LATEX_OUTPUT)+"/inline_mscgraph_"),
464
            mscindex++
462
            mscindex++
465
           );
463
           );
466
        std::string fileName = baseName.str()+".msc";
464
        QCString fileName = baseName+".msc";
467
        std::ofstream file(fileName,std::ofstream::out | std::ofstream::binary);
465
        std::ofstream file = Portable::openOutputStream(fileName);
468
        if (!file.is_open())
466
        if (!file.is_open())
469
        {
467
        {
470
          err("Could not open file %s for writing\n",fileName.c_str());
468
          err("Could not open file %s for writing\n",qPrint(fileName));
471
        }
469
        }
472
        else
470
        else
473
        {
471
        {
Lines 479-485 void LatexDocVisitor::operator()(const DocVerbatim &s) Link Here
479
477
480
          writeMscFile(baseName, s);
478
          writeMscFile(baseName, s);
481
479
482
          if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName);
480
          if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str());
483
        }
481
        }
484
      }
482
      }
485
      break;
483
      break;
(-)a/src/latexgen.cpp (-3 / +3 lines)
Lines 14-20 Link Here
14
 */
14
 */
15
15
16
#include <cstdlib>
16
#include <cstdlib>
17
#include <sstream>
18
17
19
#include "latexgen.h"
18
#include "latexgen.h"
20
#include "config.h"
19
#include "config.h"
Lines 44-49 Link Here
44
#include "portable.h"
43
#include "portable.h"
45
#include "fileinfo.h"
44
#include "fileinfo.h"
46
#include "utf8.h"
45
#include "utf8.h"
46
#include "portable.h"
47
47
48
static QCString g_header;
48
static QCString g_header;
49
static QCString g_footer;
49
static QCString g_footer;
Lines 287-293 static void writeLatexMakefile() Link Here
287
{
287
{
288
  bool generateBib = !CitationManager::instance().isEmpty();
288
  bool generateBib = !CitationManager::instance().isEmpty();
289
  QCString fileName=Config_getString(LATEX_OUTPUT)+"/Makefile";
289
  QCString fileName=Config_getString(LATEX_OUTPUT)+"/Makefile";
290
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
290
  std::ofstream f = Portable::openOutputStream(fileName);
291
  if (!f.is_open())
291
  if (!f.is_open())
292
  {
292
  {
293
    term("Could not open file %s for writing\n",qPrint(fileName));
293
    term("Could not open file %s for writing\n",qPrint(fileName));
Lines 393-399 static void writeMakeBat() Link Here
393
  QCString manual_file = "refman";
393
  QCString manual_file = "refman";
394
  const int latex_count = 8;
394
  const int latex_count = 8;
395
  bool generateBib = !CitationManager::instance().isEmpty();
395
  bool generateBib = !CitationManager::instance().isEmpty();
396
  std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary);
396
  std::ofstream t = Portable::openOutputStream(fileName);
397
  if (!t.is_open())
397
  if (!t.is_open())
398
  {
398
  {
399
    term("Could not open file %s for writing\n",qPrint(fileName));
399
    term("Could not open file %s for writing\n",qPrint(fileName));
(-)a/src/mangen.cpp (-5 / +4 lines)
Lines 1-8 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 *
2
 *
3
 *
3
 * Copyright (C) 1997-2022 by Dimitri van Heesch.
4
 *
5
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
6
 *
4
 *
7
 * Permission to use, copy, modify, and distribute this software and its
5
 * Permission to use, copy, modify, and distribute this software and its
8
 * documentation under the terms of the GNU General Public License is hereby
6
 * documentation under the terms of the GNU General Public License is hereby
Lines 19-36 Link Here
19
   nice introductions to groff and man pages. */
17
   nice introductions to groff and man pages. */
20
18
21
#include <stdlib.h>
19
#include <stdlib.h>
20
#include <string.h>
22
21
23
#include "message.h"
22
#include "message.h"
24
#include "mangen.h"
23
#include "mangen.h"
25
#include "config.h"
24
#include "config.h"
26
#include "util.h"
25
#include "util.h"
27
#include "doxygen.h"
26
#include "doxygen.h"
28
#include <string.h>
29
#include "docparser.h"
27
#include "docparser.h"
30
#include "mandocvisitor.h"
28
#include "mandocvisitor.h"
31
#include "language.h"
29
#include "language.h"
32
#include "dir.h"
30
#include "dir.h"
33
#include "utf8.h"
31
#include "utf8.h"
32
#include "portable.h"
34
33
35
static QCString getExtension()
34
static QCString getExtension()
36
{
35
{
Lines 444-450 void ManGenerator::startDoxyAnchor(const QCString &,const QCString &manName, Link Here
444
    FileInfo fi(fileName.str());
443
    FileInfo fi(fileName.str());
445
    if (!fi.exists())
444
    if (!fi.exists())
446
    {
445
    {
447
      std::ofstream linkStream(fileName.str(),std::ofstream::out | std::ofstream::binary);
446
      std::ofstream linkStream = Portable::openOutputStream(fileName);
448
      if (linkStream.is_open())
447
      if (linkStream.is_open())
449
      {
448
      {
450
        linkStream << ".so " << getSubdir() << "/" << buildFileName( manName ) << "\n";
449
        linkStream << ".so " << getSubdir() << "/" << buildFileName( manName ) << "\n";
(-)a/src/msc.cpp (-3 / +1 lines)
Lines 13-20 Link Here
13
 *
13
 *
14
 */
14
 */
15
15
16
#include <sstream>
17
18
#include "msc.h"
16
#include "msc.h"
19
#include "portable.h"
17
#include "portable.h"
20
#include "config.h"
18
#include "config.h"
Lines 33-39 static const int maxCmdLine = 40960; Link Here
33
static bool convertMapFile(TextStream &t,const QCString &mapName,const QCString &relPath,
31
static bool convertMapFile(TextStream &t,const QCString &mapName,const QCString &relPath,
34
                           const QCString &context)
32
                           const QCString &context)
35
{
33
{
36
  std::ifstream f(mapName.str(),std::ifstream::in);
34
  std::ifstream f = Portable::openInputStream(mapName);
37
  if (!f.is_open())
35
  if (!f.is_open())
38
  {
36
  {
39
    err("failed to open map file %s for inclusion in the docs!\n"
37
    err("failed to open map file %s for inclusion in the docs!\n"
(-)a/src/perlmodgen.cpp (-4 / +2 lines)
Lines 17-25 Link Here
17
#include <stdlib.h>
17
#include <stdlib.h>
18
#include <stack>
18
#include <stack>
19
19
20
#include <fstream>
21
#include <iostream>
22
23
#include "perlmodgen.h"
20
#include "perlmodgen.h"
24
#include "docparser.h"
21
#include "docparser.h"
25
#include "docnode.h"
22
#include "docnode.h"
Lines 41-46 Link Here
41
#include "htmlentity.h"
38
#include "htmlentity.h"
42
#include "emoji.h"
39
#include "emoji.h"
43
#include "dir.h"
40
#include "dir.h"
41
#include "portable.h"
44
42
45
#define PERLOUTPUT_MAX_INDENTATION 40
43
#define PERLOUTPUT_MAX_INDENTATION 40
46
44
Lines 2124-2130 bool PerlModGenerator::generatePerlModOutput() Link Here
2124
2122
2125
bool PerlModGenerator::createOutputFile(std::ofstream &f, const QCString &s)
2123
bool PerlModGenerator::createOutputFile(std::ofstream &f, const QCString &s)
2126
{
2124
{
2127
  f.open(s.str(),std::ofstream::out | std::ofstream::binary);
2125
  f = Portable::openOutputStream(s);
2128
  if (!f.is_open())
2126
  if (!f.is_open())
2129
  {
2127
  {
2130
    err("Cannot open file %s for writing!\n", qPrint(s));
2128
    err("Cannot open file %s for writing!\n", qPrint(s));
(-)a/src/plantuml.cpp (-1 / +1 lines)
Lines 233-239 static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles, Link Here
233
        cachedContent = fileToString(puFileName);
233
        cachedContent = fileToString(puFileName);
234
      }
234
      }
235
235
236
      std::ofstream file(puFileName.str(),std::ofstream::out | std::ofstream::binary);
236
      std::ofstream file = Portable::openOutputStream(puFileName);
237
      if (!file.is_open())
237
      if (!file.is_open())
238
      {
238
      {
239
        err_full(nb.srcFile,nb.srcLine,"Could not open file %s for writing\n",puFileName.data());
239
        err_full(nb.srcFile,nb.srcLine,"Could not open file %s for writing\n",puFileName.data());
(-)a/src/portable.cpp (+22 lines)
Lines 614-617 size_t Portable::recodeUtf8StringToW(const QCString &inputStr,uint16_t **outBuf) Link Here
614
  return len;
614
  return len;
615
}
615
}
616
616
617
//----------------------------------------------------------------------------------------
618
// We need to do this part last as including filesystem.hpp earlier
619
// causes the code above to fail to compile on Windows.
620
621
#include "filesystem.hpp"
622
623
namespace fs = ghc::filesystem;
624
625
std::ofstream Portable::openOutputStream(const QCString &fileName,bool append)
626
{
627
  std::ios_base::openmode mode = std::ofstream::out | std::ofstream::binary;
628
  if (append) mode |= std::ofstream::app;
629
  return std::ofstream(fs::path(fileName.str()), mode);
630
}
631
632
std::ifstream Portable::openInputStream(const QCString &fileName,bool binary, bool openAtEnd)
633
{
634
  std::ios_base::openmode mode = std::ifstream::in | std::ifstream::binary;
635
  if (binary)     mode |= std::ios::binary;
636
  if (openAtEnd)  mode |= std::ios::ate;
637
  return std::ifstream(fs::path(fileName.str()), mode);
638
}
617
639
(-)a/src/portable.h (+4 lines)
Lines 5-10 Link Here
5
#include <sys/types.h>
5
#include <sys/types.h>
6
#include <stdint.h>
6
#include <stdint.h>
7
7
8
#include <fstream>
9
8
#include "qcstring.h"
10
#include "qcstring.h"
9
11
10
class Buf;
12
class Buf;
Lines 49-54 namespace Portable Link Here
49
  const char *   devNull();
51
  const char *   devNull();
50
  bool           checkForExecutable(const QCString &fileName);
52
  bool           checkForExecutable(const QCString &fileName);
51
  size_t         recodeUtf8StringToW(const QCString &inputStr,uint16_t **buf);
53
  size_t         recodeUtf8StringToW(const QCString &inputStr,uint16_t **buf);
54
  std::ofstream  openOutputStream(const QCString &name,bool append=false);
55
  std::ifstream  openInputStream(const QCString &name,bool binary=false,bool openAtEnd=false);
52
}
56
}
53
57
54
58
(-)a/src/qhp.cpp (-2 / +2 lines)
Lines 12-18 Link Here
12
 */
12
 */
13
13
14
#include <algorithm>
14
#include <algorithm>
15
#include <fstream>
16
#include <memory>
15
#include <memory>
17
#include <string.h>
16
#include <string.h>
18
#include <vector>
17
#include <vector>
Lines 27-32 Link Here
27
#include "qhp.h"
26
#include "qhp.h"
28
#include "textstream.h"
27
#include "textstream.h"
29
#include "util.h"
28
#include "util.h"
29
#include "portable.h"
30
30
31
static inline void writeIndent(TextStream &t,int indent)
31
static inline void writeIndent(TextStream &t,int indent)
32
{
32
{
Lines 207-213 void Qhp::initialize() Link Here
207
  ..
207
  ..
208
  */
208
  */
209
  QCString fileName = Config_getString(HTML_OUTPUT) + "/" + qhpFileName;
209
  QCString fileName = Config_getString(HTML_OUTPUT) + "/" + qhpFileName;
210
  p->docFile.open( fileName.str(), std::ofstream::out | std::ofstream::binary);
210
  p->docFile = Portable::openOutputStream(fileName);
211
  if (!p->docFile.is_open())
211
  if (!p->docFile.is_open())
212
  {
212
  {
213
    term("Could not open file %s for writing\n", fileName.data());
213
    term("Could not open file %s for writing\n", fileName.data());
(-)a/src/resourcemgr.cpp (-9 / +7 lines)
Lines 15-27 Link Here
15
15
16
#include <map>
16
#include <map>
17
#include <string.h>
17
#include <string.h>
18
#include <fstream>
19
18
20
#include "resourcemgr.h"
19
#include "resourcemgr.h"
21
#include "util.h"
20
#include "util.h"
22
#include "version.h"
21
#include "version.h"
23
#include "message.h"
22
#include "message.h"
24
#include "config.h"
23
#include "config.h"
24
#include "portable.h"
25
25
26
class ResourceMgr::Private
26
class ResourceMgr::Private
27
{
27
{
Lines 58-65 bool ResourceMgr::writeCategory(const QCString &categoryName,const QCString &tar Link Here
58
    Resource &res = kv.second;
58
    Resource &res = kv.second;
59
    if (res.category==categoryName)
59
    if (res.category==categoryName)
60
    {
60
    {
61
      std::string pathName = targetDir.str()+"/"+res.name;
61
      QCString pathName = targetDir+"/"+res.name;
62
      std::ofstream f(pathName,std::ofstream::out | std::ofstream::binary);
62
      std::ofstream f = Portable::openOutputStream(pathName);
63
      bool ok=false;
63
      bool ok=false;
64
      if (f.is_open())
64
      if (f.is_open())
65
      {
65
      {
Lines 78-86 bool ResourceMgr::writeCategory(const QCString &categoryName,const QCString &tar Link Here
78
78
79
bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir,const QCString &targetName,bool append) const
79
bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir,const QCString &targetName,bool append) const
80
{
80
{
81
  std::string pathName = targetDir.str()+"/"+targetName.str();
81
  QCString pathName = targetDir+"/"+targetName;
82
  std::ios_base::openmode mode = std::ofstream::out | std::ofstream::binary;
83
  if (append) mode |= std::ofstream::app;
84
  const Resource *res = get(name);
82
  const Resource *res = get(name);
85
  if (res)
83
  if (res)
86
  {
84
  {
Lines 88-94 bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, Link Here
88
    {
86
    {
89
      case Resource::Verbatim:
87
      case Resource::Verbatim:
90
        {
88
        {
91
          std::ofstream f(pathName,mode);
89
          std::ofstream f = Portable::openOutputStream(pathName,append);
92
          bool ok=false;
90
          bool ok=false;
93
          if (f.is_open())
91
          if (f.is_open())
94
          {
92
          {
Lines 139-145 bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, Link Here
139
        break;
137
        break;
140
      case Resource::CSS:
138
      case Resource::CSS:
141
        {
139
        {
142
          std::ofstream t(pathName,mode);
140
          std::ofstream t = Portable::openOutputStream(pathName,append);
143
          if (t.is_open())
141
          if (t.is_open())
144
          {
142
          {
145
            QCString buf(res->size+1);
143
            QCString buf(res->size+1);
Lines 159-165 bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, Link Here
159
        break;
157
        break;
160
      case Resource::SVG:
158
      case Resource::SVG:
161
        {
159
        {
162
          std::ofstream t(pathName,mode);
160
          std::ofstream t = Portable::openOutputStream(pathName,append);
163
          if (t.is_open())
161
          if (t.is_open())
164
          {
162
          {
165
            QCString buf(res->size+1);
163
            QCString buf(res->size+1);
(-)a/src/rtfdocvisitor.cpp (-6 / +4 lines)
Lines 1-9 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 *
2
 *
3
 *
3
 * Copyright (C) 1997-2022 by Dimitri van Heesch.
4
 *
5
 *
6
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
7
 *
4
 *
8
 * Permission to use, copy, modify, and distribute this software and its
5
 * Permission to use, copy, modify, and distribute this software and its
9
 * documentation under the terms of the GNU General Public License is hereby
6
 * documentation under the terms of the GNU General Public License is hereby
Lines 37-42 Link Here
37
#include "emoji.h"
34
#include "emoji.h"
38
#include "plantuml.h"
35
#include "plantuml.h"
39
#include "fileinfo.h"
36
#include "fileinfo.h"
37
#include "portable.h"
40
38
41
//#define DBG_RTF(x) m_t << x
39
//#define DBG_RTF(x) m_t << x
42
#define DBG_RTF(x) do {} while(0)
40
#define DBG_RTF(x) do {} while(0)
Lines 351-357 void RTFDocVisitor::operator()(const DocVerbatim &s) Link Here
351
            dotindex++,
349
            dotindex++,
352
            ".dot"
350
            ".dot"
353
           );
351
           );
354
        std::ofstream file(fileName.str(),std::ofstream::out | std::ofstream::binary);
352
        std::ofstream file = Portable::openOutputStream(fileName);
355
        if (!file.is_open())
353
        if (!file.is_open())
356
        {
354
        {
357
          err("Could not open file %s for writing\n",qPrint(fileName));
355
          err("Could not open file %s for writing\n",qPrint(fileName));
Lines 380-386 void RTFDocVisitor::operator()(const DocVerbatim &s) Link Here
380
            mscindex++,
378
            mscindex++,
381
            ".msc"
379
            ".msc"
382
           );
380
           );
383
        std::ofstream file(baseName.str(),std::ofstream::out | std::ofstream::binary);
381
        std::ofstream file = Portable::openOutputStream(baseName);
384
        if (!file.is_open())
382
        if (!file.is_open())
385
        {
383
        {
386
          err("Could not open file %s for writing\n",qPrint(baseName));
384
          err("Could not open file %s for writing\n",qPrint(baseName));
(-)a/src/rtfgen.cpp (-3 / +3 lines)
Lines 2050-2056 static void encodeForOutput(TextStream &t,const QCString &s) Link Here
2050
static bool preProcessFile(Dir &d,const QCString &infName, TextStream &t, bool bIncludeHeader=TRUE)
2050
static bool preProcessFile(Dir &d,const QCString &infName, TextStream &t, bool bIncludeHeader=TRUE)
2051
{
2051
{
2052
  static bool rtfDebug = Debug::isFlagSet(Debug::Rtf);
2052
  static bool rtfDebug = Debug::isFlagSet(Debug::Rtf);
2053
  std::ifstream f(infName.str(),std::ifstream::in);
2053
  std::ifstream f = Portable::openInputStream(infName);
2054
  if (!f.is_open())
2054
  if (!f.is_open())
2055
  {
2055
  {
2056
    err("problems opening rtf file '%s' for reading\n",infName.data());
2056
    err("problems opening rtf file '%s' for reading\n",infName.data());
Lines 2220-2226 void testRTFOutput(const QCString &name) Link Here
2220
  int bcount=0;
2220
  int bcount=0;
2221
  int line=1;
2221
  int line=1;
2222
  int c;
2222
  int c;
2223
  std::ifstream f(name.data(),std::ifstream::in);
2223
  std::ifstream f = Portable::openInputStream(name);
2224
  if (f.is_open())
2224
  if (f.is_open())
2225
  {
2225
  {
2226
    while ((c=f.get())!=-1)
2226
    while ((c=f.get())!=-1)
Lines 2279-2285 bool RTFGenerator::preProcessFileInplace(const QCString &path,const QCString &na Link Here
2279
  QCString combinedName = path+"/combined.rtf";
2279
  QCString combinedName = path+"/combined.rtf";
2280
  QCString mainRTFName  = path+"/"+name;
2280
  QCString mainRTFName  = path+"/"+name;
2281
2281
2282
  std::ofstream f(combinedName.str(),std::ofstream::out | std::ofstream::binary);
2282
  std::ofstream f = Portable::openOutputStream(combinedName);
2283
  if (!f.is_open())
2283
  if (!f.is_open())
2284
  {
2284
  {
2285
    err("Failed to open %s for writing!\n",combinedName.data());
2285
    err("Failed to open %s for writing!\n",combinedName.data());
(-)a/src/searchindex.cpp (-3 / +3 lines)
Lines 16-22 Link Here
16
16
17
#include <ctype.h>
17
#include <ctype.h>
18
#include <assert.h>
18
#include <assert.h>
19
#include <sstream>
20
#include <mutex>
19
#include <mutex>
21
#include <map>
20
#include <map>
22
#include <unordered_map>
21
#include <unordered_map>
Lines 32-37 Link Here
32
#include "message.h"
31
#include "message.h"
33
#include "groupdef.h"
32
#include "groupdef.h"
34
#include "filedef.h"
33
#include "filedef.h"
34
#include "portable.h"
35
35
36
36
37
// file format: (all multi-byte values are stored in big endian format)
37
// file format: (all multi-byte values are stored in big endian format)
Lines 318-324 void SearchIndex::write(const QCString &fileName) Link Here
318
  }
318
  }
319
319
320
  //printf("Total size %x bytes (word=%x stats=%x urls=%x)\n",size,wordsOffset,statsOffset,urlsOffset);
320
  //printf("Total size %x bytes (word=%x stats=%x urls=%x)\n",size,wordsOffset,statsOffset,urlsOffset);
321
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
321
  std::ofstream f = Portable::openOutputStream(fileName);
322
  if (f.is_open())
322
  if (f.is_open())
323
  {
323
  {
324
    // write header
324
    // write header
Lines 499-505 void SearchIndexExternal::addWord(const QCString &word,bool hiPriority) Link Here
499
499
500
void SearchIndexExternal::write(const QCString &fileName)
500
void SearchIndexExternal::write(const QCString &fileName)
501
{
501
{
502
  std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary);
502
  std::ofstream t = Portable::openOutputStream(fileName);
503
  if (t.is_open())
503
  if (t.is_open())
504
  {
504
  {
505
    t << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
505
    t << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
(-)a/src/searchindex_js.cpp (-4 / +3 lines)
Lines 15-21 Link Here
15
15
16
#include <utility>
16
#include <utility>
17
#include <algorithm>
17
#include <algorithm>
18
#include <fstream>
19
18
20
#include "searchindex_js.h"
19
#include "searchindex_js.h"
21
#include "doxygen.h"
20
#include "doxygen.h"
Lines 33-38 Link Here
33
#include "message.h"
32
#include "message.h"
34
#include "resourcemgr.h"
33
#include "resourcemgr.h"
35
#include "indexlist.h"
34
#include "indexlist.h"
35
#include "portable.h"
36
36
37
QCString searchName(const Definition *d)
37
QCString searchName(const Definition *d)
38
{
38
{
Lines 409-415 void writeJavaScriptSearchIndex() Link Here
409
409
410
      QCString dataFileName = searchDirName + "/"+baseName+".js";
410
      QCString dataFileName = searchDirName + "/"+baseName+".js";
411
411
412
      std::ofstream ti(dataFileName.str(), std::ofstream::out | std::ofstream::binary);
412
      std::ofstream ti = Portable::openOutputStream(dataFileName);
413
      if (ti.is_open())
413
      if (ti.is_open())
414
      {
414
      {
415
415
Lines 582-589 void writeJavaScriptSearchIndex() Link Here
582
  }
582
  }
583
583
584
  {
584
  {
585
    std::ofstream t(searchDirName.str()+"/searchdata.js",
585
    std::ofstream t = Portable::openOutputStream(searchDirName+"/searchdata.js");
586
                    std::ofstream::out | std::ofstream::binary);
587
    if (t.is_open())
586
    if (t.is_open())
588
    {
587
    {
589
      t << "var indexSectionsWithContent =\n";
588
      t << "var indexSectionsWithContent =\n";
(-)a/src/template.cpp (-4 / +2 lines)
Lines 20-27 Link Here
20
#include <unordered_map>
20
#include <unordered_map>
21
#include <deque>
21
#include <deque>
22
#include <cstdio>
22
#include <cstdio>
23
#include <fstream>
24
#include <sstream>
25
23
26
#include "message.h"
24
#include "message.h"
27
#include "util.h"
25
#include "util.h"
Lines 3893-3899 class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> Link Here
3893
                outputFile.prepend(ci->outputDirectory()+"/");
3891
                outputFile.prepend(ci->outputDirectory()+"/");
3894
              }
3892
              }
3895
              //printf("NoteCreate(%s)\n",qPrint(outputFile));
3893
              //printf("NoteCreate(%s)\n",qPrint(outputFile));
3896
              std::ofstream f(outputFile.str(),std::ofstream::out | std::ofstream::binary);
3894
              std::ofstream f = Portable::openOutputStream(outputFile);
3897
              if (f.is_open())
3895
              if (f.is_open())
3898
              {
3896
              {
3899
                TextStream ts(&f);
3897
                TextStream ts(&f);
Lines 5260-5266 class TemplateEngine::Private Link Here
5260
      if (kv==m_templateCache.end()) // first time template is referenced
5258
      if (kv==m_templateCache.end()) // first time template is referenced
5261
      {
5259
      {
5262
        QCString filePath = m_templateDirName+"/"+fileName;
5260
        QCString filePath = m_templateDirName+"/"+fileName;
5263
        std::ifstream f(filePath.str(),std::ifstream::in | std::ifstream::binary);
5261
        std::ifstream f = Portable::openInputStream(filePath,true);
5264
        if (f.is_open()) // read template from disk
5262
        if (f.is_open()) // read template from disk
5265
        {
5263
        {
5266
          FileInfo fi(filePath.str());
5264
          FileInfo fi(filePath.str());
(-)a/src/util.cpp (-2 / +2 lines)
Lines 6269-6275 bool readInputFile(const QCString &fileName,BufStr &inBuf,bool filter,bool isSou Link Here
6269
  QCString filterName = getFileFilter(fileName,isSourceCode);
6269
  QCString filterName = getFileFilter(fileName,isSourceCode);
6270
  if (filterName.isEmpty() || !filter)
6270
  if (filterName.isEmpty() || !filter)
6271
  {
6271
  {
6272
    std::ifstream f(fileName.str(),std::ifstream::in | std::ifstream::binary);
6272
    std::ifstream f = Portable::openInputStream(fileName,true);
6273
    if (!f.is_open())
6273
    if (!f.is_open())
6274
    {
6274
    {
6275
      err("could not open file %s\n",qPrint(fileName));
6275
      err("could not open file %s\n",qPrint(fileName));
Lines 7195-7201 bool openOutputFile(const QCString &outFile,std::ofstream &f) Link Here
7195
        dir.remove(backup.fileName());
7195
        dir.remove(backup.fileName());
7196
      dir.rename(fi.fileName(),fi.fileName()+".bak");
7196
      dir.rename(fi.fileName(),fi.fileName()+".bak");
7197
    }
7197
    }
7198
    f.open(outFile.str(),std::ofstream::out | std::ofstream::binary);
7198
    f = Portable::openOutputStream(outFile);
7199
    fileOpened = f.is_open();
7199
    fileOpened = f.is_open();
7200
  }
7200
  }
7201
  return fileOpened;
7201
  return fileOpened;
(-)a/src/vhdldocgen.cpp (-3 / +2 lines)
Lines 27-33 Link Here
27
#include <map>
27
#include <map>
28
#include <algorithm>
28
#include <algorithm>
29
29
30
31
/* --------------------------------------------------------------- */
30
/* --------------------------------------------------------------- */
32
31
33
// local includes
32
// local includes
Lines 188-194 void VhdlDocGen::writeOverview() Link Here
188
187
189
  QCString ov =Config_getString(HTML_OUTPUT);
188
  QCString ov =Config_getString(HTML_OUTPUT);
190
  QCString fileName=ov+"/vhdl_design.dot";
189
  QCString fileName=ov+"/vhdl_design.dot";
191
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
190
  std::ofstream f = Portable::openOutputStream(fileName);
192
  if (!f.is_open())
191
  if (!f.is_open())
193
  {
192
  {
194
    err("Warning: Cannot open file %s for writing\n",qPrint(fileName));
193
    err("Warning: Cannot open file %s for writing\n",qPrint(fileName));
Lines 3426-3432 void FlowChart::writeFlowChart() Link Here
3426
3425
3427
  QCString ov = Config_getString(HTML_OUTPUT);
3426
  QCString ov = Config_getString(HTML_OUTPUT);
3428
  QCString fileName = ov+"/flow_design.dot";
3427
  QCString fileName = ov+"/flow_design.dot";
3429
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
3428
  std::ofstream f = Portable::openOutputStream(fileName);
3430
  if (!f.is_open())
3429
  if (!f.is_open())
3431
  {
3430
  {
3432
    err("Cannot open file %s for writing\n",qPrint(fileName));
3431
    err("Cannot open file %s for writing\n",qPrint(fileName));
(-)a/src/xmlgen.cpp (-11 / +12 lines)
Lines 47-52 Link Here
47
#include "resourcemgr.h"
47
#include "resourcemgr.h"
48
#include "dir.h"
48
#include "dir.h"
49
#include "utf8.h"
49
#include "utf8.h"
50
#include "portable.h"
50
51
51
// no debug info
52
// no debug info
52
#define XML_DB(x) do {} while(0)
53
#define XML_DB(x) do {} while(0)
Lines 162-168 static void writeCombineScript() Link Here
162
{
163
{
163
  QCString outputDirectory = Config_getString(XML_OUTPUT);
164
  QCString outputDirectory = Config_getString(XML_OUTPUT);
164
  QCString fileName=outputDirectory+"/combine.xslt";
165
  QCString fileName=outputDirectory+"/combine.xslt";
165
  std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary);
166
  std::ofstream t = Portable::openOutputStream(fileName);
166
  if (!t.is_open())
167
  if (!t.is_open())
167
  {
168
  {
168
    err("Cannot open file %s for writing!\n",qPrint(fileName));
169
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1271-1277 static void generateXMLForClass(const ClassDef *cd,TextStream &ti) Link Here
1271
1272
1272
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1273
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1273
  QCString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml";
1274
  QCString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml";
1274
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1275
  std::ofstream f = Portable::openOutputStream(fileName);
1275
  if (!f.is_open())
1276
  if (!f.is_open())
1276
  {
1277
  {
1277
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1278
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1435-1441 static void generateXMLForConcept(const ConceptDef *cd,TextStream &ti) Link Here
1435
1436
1436
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1437
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1437
  QCString fileName=outputDirectory+"/"+cd->getOutputFileBase()+".xml";
1438
  QCString fileName=outputDirectory+"/"+cd->getOutputFileBase()+".xml";
1438
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1439
  std::ofstream f = Portable::openOutputStream(fileName);
1439
  if (!f.is_open())
1440
  if (!f.is_open())
1440
  {
1441
  {
1441
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1442
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1488-1494 static void generateXMLForNamespace(const NamespaceDef *nd,TextStream &ti) Link Here
1488
1489
1489
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1490
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1490
  QCString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml";
1491
  QCString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml";
1491
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1492
  std::ofstream f = Portable::openOutputStream(fileName);
1492
  if (!f.is_open())
1493
  if (!f.is_open())
1493
  {
1494
  {
1494
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1495
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1563-1569 static void generateXMLForFile(FileDef *fd,TextStream &ti) Link Here
1563
1564
1564
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1565
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1565
  QCString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml";
1566
  QCString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml";
1566
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1567
  std::ofstream f = Portable::openOutputStream(fileName);
1567
  if (!f.is_open())
1568
  if (!f.is_open())
1568
  {
1569
  {
1569
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1570
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1674-1680 static void generateXMLForGroup(const GroupDef *gd,TextStream &ti) Link Here
1674
1675
1675
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1676
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1676
  QCString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml";
1677
  QCString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml";
1677
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1678
  std::ofstream f = Portable::openOutputStream(fileName);
1678
  if (!f.is_open())
1679
  if (!f.is_open())
1679
  {
1680
  {
1680
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1681
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1729-1735 static void generateXMLForDir(DirDef *dd,TextStream &ti) Link Here
1729
1730
1730
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1731
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1731
  QCString fileName=outputDirectory+"/"+dd->getOutputFileBase()+".xml";
1732
  QCString fileName=outputDirectory+"/"+dd->getOutputFileBase()+".xml";
1732
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1733
  std::ofstream f = Portable::openOutputStream(fileName);
1733
  if (!f.is_open())
1734
  if (!f.is_open())
1734
  {
1735
  {
1735
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1736
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1782-1788 static void generateXMLForPage(PageDef *pd,TextStream &ti,bool isExample) Link Here
1782
1783
1783
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1784
  QCString outputDirectory = Config_getString(XML_OUTPUT);
1784
  QCString fileName=outputDirectory+"/"+pageName+".xml";
1785
  QCString fileName=outputDirectory+"/"+pageName+".xml";
1785
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1786
  std::ofstream f = Portable::openOutputStream(fileName);
1786
  if (!f.is_open())
1787
  if (!f.is_open())
1787
  {
1788
  {
1788
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1789
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1915-1921 void generateXML() Link Here
1915
  ResourceMgr::instance().copyResource("doxyfile.xsd",outputDirectory);
1916
  ResourceMgr::instance().copyResource("doxyfile.xsd",outputDirectory);
1916
1917
1917
  QCString fileName=outputDirectory+"/compound.xsd";
1918
  QCString fileName=outputDirectory+"/compound.xsd";
1918
  std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
1919
  std::ofstream f = Portable::openOutputStream(fileName);
1919
  if (!f.is_open())
1920
  if (!f.is_open())
1920
  {
1921
  {
1921
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1922
    err("Cannot open file %s for writing!\n",qPrint(fileName));
Lines 1951-1957 void generateXML() Link Here
1951
  f.close();
1952
  f.close();
1952
1953
1953
  fileName=outputDirectory+"/Doxyfile.xml";
1954
  fileName=outputDirectory+"/Doxyfile.xml";
1954
  f.open(fileName.str(),std::ofstream::out | std::ofstream::binary);
1955
  f = Portable::openOutputStream(fileName);
1955
  if (!f.is_open())
1956
  if (!f.is_open())
1956
  {
1957
  {
1957
    err("Cannot open file %s for writing\n",fileName.data());
1958
    err("Cannot open file %s for writing\n",fileName.data());
Lines 1965-1971 void generateXML() Link Here
1965
  f.close();
1966
  f.close();
1966
1967
1967
  fileName=outputDirectory+"/index.xml";
1968
  fileName=outputDirectory+"/index.xml";
1968
  f.open(fileName.str(),std::ofstream::out | std::ofstream::binary);
1969
  f = Portable::openOutputStream(fileName);
1969
  if (!f.is_open())
1970
  if (!f.is_open())
1970
  {
1971
  {
1971
    err("Cannot open file %s for writing!\n",qPrint(fileName));
1972
    err("Cannot open file %s for writing!\n",qPrint(fileName));

Return to bug 884185