Skip to content

Commit

Permalink
o There was a report of a 2.7.1 ICE, apparently on a generated move
Browse files Browse the repository at this point in the history
  constructor. Let's add an explicit copy constructor and see what
  happens.
  • Loading branch information
hzeller committed Sep 29, 2012
1 parent 11c2493 commit e2c7d54
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
22 changes: 19 additions & 3 deletions file-handler.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Folve - A fuse filesystem that convolves audio files on-the-fly. // Folve - A fuse filesystem that convolves audio files on-the-fly.
// //
// Copyright (C) 2012 Henner Zeller <h.zeller@acm.org> // Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or // the Free Software Foundation; either version 3 of the License, or
Expand All @@ -22,10 +22,26 @@
#include <string> #include <string>


// Status about some handler, filled in by various subsystem. // Status about some handler, filled in by various subsystem.
struct HandlerStats { // This is mostly used to be displayed in the HTTP server. And to survive
// after the FileHandler is long gone, to show 'retired' elements in the
// status server.
class HandlerStats {
public:
HandlerStats() HandlerStats()
: duration_seconds(-1), progress(-1), status(OPEN), last_access(0), : duration_seconds(-1), progress(-1), status(OPEN), last_access(0),
max_output_value(0), in_gapless(false), out_gapless(false) {} max_output_value(0), in_gapless(false), out_gapless(false) {}

// Copy constructor: test to work around some gcc 2.7.1 seen in the field.
// To be removed after test.
HandlerStats(const HandlerStats &other)
: filename(other.filename), format(other.format), message(other.message),
duration_seconds(other.duration_seconds), progress(other.progress),
status(other.status), last_access(other.last_access),
max_output_value(other.max_output_value),
in_gapless(other.in_gapless), out_gapless(other.out_gapless),
filter_id(other.filter_id) {
}

std::string filename; // filesystem name. std::string filename; // filesystem name.
std::string format; // File format info if recognized. std::string format; // File format info if recognized.
std::string message; // Per file (error) message if any. std::string message; // Per file (error) message if any.
Expand Down Expand Up @@ -59,7 +75,7 @@ class FileHandler {
virtual int Stat(struct stat *st) = 0; virtual int Stat(struct stat *st) = 0;


// Get handler status. // Get handler status.
virtual void GetHandlerStatus(struct HandlerStats *s) = 0; virtual void GetHandlerStatus(HandlerStats *s) = 0;
virtual bool AcceptProcessor(SoundProcessor *s) { return false; } virtual bool AcceptProcessor(SoundProcessor *s) { return false; }


private: private:
Expand Down
6 changes: 3 additions & 3 deletions folve-filesystem.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ class PassThroughHandler : public FileHandler {
virtual int Stat(struct stat *st) { virtual int Stat(struct stat *st) {
return fstat(filedes_, st); return fstat(filedes_, st);
} }
virtual void GetHandlerStatus(struct HandlerStats *stats) { virtual void GetHandlerStatus(HandlerStats *stats) {
*stats = info_stats_; *stats = info_stats_;
if (file_size_ > 0) { if (file_size_ > 0) {
stats->progress = 1.0 * max_accessed_ / file_size_; stats->progress = 1.0 * max_accessed_ / file_size_;
} }
} }

private: private:
const int filedes_; const int filedes_;
size_t file_size_; size_t file_size_;
Expand Down Expand Up @@ -203,7 +203,7 @@ class SndFileHandler :
return output_buffer_->Read(buf, size, offset); return output_buffer_->Read(buf, size, offset);
} }


virtual void GetHandlerStatus(struct HandlerStats *stats) { virtual void GetHandlerStatus(HandlerStats *stats) {
boost::lock_guard<boost::mutex> l(stats_mutex_); boost::lock_guard<boost::mutex> l(stats_mutex_);
if (processor_ != NULL) { if (processor_ != NULL) {
base_stats_.max_output_value = processor_->max_output_value(); base_stats_.max_output_value = processor_->max_output_value();
Expand Down

0 comments on commit e2c7d54

Please sign in to comment.