#include <boost/filesystem.hpp>
#include <curl/curl.h>
#include <zip.h>
-#include "util.h"
+#include "scoped_temporary.h"
+#include "compose.hpp"
#include "safe_stringstream.h"
#include "i18n.h"
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "scoped_temporary.h"
+
+/** Construct a ScopedTemporary. A temporary filename is decided but the file is not opened
+ * until ::open() is called.
+ */
+ScopedTemporary::ScopedTemporary ()
+ : _open (0)
+{
+ _file = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path ();
+}
+
+/** Close and delete the temporary file */
+ScopedTemporary::~ScopedTemporary ()
+{
+ close ();
+ boost::system::error_code ec;
+ boost::filesystem::remove (_file, ec);
+}
+
+/** @return temporary filename */
+char const *
+ScopedTemporary::c_str () const
+{
+ return _file.string().c_str ();
+}
+
+/** Open the temporary file.
+ * @return File's FILE pointer.
+ */
+FILE*
+ScopedTemporary::open (char const * params)
+{
+ _open = fopen (c_str(), params);
+ return _open;
+}
+
+/** Close the file */
+void
+ScopedTemporary::close ()
+{
+ if (_open) {
+ fclose (_open);
+ _open = 0;
+ }
+}
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/filesystem.hpp>
+#include <cstdio>
+
+/** @class ScopedTemporary
+ * @brief A temporary file which is deleted when the ScopedTemporary object goes out of scope.
+ */
+class ScopedTemporary
+{
+public:
+ ScopedTemporary ();
+ ~ScopedTemporary ();
+
+ /** @return temporary filename */
+ boost::filesystem::path file () const {
+ return _file;
+ }
+
+ char const * c_str () const;
+ FILE* open (char const *);
+ void close ();
+
+private:
+ boost::filesystem::path _file;
+ FILE* _open;
+};
return ap.str ();
}
-#ifdef DCPOMATIC_POSIX
-/** @param l Mangled C++ identifier.
- * @return Demangled version.
- */
-static string
-demangle (string l)
-{
- string::size_type const b = l.find_first_of (N_("("));
- if (b == string::npos) {
- return l;
- }
-
- string::size_type const p = l.find_last_of (N_("+"));
- if (p == string::npos) {
- return l;
- }
-
- if ((p - b) <= 1) {
- return l;
- }
-
- string const fn = l.substr (b + 1, p - b - 1);
-
- int status;
- try {
-
- char* realname = abi::__cxa_demangle (fn.c_str(), 0, 0, &status);
- string d (realname);
- free (realname);
- return d;
-
- } catch (std::exception) {
-
- }
-
- return l;
-}
-
-/** Write a stacktrace to an ostream.
- * @param out Stream to write to.
- * @param levels Number of levels to go up the call stack.
- */
-void
-stacktrace (ostream& out, int levels)
-{
- void *array[200];
- size_t size = backtrace (array, 200);
- char** strings = backtrace_symbols (array, size);
-
- if (strings) {
- for (size_t i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
- out << N_(" ") << demangle (strings[i]) << "\n";
- }
-
- free (strings);
- }
-}
-#endif
-
/** @param v Version as used by FFmpeg.
* @return A string representation of v.
*/
<< std::endl;
}
-#ifdef DCPOMATIC_POSIX
- stacktrace (cout, 50);
-#endif
abort();
}
return s.str ();
}
-/** Construct a ScopedTemporary. A temporary filename is decided but the file is not opened
- * until ::open() is called.
- */
-ScopedTemporary::ScopedTemporary ()
- : _open (0)
-{
- _file = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path ();
-}
-
-/** Close and delete the temporary file */
-ScopedTemporary::~ScopedTemporary ()
-{
- close ();
- boost::system::error_code ec;
- boost::filesystem::remove (_file, ec);
-}
-
-/** @return temporary filename */
-char const *
-ScopedTemporary::c_str () const
-{
- return _file.string().c_str ();
-}
-
-/** Open the temporary file.
- * @return File's FILE pointer.
- */
-FILE*
-ScopedTemporary::open (char const * params)
-{
- _open = fopen (c_str(), params);
- return _open;
-}
-
-/** Close the file */
-void
-ScopedTemporary::close ()
-{
- if (_open) {
- fclose (_open);
- _open = 0;
- }
-}
-
ContentTimePeriod
subtitle_period (AVSubtitle const & sub)
{
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
- Copyright (C) 2000-2007 Paul Davis
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
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
/** The maximum number of audio channels that we can have in a DCP */
#define MAX_DCP_AUDIO_CHANNELS 12
+/** Message broadcast to find possible encoding servers */
#define DCPOMATIC_HELLO "Boys, you gotta learn not to talk to nuns that way"
+/** Number of films to keep in history */
#define HISTORY_SIZE 10
#define REPORT_PROBLEM _("Please report this problem by using Help -> Report a problem or via email to carl@dcpomatic.com")
extern std::string seconds_to_hms (int);
extern std::string seconds_to_approximate_hms (int);
-extern void stacktrace (std::ostream &, int);
extern std::string dependency_version_summary ();
extern double seconds (struct timeval);
extern void dcpomatic_setup ();
extern int64_t video_frames_to_audio_frames (VideoFrame v, float audio_sample_rate, float frames_per_second);
-/** @class ScopedTemporary
- * @brief A temporary file which is deleted when the ScopedTemporary object goes out of scope.
- */
-class ScopedTemporary
-{
-public:
- ScopedTemporary ();
- ~ScopedTemporary ();
-
- /** @return temporary filename */
- boost::filesystem::path file () const {
- return _file;
- }
-
- char const * c_str () const;
- FILE* open (char const *);
- void close ();
-
-private:
- boost::filesystem::path _file;
- FILE* _open;
-};
-
#endif
safe_stringstream.cc
scp_dcp_job.cc
scaler.cc
+ scoped_temporary.cc
send_kdm_email_job.cc
send_problem_report_job.cc
server.cc
t = new wxStaticText (
this, wxID_ANY,
- _("(C) 2012-2014 Carl Hetherington, Terrence Meiczinger, Paul Davis,\n Ole Laursen, Brecht Sanders"),
+ _("(C) 2012-2014 Carl Hetherington, Terrence Meiczinger\n Ole Laursen, Brecht Sanders"),
wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
);