[beast/devel: 26/28] BSE: flac: style fixes



commit c23f02a8aaf8f76b29510a4f1c8b375d4f16ffbd
Author: Tim Janik <timj gnu org>
Date:   Wed May 1 14:19:46 2013 +0200

    BSE: flac: style fixes

 bse/bseloader-flac.cc |   36 +++++++++++++-----------------------
 bse/bsetrack.cc       |    3 +--
 bse/gsldatahandle.cc  |    2 +-
 3 files changed, 15 insertions(+), 26 deletions(-)
---
diff --git a/bse/bseloader-flac.cc b/bse/bseloader-flac.cc
index 5ee2f60..c10baad 100644
--- a/bse/bseloader-flac.cc
+++ b/bse/bseloader-flac.cc
@@ -10,20 +10,10 @@
 
 namespace {
 
-static FLAC__StreamDecoderWriteStatus
-flac_write_callback (const FLAC__StreamDecoder  *decoder,
-                     const FLAC__Frame          *frame,
-                     const FLAC__int32          *const buffer[],
-                     void                       *client_data)
-{
-  return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
-}
-
 struct FileInfo
 {
   BseWaveFileInfo wfi;
   BseWaveDsc      wdsc;
-
   // pass error status from flac callback to caller
   bool                              error_occurred;
   FLAC__StreamDecoderErrorStatus    error_status;
@@ -37,7 +27,14 @@ struct FileInfo
     fi->error_occurred = true;
     fi->error_status = status;
   }
-
+  static FLAC__StreamDecoderWriteStatus
+  flac_write_callback (const FLAC__StreamDecoder  *decoder,
+                       const FLAC__Frame          *frame,
+                       const FLAC__int32          *const buffer[],
+                       void                       *client_data)
+  {
+    return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+  }
   FileInfo (const gchar  *file_name,
             BseErrorType *error_p)
   {
@@ -45,7 +42,6 @@ struct FileInfo
     memset (&wfi, 0, sizeof (wfi));
     memset (&wdsc, 0, sizeof (wdsc));
 
-
     /* setup decoder, decoding from file */
     FLAC__StreamDecoder* decoder = FLAC__stream_decoder_new();
     if (!decoder)
@@ -53,7 +49,6 @@ struct FileInfo
         *error_p = BSE_ERROR_INTERNAL;  // should not happen
         return;
       }
-
     error_occurred = false;
     int r = FLAC__stream_decoder_init_file (decoder, file_name, flac_write_callback, NULL, 
flac_error_callback, this);
     if (r != 0)
@@ -64,9 +59,9 @@ struct FileInfo
 
     /* decode enough to figure out channel count */
     FLAC__bool mdok;
-    do {
+    do
       mdok = FLAC__stream_decoder_process_single (decoder);
-    } while (FLAC__stream_decoder_get_channels (decoder) == 0 && mdok);
+    while (FLAC__stream_decoder_get_channels (decoder) == 0 && mdok);
 
     if (error_occurred || FLAC__stream_decoder_get_channels (decoder) == 0)
       {
@@ -89,7 +84,6 @@ struct FileInfo
     wdsc.chunks[0].mix_freq = FLAC__stream_decoder_get_sample_rate (decoder);
     wdsc.chunks[0].osc_freq = 440.0;
   }
-
   ~FileInfo()
   {
     /* free BseWaveDsc */
@@ -109,7 +103,7 @@ struct FileInfo
   }
 };
 
-}
+} // Anon
 
 static BseWaveFileInfo*
 flac_load_file_info (gpointer      data,
@@ -127,8 +121,7 @@ flac_load_file_info (gpointer      data,
 }
 
 static void
-flac_free_file_info (gpointer         data,
-                   BseWaveFileInfo *wave_file_info)
+flac_free_file_info (gpointer data, BseWaveFileInfo *wave_file_info)
 {
   FileInfo *file_info = reinterpret_cast<FileInfo*> (wave_file_info);
   delete file_info;
@@ -160,10 +153,7 @@ flac_create_chunk_handle (gpointer      data,
 
   FileInfo *file_info = reinterpret_cast<FileInfo*> (wave_dsc->file_info);
   const BseWaveChunkDsc *chunk = &wave_dsc->chunks[nth_chunk];
-
-  GslDataHandle *dhandle;
-  dhandle = bse_data_handle_new_flac (file_info->wfi.file_name,
-                                     chunk->osc_freq);
+  GslDataHandle *dhandle = bse_data_handle_new_flac (file_info->wfi.file_name, chunk->osc_freq);
   return dhandle;
 }
 
diff --git a/bse/bsetrack.cc b/bse/bsetrack.cc
index 9b9f6c4..d5022d6 100644
--- a/bse/bsetrack.cc
+++ b/bse/bsetrack.cc
@@ -321,8 +321,7 @@ set_amp_master_volume (BseSNet *snet, const char *amp_name, gchar **xinfos)
   if (master_volume_db)
     {
       BseItem *amp = bse_container_resolve_upath (BSE_CONTAINER (snet), amp_name);
-
-      double volume;
+      double volume = 0;
       g_object_get (amp, "master-volume", &volume, NULL);
       volume *= bse_db_to_factor (g_ascii_strtod (master_volume_db, NULL));
       g_object_set (amp, "master-volume", volume, NULL);
diff --git a/bse/gsldatahandle.cc b/bse/gsldatahandle.cc
index ccb45b7..b8c9dba 100644
--- a/bse/gsldatahandle.cc
+++ b/bse/gsldatahandle.cc
@@ -243,7 +243,7 @@ gsl_data_handle_volume (GslDataHandle *dhandle)
   dhandle->spinlock.lock();
   gfloat f = bse_xinfos_get_float (dhandle->setup.xinfos, "volume");
   dhandle->spinlock.unlock();
-  /* no (or invalid) volume setting means that we replay without scaling */
+  // no volume setting means that we replay without scaling
   if (f <= 0)
     f = 1.0;
   return f;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]