Skip to content
This repository
Browse code

o Remove some trailing whitespaces

o Work around broken microhttpd header
o Suggest apt-get instead of aptitude: more common.
  • Loading branch information...
commit 1bce63453c6f42bafc0bf788f707dfa79b60effd 1 parent 4d4d90b
Henner Zeller authored September 24, 2012
4  README.md
Source Rendered
@@ -62,8 +62,8 @@ This project is notably based on
62 62
   This requires the latest versions of libfuse and libzita convolver to compile.
63 63
   .. and a couple of other libs:
64 64
 
65  
-    $ sudo aptitude install libsndfile-dev libflac-dev libzita-convolver-dev \
66  
-                            libfuse-dev libboost-dev libmicrohttpd-dev
  65
+    $ sudo apt-get install libsndfile-dev libflac-dev libzita-convolver-dev \
  66
+                           libfuse-dev libboost-dev libmicrohttpd-dev
67 67
     $ make
68 68
     $ sudo make install
69 69
 
2  folve-main.cc
... ...
@@ -1,7 +1,7 @@
1 1
 //  Folve - A fuse filesystem that convolves audio files on-the-fly.
2 2
 //
3 3
 //  Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
4  
-//    
  4
+//
5 5
 //  This program is free software; you can redistribute it and/or modify
6 6
 //  it under the terms of the GNU General Public License as published by
7 7
 //  the Free Software Foundation; either version 3 of the License, or
45  status-server.cc
... ...
@@ -1,7 +1,7 @@
1 1
 //  Folve - A fuse filesystem that convolves audio files on-the-fly.
2 2
 //
3 3
 //  Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
4  
-//    
  4
+//
5 5
 //  This program is free software; you can redistribute it and/or modify
6 6
 //  it under the terms of the GNU General Public License as published by
7 7
 //  the Free Software Foundation; either version 3 of the License, or
@@ -20,11 +20,14 @@
20 20
 #include <math.h>
21 21
 #include <stdio.h>
22 22
 #include <stdlib.h>
  23
+#include <string.h>
23 24
 #include <sys/select.h>
24 25
 #include <sys/socket.h>
25 26
 #include <sys/time.h>
26 27
 #include <sys/types.h>
27 28
 
  29
+// Microhttpd's headers (at least v0.4.4) are broken and don't include stdarg.h
  30
+#include <stdarg.h>
28 31
 #include <microhttpd.h>
29 32
 
30 33
 #include <boost/thread/locks.hpp>
