Split test compile up into individual files.
[dcpomatic.git] / src / lib / util.cc
index d425fc8fefe009c3f0ee44ed94eab18c1d969285..7e7e579a4b5ac4d20bef402c43bec455ea05021d 100644 (file)
@@ -91,8 +91,8 @@ using boost::lexical_cast;
 using boost::optional;
 using libdcp::Size;
 
-boost::thread::id ui_thread;
-boost::filesystem::path backtrace_file;
+static boost::thread::id ui_thread;
+static boost::filesystem::path backtrace_file;
 
 /** Convert some number of seconds to a string representation
  *  in hours, minutes and seconds.
@@ -119,12 +119,6 @@ seconds_to_hms (int s)
        return hms.str ();
 }
 
-string
-time_to_hms (Time t)
-{
-       return seconds_to_hms (t / TIME_HZ);
-}
-
 /** @param s Number of seconds.
  *  @return String containing an approximate description of s (e.g. "about 2 hours")
  */
@@ -207,15 +201,11 @@ void
 stacktrace (ostream& out, int levels)
 {
        void *array[200];
-       size_t size;
-       char **strings;
-       size_t i;
-     
-       size = backtrace (array, 200);
-       strings = backtrace_symbols (array, size);
+       size_t size = backtrace (array, 200);
+       char** strings = backtrace_symbols (array, size);
      
        if (strings) {
-               for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
+               for (size_t i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
                        out << N_("  ") << demangle (strings[i]) << "\n";
                }
                
@@ -270,7 +260,7 @@ LONG WINAPI exception_handler(struct _EXCEPTION_POINTERS *)
 }
 #endif
 
-/** Call the required functions to set up DVD-o-matic's static arrays, etc.
+/** Call the required functions to set up DCP-o-matic's static arrays, etc.
  *  Must be called from the UI thread, if there is one.
  */
 void
@@ -338,18 +328,6 @@ dcpomatic_setup_gettext_i18n (string lang)
 #endif
 }
 
-/** @param start Start position for the crop within the image.
- *  @param size Size of the cropped area.
- *  @return FFmpeg crop filter string.
- */
-string
-crop_string (Position start, libdcp::Size size)
-{
-       stringstream s;
-       s << N_("crop=") << size.width << N_(":") << size.height << N_(":") << start.x << N_(":") << start.y;
-       return s.str ();
-}
-
 /** @param s A string.
  *  @return Parts of the string split at spaces, except when a space is within quotation marks.
  */
@@ -469,23 +447,6 @@ dcp_audio_frame_rate (int fs)
        return 96000;
 }
 
-/** @param index Colour LUT index.
- *  @return Human-readable name.
- */
-string
-colour_lut_index_to_name (int index)
-{
-       switch (index) {
-       case 0:
-               return _("sRGB");
-       case 1:
-               return _("Rec 709");
-       }
-
-       assert (false);
-       return N_("");
-}
-
 Socket::Socket (int timeout)
        : _deadline (_io_service)
        , _socket (_io_service)
@@ -594,12 +555,6 @@ stride_round_up (int c, int const * stride, int t)
        return a - (a % t);
 }
 
-int
-stride_lookup (int c, int const * stride)
-{
-       return stride[c];
-}
-
 /** Read a sequence of key / value pairs from a text stream;
  *  the keys are the first words on the line, and the values are
  *  the remainder of the line following the key.  Lines beginning
@@ -769,12 +724,12 @@ LocaleGuard::LocaleGuard ()
 {
        char const * old = setlocale (LC_NUMERIC, 0);
 
-        if (old) {
-                _old = strdup (old);
-                if (strcmp (_old, "C")) {
-                        setlocale (LC_NUMERIC, "C");
-                }
-        }
+       if (old) {
+               _old = strdup (old);
+               if (strcmp (_old, "C")) {
+                       setlocale (LC_NUMERIC, "C");
+               }
+       }
 }
 
 LocaleGuard::~LocaleGuard ()