output.cc (11259:4006183015a1) | output.cc (11293:25352d3d491e) |
---|---|
1/* 2 * Copyright (c) 2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 26 unchanged lines hidden (view full) --- 35#include <unistd.h> 36 37#include <cassert> 38#include <cerrno> 39#include <climits> 40#include <cstdlib> 41#include <fstream> 42 | 1/* 2 * Copyright (c) 2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 26 unchanged lines hidden (view full) --- 35#include <unistd.h> 36 37#include <cassert> 38#include <cerrno> 39#include <climits> 40#include <cstdlib> 41#include <fstream> 42 |
43#include <gzstream.hh> | 43#include <zfstream.h> |
44 45#include "base/misc.hh" 46#include "base/output.hh" 47 48using namespace std; 49 50OutputDirectory simout; 51 --- 25 unchanged lines hidden (view full) --- 77 78ostream * 79OutputDirectory::openFile(const string &filename, 80 ios_base::openmode mode, bool no_gz) 81{ 82 bool gz = !no_gz; 83 gz = gz && filename.find(".gz", filename.length()-3) < filename.length(); 84 if (gz) { | 44 45#include "base/misc.hh" 46#include "base/output.hh" 47 48using namespace std; 49 50OutputDirectory simout; 51 --- 25 unchanged lines hidden (view full) --- 77 78ostream * 79OutputDirectory::openFile(const string &filename, 80 ios_base::openmode mode, bool no_gz) 81{ 82 bool gz = !no_gz; 83 gz = gz && filename.find(".gz", filename.length()-3) < filename.length(); 84 if (gz) { |
85 ogzstream *file = new ogzstream(filename.c_str(), mode); | 85 gzofstream *file = new gzofstream(filename.c_str(), mode); |
86 if (!file->is_open()) 87 fatal("Cannot open file %s", filename); 88 assert(files.find(filename) == files.end()); 89 files[filename] = file; 90 return file; 91 } else { 92 ofstream *file = new ofstream(filename.c_str(), mode); 93 if (!file->is_open()) --- 12 unchanged lines hidden (view full) --- 106 continue; 107 108 ofstream *fs = dynamic_cast<ofstream*>(i->second); 109 if (fs) { 110 fs->close(); 111 delete i->second; 112 break; 113 } else { | 86 if (!file->is_open()) 87 fatal("Cannot open file %s", filename); 88 assert(files.find(filename) == files.end()); 89 files[filename] = file; 90 return file; 91 } else { 92 ofstream *file = new ofstream(filename.c_str(), mode); 93 if (!file->is_open()) --- 12 unchanged lines hidden (view full) --- 106 continue; 107 108 ofstream *fs = dynamic_cast<ofstream*>(i->second); 109 if (fs) { 110 fs->close(); 111 delete i->second; 112 break; 113 } else { |
114 ogzstream *gfs = dynamic_cast<ogzstream*>(i->second); | 114 gzofstream *gfs = dynamic_cast<gzofstream*>(i->second); |
115 if (gfs) { 116 gfs->close(); 117 delete i->second; 118 break; 119 } 120 } 121 } 122 --- 150 unchanged lines hidden --- | 115 if (gfs) { 116 gfs->close(); 117 delete i->second; 118 break; 119 } 120 } 121 } 122 --- 150 unchanged lines hidden --- |