@@ -99,7 +102,7 @@ int StatusServer::HandleHttp(void* user_argument,
99 102
     // We redirect to slash after this, to remove parameters from the GET-URL
100 103
     response = MHD_create_response_from_data(0, (void*)"", MHD_NO, MHD_NO);
101 104
     MHD_add_response_header(response, "Location", "/");
102  
-    ret = MHD_queue_response(connection, 302, response);    
  105
+    ret = MHD_queue_response(connection, 302, response);
103 106
   } else {
104 107
     const std::string &page = server->CreatePage();
105 108
     response = MHD_create_response_from_data(page.length(), (void*) page.data(),
@@ -139,7 +142,7 @@ void StatusServer::SetDebug(const char *dbg) {
139 142
 
140 143
 bool StatusServer::Start(int port) {
141 144
   PrepareConfigDirectoriesForUI();
142  
-  daemon_ = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL, 
  145
+  daemon_ = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
143 146
                              &HandleHttp, this,
144 147
                              MHD_OPTION_END);
145 148
   return daemon_ != NULL;
@@ -166,7 +169,7 @@ void StatusServer::RetireHandlerEvent(FileHandler *handler) {
166 169
     retired_.pop_back();
167 170
   }
168 171
 }
169  
-               
  172
+
170 173
 // As ugly #defines, so that gcc can warn about printf() format problems.
171 174
 #define sMessageRowHtml \
172 175
   "<td>%s</td><td colspan='3' style='font-size:small;'>%s</td>"
@@ -208,7 +211,7 @@ void StatusServer::AppendFileInfo(const char *progress_style,
208 211
   const int secs = stats.duration_seconds;
209 212
   const int fract_sec = stats.progress * secs;
210 213
   if (secs >= 0 && fract_sec >= 0) {
211  
-    Appendf(&content_, sTimeColumns, 
  214
+    Appendf(&content_, sTimeColumns,
212 215
             fract_sec / 60, fract_sec % 60,
213 216
             secs / 60, secs % 60);
214 217
   } else {
@@ -329,20 +332,22 @@ const std::string &StatusServer::CreatePage() {
329 332
       active_filtered += stats.duration_seconds * stats.progress;
330 333
     }
331 334
   }
332  
-  const int t_seen = total_seconds_music_seen_ + active_music_seen;
333  
-  const int t_filtered = total_seconds_filtered_ + active_filtered;
334  
-  Appendf(&content_, "Total opening files <b>%d</b> "
335  
-          ".. and re-opened from recency cache <b>%d</b><br/>",
336  
-          filesystem_->total_file_openings(),
337  
-          filesystem_->total_file_reopen());
338  
-  Appendf(&content_, "Total music seen <b>%dd %d:%02d:%02d</b> ",
339  
-          t_seen / 86400, (t_seen % 86400) / 3600,
340  
-          (t_seen % 3600) / 60, t_seen % 60);
341  
-  Appendf(&content_, ".. and convolved <b>%dd %d:%02d:%02d</b> ",
342  
-          t_filtered / 86400, (t_filtered % 86400) / 3600,
343  
-          (t_filtered % 3600) / 60, t_filtered % 60);
344  
-  Appendf(&content_, "(%.1f%%)<br/>", 
345  
-          (t_seen == 0) ? 0.0 : (100.0 * t_filtered / t_seen));
  335
+  if (folve::IsDebugLogEnabled()) {
  336
+    const int t_seen = total_seconds_music_seen_ + active_music_seen;
  337
+    const int t_filtered = total_seconds_filtered_ + active_filtered;
  338
+    Appendf(&content_, "Total opening files <b>%d</b> "
  339
+	    ".. and re-opened from recency cache <b>%d</b><br/>",
  340
+	    filesystem_->total_file_openings(),
  341
+	    filesystem_->total_file_reopen());
  342
+    Appendf(&content_, "Total music seen <b>%dd %d:%02d:%02d</b> ",
  343
+	    t_seen / 86400, (t_seen % 86400) / 3600,
  344
+	    (t_seen % 3600) / 60, t_seen % 60);
  345
+    Appendf(&content_, ".. and convolved <b>%dd %d:%02d:%02d</b> ",
  346
+	    t_filtered / 86400, (t_filtered % 86400) / 3600,
  347
+	    (t_filtered % 3600) / 60, t_filtered % 60);
  348
+    Appendf(&content_, "(%.1f%%)<br/>",
  349
+	    (t_seen == 0) ? 0.0 : (100.0 * t_filtered / t_seen));
  350
+  }
346 351
 
347 352
   Appendf(&content_, "<h3>Accessed Recently</h3>\n%zd in recency cache\n",
348 353
           stat_list.size());
@@ -367,7 +372,7 @@ const std::string &StatusServer::CreatePage() {
367 372
     content_.append("<h3>Retired</h3>\n");
368 373
     content_.append("<table>\n");
369 374
     boost::lock_guard<boost::mutex> l(retired_mutex_);
370  
-    for (RetiredList::const_iterator it = retired_.begin(); 
  375
+    for (RetiredList::const_iterator it = retired_.begin();
371 376
          it != retired_.end(); ++it) {
372 377
       AppendFileInfo(kRetiredProgress, *it);
373 378
     }
2  util.cc
... ...
@@ -1,7 +1,7 @@
1 1
 //  Folve - A fuse filesystem that convolves audio files on-the-fly.
2 2
 //
3 3
 //  Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
4  
-//    
  4
+//
5 5
 //  This program is free software; you can redistribute it and/or modify
6 6
 //  it under the terms of the GNU General Public License as published by
7 7
 //  the Free Software Foundation; either version 3 of the License, or
2  util.h
@@ -2,7 +2,7 @@
2 2
 //  Folve - A fuse filesystem that convolves audio files on-the-fly.
3 3
 //
4 4
 //  Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
5  
-//    
  5
+//
6 6
 //  This program is free software; you can redistribute it and/or modify
7 7
 //  it under the terms of the GNU General Public License as published by
8 8
 //  the Free Software Foundation; either version 3 of the License, or

0 notes on commit 1bce634

Please sign in to comment.
Something went wrong with that request. Please try again.