[beast: 13/29] BSE: fix Bse::error uses and type mismatches



commit c6bee0887e358065f6a2579c4f541758336b2042
Author: Tim Janik <timj gnu org>
Date:   Sat Jan 30 01:36:42 2016 +0100

    BSE: fix Bse::error uses and type mismatches
    
    Signed-off-by: Tim Janik <timj gnu org>

 beast-gtk/bstapi.idl          |   16 +++---
 beast-gtk/bstapp.cc           |    2 +-
 beast-gtk/bstfiledialog.cc    |    4 +-
 beast-gtk/bstkeybindings.cc   |    2 +-
 beast-gtk/bstmain.cc          |   12 ++--
 beast-gtk/bstmsgabsorb.cc     |    4 +-
 beast-gtk/bstpianorollctrl.cc |    2 +-
 beast-gtk/bstplayback.cc      |    2 +-
 beast-gtk/bstpreferences.cc   |    6 +-
 beast-gtk/bstqsampler.cc      |    6 +-
 beast-gtk/bsttreestores.cc    |    2 +-
 beast-gtk/bstutils.cc         |    2 +-
 beast-gtk/bstwaveeditor.cc    |    2 +-
 bse/bsebus.cc                 |    7 +-
 bse/bsecompat.hh              |    2 +-
 bse/bsedatahandle-flac.cc     |    2 +-
 bse/bseeditablesample.proc    |    2 +-
 bse/bseenums.hh               |  136 ++++++++++++++++++++--------------------
 bse/bseglue.cc                |    2 +-
 bse/bseitem.cc                |    4 +-
 bse/bseloader-aiff.cc         |    4 +-
 bse/bseloader-flac.cc         |    2 +-
 bse/bseloader-guspatch.cc     |   12 ++--
 bse/bseloader-mad.cc          |    2 +-
 bse/bseloader-wav.cc          |    6 +-
 bse/bseloader.cc              |    6 +-
 bse/bsemidifile.cc            |    7 +-
 bse/bsepart.cc                |    4 +-
 bse/bseproject.cc             |    6 +-
 bse/bseproject.proc           |    2 +-
 bse/bsescripthelper.cc        |    2 +-
 bse/bseserver.cc              |   10 ++--
 bse/bsesong.cc                |    2 +-
 bse/bsesource.cc              |    6 +-
 bse/bsesource.proc            |   12 ++--
 bse/bsestorage.cc             |    4 +-
 bse/bsetool.cc                |    4 +-
 bse/bsewave.cc                |    4 +-
 bse/bsewaverepo.proc          |    2 +-
 bse/gsldatacache.cc           |    2 +-
 bse/gsldatahandle-mad.cc      |    4 +-
 bse/gsldatahandle-vorbis.cc   |    2 +-
 bse/gsldatahandle.cc          |    2 +-
 bse/gsldatautils.cc           |    2 +-
 bse/mkcproc.pl                |    2 +-
 bse/tests/loophandle.cc       |    4 +-
 sfi/sfidl-corecxx.cc          |    6 +-
 tests/testwavechunk.cc        |    6 +-
 tools/bsefextract.cc          |    2 +-
 tools/bsewavetool.cc          |   30 +++++-----
 50 files changed, 190 insertions(+), 186 deletions(-)
---
diff --git a/beast-gtk/bstapi.idl b/beast-gtk/bstapi.idl
index 8472e89..149dfe9 100644
--- a/beast-gtk/bstapi.idl
+++ b/beast-gtk/bstapi.idl
@@ -62,14 +62,14 @@ enum NoteLength {
 };
 
 enum QSamplerDrawMode {
-  QSAMPLER_DRAW_CRANGE          = Enum (_("Shape Range")),
-  QSAMPLER_DRAW_ZERO_SHAPE      = Enum (_("Shape Average")),
-  QSAMPLER_DRAW_MINIMUM_SHAPE   = Enum (_("Shape Minimum")),
-  QSAMPLER_DRAW_MAXIMUM_SHAPE   = Enum (_("Shape Maximum")),
-  QSAMPLER_DRAW_CSHAPE          = Enum (_("Sketch Range")),
-  QSAMPLER_DRAW_MIDDLE_LINE     = Enum (_("Sketch Average")),
-  QSAMPLER_DRAW_MINIMUM_LINE    = Enum (_("Sketch Minimum")),
-  QSAMPLER_DRAW_MAXIMUM_LINE    = Enum (_("Sketch Maximum")),
+  CRANGE          = Enum (_("Shape Range")),
+  ZERO_SHAPE      = Enum (_("Shape Average")),
+  MINIMUM_SHAPE   = Enum (_("Shape Minimum")),
+  MAXIMUM_SHAPE   = Enum (_("Shape Maximum")),
+  CSHAPE          = Enum (_("Sketch Range")),
+  MIDDLE_LINE     = Enum (_("Sketch Average")),
+  MINIMUM_LINE    = Enum (_("Sketch Minimum")),
+  MAXIMUM_LINE    = Enum (_("Sketch Maximum")),
 };
 
 enum RowShading {
diff --git a/beast-gtk/bstapp.cc b/beast-gtk/bstapp.cc
index 6b6959f..58e3ca2 100644
--- a/beast-gtk/bstapp.cc
+++ b/beast-gtk/bstapp.cc
@@ -701,7 +701,7 @@ demo_play_song (gpointer data,
   const gchar *file_name = demo_entries[callback_action - BST_ACTION_LOAD_DEMO_0000].file;
   Bse::ProjectH project = bse_server.create_project (file_name);
   Bse::Error error = bst_project_restore_from_file (project, file_name, TRUE, TRUE);
-  if (error)
+  if (error != 0)
     {
       bst_status_eprintf (error, _("Opening project `%s'"), file_name);
       bse_server.destroy_project (project);
diff --git a/beast-gtk/bstfiledialog.cc b/beast-gtk/bstfiledialog.cc
index 983f7c6..11ad834 100644
--- a/beast-gtk/bstfiledialog.cc
+++ b/beast-gtk/bstfiledialog.cc
@@ -414,7 +414,7 @@ bst_file_dialog_open_project (BstFileDialog *self,
   Bse::ProjectH project = bse_server.create_project (file_name);
   Bse::Error error = bst_project_restore_from_file (project, file_name, TRUE, TRUE);
 
-  if (error)
+  if (error != 0)
     {
       bst_status_eprintf (error, _("Opening project `%s'"), file_name);
       bse_server.destroy_project (project);
@@ -732,7 +732,7 @@ bst_file_dialog_load_wave (BstFileDialog *self,
   gxk_status_printf (0, NULL, _("Loading wave `%s'"), file_name);
   error = bse_wave_repo_load_file (self->wave_repo, file_name);
   bst_status_eprintf (error, _("Loading wave `%s'"), file_name);
-  if (error)
+  if (error != 0)
     sfi_error (_("Failed to load wave file \"%s\": %s"), file_name, Bse::error_blurb (error));
 
   return TRUE;
diff --git a/beast-gtk/bstkeybindings.cc b/beast-gtk/bstkeybindings.cc
index d5549d7..16277c0 100644
--- a/beast-gtk/bstkeybindings.cc
+++ b/beast-gtk/bstkeybindings.cc
@@ -74,7 +74,7 @@ key_bindings_load_file (GtkWidget   *dialog,
   Bse::Error error = bst_key_binding_parse (file, &slist);
   gxk_list_wrapper_notify_clear (GXK_LIST_WRAPPER (model));
   gxk_list_wrapper_notify_append (GXK_LIST_WRAPPER (model), kbinding->n_keys);
-  if (error)
+  if (error != 0)
     g_message ("failed to load \"%s\": %s", file, Bse::error_blurb (error));
 }
 
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index 05b5bdc..9f385bd 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -375,7 +375,7 @@ main_open_files (int filesc, char **filesv)
              gxk_status_printf (GXK_STATUS_WAIT, NULL, _("Loading \"%s\""), filesv[i]);
              Bse::Error error = bse_wave_repo_load_file (wrepo, filesv[i]);
               bst_status_eprintf (error, _("Loading \"%s\""), filesv[i]);
-              if (error)
+              if (error != 0)
                 sfi_error (_("Failed to load wave file \"%s\": %s"), filesv[i], Bse::error_blurb (error));
            }
           else
@@ -405,7 +405,7 @@ main_open_files (int filesc, char **filesv)
           if (rewrite_bse_file)
             {
               Rapicorn::printerr ("%s: loading: %s\n", filesv[i], Bse::error_blurb (error));
-              if (error)
+              if (error != 0)
                 exit (1);
               if (unlink (filesv[i]) < 0)
                 {
@@ -414,7 +414,7 @@ main_open_files (int filesc, char **filesv)
                 }
               error = bse_project_store_bse (project.proxy_id(), 0, filesv[i], TRUE);
               Rapicorn::printerr ("%s: writing: %s\n", filesv[i], Bse::error_blurb (error));
-              if (error)
+              if (error != 0)
                 exit (3);
               exit (0);
             }
@@ -427,13 +427,13 @@ main_open_files (int filesc, char **filesv)
             }
           else
             bse_server.destroy_project (project);
-          if (error)
+          if (error != 0)
             sfi_error (_("Failed to load project \"%s\": %s"), filesv[i], Bse::error_blurb (error));
         }
       else
         {
           Bse::Error error = bst_project_restore_from_file (app->project, filesv[i], TRUE, FALSE);
-          if (error)
+          if (error != 0)
             sfi_error (_("Failed to merge project \"%s\": %s"), filesv[i], Bse::error_blurb (error));
         }
     }
@@ -575,7 +575,7 @@ main_save_rc_files ()
       /* save BEAST configuration and accelerator map */
       gchar *file_name = BST_STRDUP_RC_FILE ();
       Bse::Error error = bst_rc_dump (file_name);
-      if (error)
+      if (error != 0)
        g_warning ("failed to save rc-file \"%s\": %s", file_name, Bse::error_blurb (error));
       g_free (file_name);
     }
diff --git a/beast-gtk/bstmsgabsorb.cc b/beast-gtk/bstmsgabsorb.cc
index 601a8fa..10d7722 100644
--- a/beast-gtk/bstmsgabsorb.cc
+++ b/beast-gtk/bstmsgabsorb.cc
@@ -267,7 +267,7 @@ bst_msg_absorb_config_save (void)
 {
   gchar *file_name = BST_STRDUP_ABSORBRC_FILE();
   Bse::Error error = bst_msg_absorb_config_dump (file_name);
-  if (error)
+  if (error != 0)
     sfi_diag ("Failed to save config-file \"%s\": %s", file_name, Bse::error_blurb (error));
   g_free (file_name);
 }
@@ -368,7 +368,7 @@ bst_msg_absorb_config_load (void)
 {
   gchar *file_name = BST_STRDUP_ABSORBRC_FILE();
   Bse::Error error = bst_msg_absorb_config_parse (file_name);
-  if (0 && error)
+  if (0) // error
     sfi_diag ("Failed to load config-file \"%s\": %s", file_name, Bse::error_blurb (error));
   g_free (file_name);
   msg_absorb_config_loaded = TRUE;
diff --git a/beast-gtk/bstpianorollctrl.cc b/beast-gtk/bstpianorollctrl.cc
index 769620d..3753516 100644
--- a/beast-gtk/bstpianorollctrl.cc
+++ b/beast-gtk/bstpianorollctrl.cc
@@ -662,7 +662,7 @@ resize_motion (BstPianoRollController *self,
       if (self->obj_id)
        {
          Bse::Error error = part.delete_event (self->obj_id);
-         if (error)
+         if (error != 0)
            drag->state = GXK_DRAG_ERROR;
          self->obj_id = 0;
        }
diff --git a/beast-gtk/bstplayback.cc b/beast-gtk/bstplayback.cc
index 29bf8e5..fe333f4 100644
--- a/beast-gtk/bstplayback.cc
+++ b/beast-gtk/bstplayback.cc
@@ -60,7 +60,7 @@ bst_play_back_handle_start (BstPlayBackHandle *handle)
   Bse::Error error;
 
   error = handle->project.play();;
-  if (error)
+  if (error != 0)
     bst_status_eprintf (error, _("Playback"));
 }
 
diff --git a/beast-gtk/bstpreferences.cc b/beast-gtk/bstpreferences.cc
index ae16aea..0619482 100644
--- a/beast-gtk/bstpreferences.cc
+++ b/beast-gtk/bstpreferences.cc
@@ -319,7 +319,7 @@ bst_preferences_save (BstPreferences *self)
 
   file_name = BST_STRDUP_RC_FILE ();
   error = bst_rc_dump (file_name);
-  if (error)
+  if (error != 0)
     g_warning ("failed to save rc-file \"%s\": %s", file_name, Bse::error_blurb (error));
   else
     successfull_rc_dump = TRUE;
@@ -329,7 +329,7 @@ bst_preferences_save (BstPreferences *self)
   slist = g_slist_append (slist, bst_pattern_controller_piano_keys());
   // slist = g_slist_append (slist, bst_pattern_controller_generic_keys());
   error = bst_key_binding_dump (file_name, slist);
-  if (error)
+  if (error != 0)
     g_warning ("failed to save keyrc \"%s\": %s", file_name, Bse::error_blurb (error));
   g_slist_free (slist);
 
@@ -337,7 +337,7 @@ bst_preferences_save (BstPreferences *self)
 
   file_name = g_strdup (bst_skin_config_rcfile ());
   error = bst_skin_dump (file_name);
-  if (error)
+  if (error != 0)
     g_warning ("failed to save skinrc \"%s\": %s", file_name, Bse::error_blurb (error));
   g_free (file_name);
 }
diff --git a/beast-gtk/bstqsampler.cc b/beast-gtk/bstqsampler.cc
index d4fb646..3b6e2a5 100644
--- a/beast-gtk/bstqsampler.cc
+++ b/beast-gtk/bstqsampler.cc
@@ -93,8 +93,10 @@ bst_qsampler_class_init (BstQSamplerClass *klass)
   g_object_class_install_property (G_OBJECT_CLASS (object_class),
                                   PROP_DRAW_MODE,
                                   g_param_spec_int ("draw_mode", "Draw Mode", NULL,
-                                                     Bst::QSAMPLER_DRAW_CRANGE, 
Bst::QSAMPLER_DRAW_MAXIMUM_LINE,
-                                                     Bst::QSAMPLER_DRAW_CRANGE, G_PARAM_READWRITE));
+                                                     int64 (Bst::QSAMPLER_DRAW_CRANGE),
+                                                     int64 (Bst::QSAMPLER_DRAW_MAXIMUM_LINE),
+                                                     int64 (Bst::QSAMPLER_DRAW_CRANGE),
+                                                     G_PARAM_READWRITE));
 }
 
 static void
diff --git a/beast-gtk/bsttreestores.cc b/beast-gtk/bsttreestores.cc
index 9b12a54..d77e21e 100644
--- a/beast-gtk/bsttreestores.cc
+++ b/beast-gtk/bsttreestores.cc
@@ -77,7 +77,7 @@ file_store_idle_handler (gpointer data)
       else
         {
           name = dsep ? dsep + 1 : filename;    /* fallback wave name */
-          loader = info.error ? Bse::error_blurb (info.error) : info.loader;
+          loader = info.error != 0 ? Bse::error_blurb (info.error) : info.loader;
           guint l = strlen (filename);
           if (info.error == Bse::Error::FORMAT_UNKNOWN &&
               l >= 4 && strcasecmp (filename + l - 4, ".bse") == 0)
diff --git a/beast-gtk/bstutils.cc b/beast-gtk/bstutils.cc
index 5682995..d72175a 100644
--- a/beast-gtk/bstutils.cc
+++ b/beast-gtk/bstutils.cc
@@ -171,7 +171,7 @@ bst_stock_register_icon (const gchar    *stock_id,
 void
 bst_status_set_error (Bse::Error error, const std::string &message)
 {
-  if (error)
+  if (error != 0)
     gxk_status_set (GXK_STATUS_ERROR, message.c_str(), Bse::error_blurb (error));
   else
     gxk_status_set (GXK_STATUS_DONE, message.c_str(), NULL);
diff --git a/beast-gtk/bstwaveeditor.cc b/beast-gtk/bstwaveeditor.cc
index e14e6b6..96a8b2a 100644
--- a/beast-gtk/bstwaveeditor.cc
+++ b/beast-gtk/bstwaveeditor.cc
@@ -533,7 +533,7 @@ bst_wave_editor_set_esample (BstWaveEditor *self,
          bse_item_use (self->esample);
          error = bse_editable_sample_open (self->esample);
          self->esample_open = error == Bse::Error::NONE;
-         if (error)
+         if (error != 0)
            g_message ("failed to open sample: %s", Bse::error_blurb (error));
        }
       wave_editor_set_n_qsamplers (self, self->esample ? bse_editable_sample_get_n_channels (self->esample) 
: 0);
diff --git a/bse/bsebus.cc b/bse/bsebus.cc
index 6f74f7c..905e047 100644
--- a/bse/bsebus.cc
+++ b/bse/bsebus.cc
@@ -173,7 +173,8 @@ bus_disconnect_outputs (BseBus *self)
   for (ring = outputs; ring; ring = sfi_ring_walk (ring, outputs))
     {
       Bse::Error error = bse_bus_disconnect (BSE_BUS (ring->data), BSE_ITEM (self));
-      bse_assert_ok (error);
+      if (error != 0)
+        g_warning ("%s:%d: unexpected error: %s", __FILE__, __LINE__, bse_error_blurb (error));
     }
   bse_source_clear_ochannels (BSE_SOURCE (self));       /* also disconnects master */
   g_object_notify (G_OBJECT (self), "master-output");   /* master may have changed */
@@ -721,7 +722,7 @@ bse_bus_disconnect (BseBus  *self,
   Bse::Error error2 = bse_source_unset_input (self->summation, 1, osource, 1);
   g_object_notify (G_OBJECT (self), "inputs");
   g_object_notify (G_OBJECT (trackbus), "outputs");
-  return error1 ? error1 : error2;
+  return error1 != 0 ? error1 : error2;
 }
 
 SfiRing*
@@ -755,7 +756,7 @@ bus_restore_add_input (gpointer     data,
         cerror = bse_bus_connect (self, BSE_ITEM (osource));
       else
         cerror = Bse::Error::SOURCE_NO_SUCH_MODULE;
-      if (cerror)
+      if (cerror != 0)
         bse_storage_warn (storage,
                           "failed to add input \"%s\" to mixer bus \"%s\": %s",
                           osource ? BSE_OBJECT_UNAME (osource) : ":<NULL>:",
diff --git a/bse/bsecompat.hh b/bse/bsecompat.hh
index 72643e3..4675e88 100644
--- a/bse/bsecompat.hh
+++ b/bse/bsecompat.hh
@@ -9,7 +9,7 @@ G_BEGIN_DECLS
 
 /* --- parameter changes --- */
 #define bse_param_spec_genum(name,nick,blurb, genum_type, default_value, hints) \
-   bse_param_spec_enum (name,nick,blurb, default_value, genum_type, hints)
+  bse_param_spec_enum (name,nick,blurb, int (default_value), genum_type, hints)
 #define bse_param_spec_freq_simple(name, nick, blurb, hints) \
   bse_param_spec_freq (name, nick, blurb, BSE_KAMMER_FREQUENCY, BSE_MIN_OSC_FREQUENCY, 
BSE_MAX_OSC_FREQUENCY, hints)
 #define bse_param_spec_fine_tune(name, nick, blurb)    \
diff --git a/bse/bsedatahandle-flac.cc b/bse/bsedatahandle-flac.cc
index a014c10..0a90e61 100644
--- a/bse/bsedatahandle-flac.cc
+++ b/bse/bsedatahandle-flac.cc
@@ -429,7 +429,7 @@ Flac1Handle::read_data (void *buffer, uint blength)
     {
       rfile = gsl_rfile_open (dhandle->name);
       if (!rfile)
-        return gsl_error_from_errno (errno, Bse::Error::FILE_OPEN_FAILED);
+        return errno ? -errno : -EIO;
       byte_length = gsl_rfile_length (rfile);
       gsl_rfile_seek_set (rfile, flac_handle->file_byte_offset());
     }
diff --git a/bse/bseeditablesample.proc b/bse/bseeditablesample.proc
index 3e73650..9a8c4c4 100644
--- a/bse/bseeditablesample.proc
+++ b/bse/bseeditablesample.proc
@@ -44,7 +44,7 @@ METHOD (BseEditableSample, open) {
     }
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
diff --git a/bse/bseenums.hh b/bse/bseenums.hh
index 65d5a63..4473f2f 100644
--- a/bse/bseenums.hh
+++ b/bse/bseenums.hh
@@ -55,74 +55,74 @@ typedef enum
 #ifdef  BSE_IDL_SURROGATES
 typedef enum
 {
-  BSE_ERROR_NONE = Bse::Error::NONE,
-  BSE_ERROR_INTERNAL = Bse::Error::INTERNAL,
-  BSE_ERROR_UNKNOWN = Bse::Error::UNKNOWN,
-  BSE_ERROR_IO = Bse::Error::IO,
-  BSE_ERROR_PERMS = Bse::Error::PERMS,
-  BSE_ERROR_FILE_BUSY = Bse::Error::FILE_BUSY,
-  BSE_ERROR_FILE_EXISTS = Bse::Error::FILE_EXISTS,
-  BSE_ERROR_FILE_EOF = Bse::Error::FILE_EOF,
-  BSE_ERROR_FILE_EMPTY = Bse::Error::FILE_EMPTY,
-  BSE_ERROR_FILE_NOT_FOUND = Bse::Error::FILE_NOT_FOUND,
-  BSE_ERROR_FILE_IS_DIR = Bse::Error::FILE_IS_DIR,
-  BSE_ERROR_FILE_OPEN_FAILED = Bse::Error::FILE_OPEN_FAILED,
-  BSE_ERROR_FILE_SEEK_FAILED = Bse::Error::FILE_SEEK_FAILED,
-  BSE_ERROR_FILE_READ_FAILED = Bse::Error::FILE_READ_FAILED,
-  BSE_ERROR_FILE_WRITE_FAILED = Bse::Error::FILE_WRITE_FAILED,
-  BSE_ERROR_MANY_FILES = Bse::Error::MANY_FILES,
-  BSE_ERROR_NO_FILES = Bse::Error::NO_FILES,
-  BSE_ERROR_NO_SPACE = Bse::Error::NO_SPACE,
-  BSE_ERROR_NO_MEMORY = Bse::Error::NO_MEMORY,
-  BSE_ERROR_NO_HEADER = Bse::Error::NO_HEADER,
-  BSE_ERROR_NO_SEEK_INFO = Bse::Error::NO_SEEK_INFO,
-  BSE_ERROR_NO_DATA = Bse::Error::NO_DATA,
-  BSE_ERROR_DATA_CORRUPT = Bse::Error::DATA_CORRUPT,
-  BSE_ERROR_WRONG_N_CHANNELS = Bse::Error::WRONG_N_CHANNELS,
-  BSE_ERROR_FORMAT_INVALID = Bse::Error::FORMAT_INVALID,
-  BSE_ERROR_FORMAT_UNKNOWN = Bse::Error::FORMAT_UNKNOWN,
-  BSE_ERROR_DATA_UNMATCHED = Bse::Error::DATA_UNMATCHED,
-  BSE_ERROR_TEMP = Bse::Error::TEMP,
-  BSE_ERROR_WAVE_NOT_FOUND = Bse::Error::WAVE_NOT_FOUND,
-  BSE_ERROR_CODEC_FAILURE = Bse::Error::CODEC_FAILURE,
-  BSE_ERROR_UNIMPLEMENTED = Bse::Error::UNIMPLEMENTED,
-  BSE_ERROR_INVALID_PROPERTY = Bse::Error::INVALID_PROPERTY,
-  BSE_ERROR_INVALID_MIDI_CONTROL = Bse::Error::INVALID_MIDI_CONTROL,
-  BSE_ERROR_PARSE_ERROR = Bse::Error::PARSE_ERROR,
-  BSE_ERROR_SPAWN = Bse::Error::SPAWN,
-  BSE_ERROR_DEVICE_NOT_AVAILABLE = Bse::Error::DEVICE_NOT_AVAILABLE,
-  BSE_ERROR_DEVICE_ASYNC = Bse::Error::DEVICE_ASYNC,
-  BSE_ERROR_DEVICE_BUSY = Bse::Error::DEVICE_BUSY,
-  BSE_ERROR_DEVICE_FORMAT = Bse::Error::DEVICE_FORMAT,
-  BSE_ERROR_DEVICE_BUFFER = Bse::Error::DEVICE_BUFFER,
-  BSE_ERROR_DEVICE_LATENCY = Bse::Error::DEVICE_LATENCY,
-  BSE_ERROR_DEVICE_CHANNELS = Bse::Error::DEVICE_CHANNELS,
-  BSE_ERROR_DEVICE_FREQUENCY = Bse::Error::DEVICE_FREQUENCY,
-  BSE_ERROR_DEVICES_MISMATCH = Bse::Error::DEVICES_MISMATCH,
-  BSE_ERROR_SOURCE_NO_SUCH_MODULE = Bse::Error::SOURCE_NO_SUCH_MODULE,
-  BSE_ERROR_SOURCE_NO_SUCH_ICHANNEL = Bse::Error::SOURCE_NO_SUCH_ICHANNEL,
-  BSE_ERROR_SOURCE_NO_SUCH_OCHANNEL = Bse::Error::SOURCE_NO_SUCH_OCHANNEL,
-  BSE_ERROR_SOURCE_NO_SUCH_CONNECTION = Bse::Error::SOURCE_NO_SUCH_CONNECTION,
-  BSE_ERROR_SOURCE_PRIVATE_ICHANNEL = Bse::Error::SOURCE_PRIVATE_ICHANNEL,
-  BSE_ERROR_SOURCE_ICHANNEL_IN_USE = Bse::Error::SOURCE_ICHANNEL_IN_USE,
-  BSE_ERROR_SOURCE_CHANNELS_CONNECTED = Bse::Error::SOURCE_CHANNELS_CONNECTED,
-  BSE_ERROR_SOURCE_CONNECTION_INVALID = Bse::Error::SOURCE_CONNECTION_INVALID,
-  BSE_ERROR_SOURCE_PARENT_MISMATCH = Bse::Error::SOURCE_PARENT_MISMATCH,
-  BSE_ERROR_SOURCE_BAD_LOOPBACK = Bse::Error::SOURCE_BAD_LOOPBACK,
-  BSE_ERROR_SOURCE_BUSY = Bse::Error::SOURCE_BUSY,
-  BSE_ERROR_SOURCE_TYPE_INVALID = Bse::Error::SOURCE_TYPE_INVALID,
-  BSE_ERROR_PROC_NOT_FOUND = Bse::Error::PROC_NOT_FOUND,
-  BSE_ERROR_PROC_BUSY = Bse::Error::PROC_BUSY,
-  BSE_ERROR_PROC_PARAM_INVAL = Bse::Error::PROC_PARAM_INVAL,
-  BSE_ERROR_PROC_EXECUTION = Bse::Error::PROC_EXECUTION,
-  BSE_ERROR_PROC_ABORT = Bse::Error::PROC_ABORT,
-  BSE_ERROR_NO_ENTRY = Bse::Error::NO_ENTRY,
-  BSE_ERROR_NO_EVENT = Bse::Error::NO_EVENT,
-  BSE_ERROR_NO_TARGET = Bse::Error::NO_TARGET,
-  BSE_ERROR_NOT_OWNER = Bse::Error::NOT_OWNER,
-  BSE_ERROR_INVALID_OFFSET = Bse::Error::INVALID_OFFSET,
-  BSE_ERROR_INVALID_DURATION = Bse::Error::INVALID_DURATION,
-  BSE_ERROR_INVALID_OVERLAP = Bse::Error::INVALID_OVERLAP,
+  BSE_ERROR_NONE = int64_t (Bse::Error::NONE),
+  BSE_ERROR_INTERNAL = int64_t (Bse::Error::INTERNAL),
+  BSE_ERROR_UNKNOWN = int64_t (Bse::Error::UNKNOWN),
+  BSE_ERROR_IO = int64_t (Bse::Error::IO),
+  BSE_ERROR_PERMS = int64_t (Bse::Error::PERMS),
+  BSE_ERROR_FILE_BUSY = int64_t (Bse::Error::FILE_BUSY),
+  BSE_ERROR_FILE_EXISTS = int64_t (Bse::Error::FILE_EXISTS),
+  BSE_ERROR_FILE_EOF = int64_t (Bse::Error::FILE_EOF),
+  BSE_ERROR_FILE_EMPTY = int64_t (Bse::Error::FILE_EMPTY),
+  BSE_ERROR_FILE_NOT_FOUND = int64_t (Bse::Error::FILE_NOT_FOUND),
+  BSE_ERROR_FILE_IS_DIR = int64_t (Bse::Error::FILE_IS_DIR),
+  BSE_ERROR_FILE_OPEN_FAILED = int64_t (Bse::Error::FILE_OPEN_FAILED),
+  BSE_ERROR_FILE_SEEK_FAILED = int64_t (Bse::Error::FILE_SEEK_FAILED),
+  BSE_ERROR_FILE_READ_FAILED = int64_t (Bse::Error::FILE_READ_FAILED),
+  BSE_ERROR_FILE_WRITE_FAILED = int64_t (Bse::Error::FILE_WRITE_FAILED),
+  BSE_ERROR_MANY_FILES = int64_t (Bse::Error::MANY_FILES),
+  BSE_ERROR_NO_FILES = int64_t (Bse::Error::NO_FILES),
+  BSE_ERROR_NO_SPACE = int64_t (Bse::Error::NO_SPACE),
+  BSE_ERROR_NO_MEMORY = int64_t (Bse::Error::NO_MEMORY),
+  BSE_ERROR_NO_HEADER = int64_t (Bse::Error::NO_HEADER),
+  BSE_ERROR_NO_SEEK_INFO = int64_t (Bse::Error::NO_SEEK_INFO),
+  BSE_ERROR_NO_DATA = int64_t (Bse::Error::NO_DATA),
+  BSE_ERROR_DATA_CORRUPT = int64_t (Bse::Error::DATA_CORRUPT),
+  BSE_ERROR_WRONG_N_CHANNELS = int64_t (Bse::Error::WRONG_N_CHANNELS),
+  BSE_ERROR_FORMAT_INVALID = int64_t (Bse::Error::FORMAT_INVALID),
+  BSE_ERROR_FORMAT_UNKNOWN = int64_t (Bse::Error::FORMAT_UNKNOWN),
+  BSE_ERROR_DATA_UNMATCHED = int64_t (Bse::Error::DATA_UNMATCHED),
+  BSE_ERROR_TEMP = int64_t (Bse::Error::TEMP),
+  BSE_ERROR_WAVE_NOT_FOUND = int64_t (Bse::Error::WAVE_NOT_FOUND),
+  BSE_ERROR_CODEC_FAILURE = int64_t (Bse::Error::CODEC_FAILURE),
+  BSE_ERROR_UNIMPLEMENTED = int64_t (Bse::Error::UNIMPLEMENTED),
+  BSE_ERROR_INVALID_PROPERTY = int64_t (Bse::Error::INVALID_PROPERTY),
+  BSE_ERROR_INVALID_MIDI_CONTROL = int64_t (Bse::Error::INVALID_MIDI_CONTROL),
+  BSE_ERROR_PARSE_ERROR = int64_t (Bse::Error::PARSE_ERROR),
+  BSE_ERROR_SPAWN = int64_t (Bse::Error::SPAWN),
+  BSE_ERROR_DEVICE_NOT_AVAILABLE = int64_t (Bse::Error::DEVICE_NOT_AVAILABLE),
+  BSE_ERROR_DEVICE_ASYNC = int64_t (Bse::Error::DEVICE_ASYNC),
+  BSE_ERROR_DEVICE_BUSY = int64_t (Bse::Error::DEVICE_BUSY),
+  BSE_ERROR_DEVICE_FORMAT = int64_t (Bse::Error::DEVICE_FORMAT),
+  BSE_ERROR_DEVICE_BUFFER = int64_t (Bse::Error::DEVICE_BUFFER),
+  BSE_ERROR_DEVICE_LATENCY = int64_t (Bse::Error::DEVICE_LATENCY),
+  BSE_ERROR_DEVICE_CHANNELS = int64_t (Bse::Error::DEVICE_CHANNELS),
+  BSE_ERROR_DEVICE_FREQUENCY = int64_t (Bse::Error::DEVICE_FREQUENCY),
+  BSE_ERROR_DEVICES_MISMATCH = int64_t (Bse::Error::DEVICES_MISMATCH),
+  BSE_ERROR_SOURCE_NO_SUCH_MODULE = int64_t (Bse::Error::SOURCE_NO_SUCH_MODULE),
+  BSE_ERROR_SOURCE_NO_SUCH_ICHANNEL = int64_t (Bse::Error::SOURCE_NO_SUCH_ICHANNEL),
+  BSE_ERROR_SOURCE_NO_SUCH_OCHANNEL = int64_t (Bse::Error::SOURCE_NO_SUCH_OCHANNEL),
+  BSE_ERROR_SOURCE_NO_SUCH_CONNECTION = int64_t (Bse::Error::SOURCE_NO_SUCH_CONNECTION),
+  BSE_ERROR_SOURCE_PRIVATE_ICHANNEL = int64_t (Bse::Error::SOURCE_PRIVATE_ICHANNEL),
+  BSE_ERROR_SOURCE_ICHANNEL_IN_USE = int64_t (Bse::Error::SOURCE_ICHANNEL_IN_USE),
+  BSE_ERROR_SOURCE_CHANNELS_CONNECTED = int64_t (Bse::Error::SOURCE_CHANNELS_CONNECTED),
+  BSE_ERROR_SOURCE_CONNECTION_INVALID = int64_t (Bse::Error::SOURCE_CONNECTION_INVALID),
+  BSE_ERROR_SOURCE_PARENT_MISMATCH = int64_t (Bse::Error::SOURCE_PARENT_MISMATCH),
+  BSE_ERROR_SOURCE_BAD_LOOPBACK = int64_t (Bse::Error::SOURCE_BAD_LOOPBACK),
+  BSE_ERROR_SOURCE_BUSY = int64_t (Bse::Error::SOURCE_BUSY),
+  BSE_ERROR_SOURCE_TYPE_INVALID = int64_t (Bse::Error::SOURCE_TYPE_INVALID),
+  BSE_ERROR_PROC_NOT_FOUND = int64_t (Bse::Error::PROC_NOT_FOUND),
+  BSE_ERROR_PROC_BUSY = int64_t (Bse::Error::PROC_BUSY),
+  BSE_ERROR_PROC_PARAM_INVAL = int64_t (Bse::Error::PROC_PARAM_INVAL),
+  BSE_ERROR_PROC_EXECUTION = int64_t (Bse::Error::PROC_EXECUTION),
+  BSE_ERROR_PROC_ABORT = int64_t (Bse::Error::PROC_ABORT),
+  BSE_ERROR_NO_ENTRY = int64_t (Bse::Error::NO_ENTRY),
+  BSE_ERROR_NO_EVENT = int64_t (Bse::Error::NO_EVENT),
+  BSE_ERROR_NO_TARGET = int64_t (Bse::Error::NO_TARGET),
+  BSE_ERROR_NOT_OWNER = int64_t (Bse::Error::NOT_OWNER),
+  BSE_ERROR_INVALID_OFFSET = int64_t (Bse::Error::INVALID_OFFSET),
+  BSE_ERROR_INVALID_DURATION = int64_t (Bse::Error::INVALID_DURATION),
+  BSE_ERROR_INVALID_OVERLAP = int64_t (Bse::Error::INVALID_OVERLAP),
 } BseErrorType;
 typedef enum
 {
diff --git a/bse/bseglue.cc b/bse/bseglue.cc
index afc05d9..7ea7452 100644
--- a/bse/bseglue.cc
+++ b/bse/bseglue.cc
@@ -655,7 +655,7 @@ bglue_exec_proc (SfiGlueContext *context,
        sfi_value_free ((GValue*) ilist->data);
       g_slist_free (clearlist);
 
-      if (error)
+      if (error != 0)
         g_warning ("while executing \"%s\": %s", BSE_PROCEDURE_NAME (proc), bse_error_blurb (error));
       if (proc->n_out_pspecs)
        retval = bglue_value_to_serializable (ovalues + 0);
diff --git a/bse/bseitem.cc b/bse/bseitem.cc
index fc3daae..c04cbd4 100644
--- a/bse/bseitem.cc
+++ b/bse/bseitem.cc
@@ -899,7 +899,7 @@ undo_call_proc (BseUndoStep  *ustep,
           g_value_unset (&ovalue);
         }
       /* we're not tolerating any errors */
-      if (error)
+      if (error != 0)
         g_warning ("while executing undo method \"%s\" of item %s: %s", BSE_PROCEDURE_NAME (proc),
                    bse_object_debug_name (g_value_get_object (ivalues + 0)), bse_error_blurb (error));
     }
@@ -1304,7 +1304,7 @@ undo_lambda_call (BseUndoStep *ustep, BseUndoStack *ustack)
   auto *lambda = (ItemImpl::UndoLambda*) ustep->data[1].v_pointer;
   // invoke undo function
   const Bse::Error error = (*lambda) (self, ustack);
-  if (error) // undo errors shouldn't happen
+  if (error != 0) // undo errors shouldn't happen
     {
       String *blurb = (String*) ustep->data[2].v_pointer;
       g_warning ("error during undo '%s' of item %s: %s", blurb->c_str(),
diff --git a/bse/bseloader-aiff.cc b/bse/bseloader-aiff.cc
index 0def0d4..3dea2bb 100644
--- a/bse/bseloader-aiff.cc
+++ b/bse/bseloader-aiff.cc
@@ -314,7 +314,7 @@ aiff_file_load (int       fd,
         default:                           error = Bse::Error::NONE;      /* ignore unknown chunks */
           LDEBUG ("%c%c%c%c: ignored...", chunk_id >> 24, chunk_id >> 16 & 0xff, chunk_id >> 8 & 0xff, 
chunk_id & 0xff);
         }
-      if (error)
+      if (error != 0)
         return error;
       seek_pos += chunk_size;
       /* align to even seek sizes by skipping pad bytes */
@@ -368,7 +368,7 @@ aiff_load_file_info (void         *data,
   afile->instrument.high_velocity = 127;
   *error_p = aiff_file_load (fd, afile);
   close (fd);
-  if (*error_p)
+  if (*error_p != 0)
     {
       aiff_file_free (afile);
       return NULL;
diff --git a/bse/bseloader-flac.cc b/bse/bseloader-flac.cc
index 2f4fdc8..16f61e5 100644
--- a/bse/bseloader-flac.cc
+++ b/bse/bseloader-flac.cc
@@ -111,7 +111,7 @@ flac_load_file_info (gpointer      data,
                     Bse::Error *error_p)
 {
   FileInfo *file_info = new FileInfo (file_name, error_p);
-  if (*error_p)
+  if (*error_p != 0)
     {
       delete file_info;
       return NULL;
diff --git a/bse/bseloader-guspatch.cc b/bse/bseloader-guspatch.cc
index 3e71496..b9436fd 100644
--- a/bse/bseloader-guspatch.cc
+++ b/bse/bseloader-guspatch.cc
@@ -28,7 +28,7 @@ typedef int sdword;
  * executes read_me (which should be a function call to read something from the file),
  * and returns from the calling function if that fails
  */
-#define read_or_return_error(read_me) G_STMT_START{ Bse::Error _error = read_me; if (_error) return _error; 
}G_STMT_END
+#define read_or_return_error(read_me) G_STMT_START{ Bse::Error _error = read_me; if (_error != 0) return 
_error; }G_STMT_END
 
 static inline Bse::Error
 fread_block (FILE *file,
@@ -395,7 +395,7 @@ struct FileInfo
     header = new PatHeader();
 
     *error_p = header->load (patfile);
-    if (*error_p)
+    if (*error_p != 0)
       {
        fclose (patfile);
        return;
@@ -407,7 +407,7 @@ struct FileInfo
     instrument = new PatInstrument();
 
     *error_p = instrument->load (patfile);
-    if (*error_p)
+    if (*error_p != 0)
       {
        fclose (patfile);
         return;
@@ -423,13 +423,13 @@ struct FileInfo
        patches.push_back (patch);
 
         *error_p = patch->load (patfile);
-        if (*error_p)
+        if (*error_p != 0)
           return;
 
        data_offset (i) = (guint) ftell (patfile);
 
        *error_p = skip (patfile, patch->wavesize);
-        if (*error_p)
+        if (*error_p != 0)
          {
            fclose (patfile);
            return;
@@ -531,7 +531,7 @@ pat_load_file_info (gpointer      data,
                    Bse::Error *error_p)
 {
   FileInfo *file_info = new FileInfo (file_name, error_p);
-  if (*error_p)
+  if (*error_p != 0)
     {
       delete file_info;
       return NULL;
diff --git a/bse/bseloader-mad.cc b/bse/bseloader-mad.cc
index 17f55a0..618bfa1 100644
--- a/bse/bseloader-mad.cc
+++ b/bse/bseloader-mad.cc
@@ -29,7 +29,7 @@ mad_load_file_info (void         *data,
   Bse::Error error;
 
   error = gsl_data_handle_mad_testopen (file_name, &n_channels, &mix_freq);
-  if (error)
+  if (error != 0)
     {
       *error_p = error;
       return NULL;
diff --git a/bse/bseloader-wav.cc b/bse/bseloader-wav.cc
index 15ee5a6..864efc6 100644
--- a/bse/bseloader-wav.cc
+++ b/bse/bseloader-wav.cc
@@ -263,7 +263,7 @@ wav_load_file_info (void         *data,
     }
 
   *error_p = wav_read_header (fd, &wav_header);
-  if (*error_p)
+  if (*error_p != 0)
     {
       close (fd);
       return NULL;
@@ -319,7 +319,7 @@ wav_load_wave_dsc (void            *data,
       return NULL;
     }
   *error_p = wav_read_fmt_header (fi->fd, &fmt_header);
-  if (*error_p)
+  if (*error_p != 0)
     return NULL;
   data_width = (fmt_header.bit_per_sample + 7) / 8;
   *error_p = wav_read_data_header (fi->fd, &data_header, data_width * fmt_header.n_channels);
@@ -329,7 +329,7 @@ wav_load_wave_dsc (void            *data,
       LDEBUG ("failed to seek to start of data");
       *error_p = gsl_error_from_errno (errno, Bse::Error::IO);
     }
-  if (*error_p)
+  if (*error_p != 0)
     return NULL;
 
   if (fmt_header.bit_per_sample == 8 && FORMAT_IS_ALAW (fmt_header.format))
diff --git a/bse/bseloader.cc b/bse/bseloader.cc
index 1bb3d14..e4b89cc 100644
--- a/bse/bseloader.cc
+++ b/bse/bseloader.cc
@@ -145,7 +145,7 @@ bse_wave_file_info_load (const char   *file_name,
   if (loader)
     {
       finfo = loader->load_file_info (loader->data, file_name, &error);
-      if (error && finfo)
+      if (error != 0 && finfo)
        {
          /* loaders shouldn't do this */
          loader->free_file_info (loader->data, finfo);
@@ -250,7 +250,7 @@ bse_wave_dsc_load (BseWaveFileInfo *wave_file_info,
   loader = wave_file_info->loader;
   wdsc = loader->load_wave_dsc (loader->data, wave_file_info, nth_wave,&error);
 
-  if (error && wdsc)
+  if (error != 0 && wdsc)
     {
       /* loaders shouldn't do this */
       loader->free_wave_dsc (loader->data, wdsc);
@@ -316,7 +316,7 @@ bse_wave_handle_create (BseWaveDsc   *wave_dsc,
                                         wave_dsc,
                                         nth_chunk,
                                         &error);
-  if (error && dhandle)
+  if (error != 0 && dhandle)
     {
       /* loaders shouldn't do this */
       gsl_data_handle_unref (dhandle);
diff --git a/bse/bsemidifile.cc b/bse/bsemidifile.cc
index 19f46b4..196218e 100644
--- a/bse/bsemidifile.cc
+++ b/bse/bsemidifile.cc
@@ -160,7 +160,7 @@ bse_midi_file_load (const char   *file_name,
     }
 
   *error_p = smf_read_header (fd, &header);
-  if (*error_p)
+  if (*error_p != 0)
     {
       close (fd);
       return NULL;
@@ -193,7 +193,7 @@ bse_midi_file_load (const char   *file_name,
         }
       // printerr ("track%u: n_events=%u\n", i, smf->tracks[i].n_events);
       bse_midi_decoder_destroy (md);
-      if (*error_p)
+      if (*error_p != 0)
         {
           close (fd);
           bse_midi_file_free (smf);
@@ -336,7 +336,8 @@ bse_midi_file_setup_song (BseMidiFile    *smf,
           Bse::TrackIfaceP track = song.create_track();
           BseTrack *btrack = track->as<BseTrack*>();
           Bse::Error error = track->ensure_output();
-          bse_assert_ok (error);
+          if (error != 0)
+            g_warning ("%s:%d: unexpected error: %s", __FILE__, __LINE__, bse_error_blurb (error));
           bse_item_set_undoable (btrack, "n-voices", 24, NULL);
           Bse::PartIfaceP part_iface = song.create_part();
           BsePart *bpart = part_iface->as<BsePart*>();
diff --git a/bse/bsepart.cc b/bse/bsepart.cc
index e2530c2..bc2cd33 100644
--- a/bse/bsepart.cc
+++ b/bse/bsepart.cc
@@ -775,7 +775,7 @@ bse_part_insert_note (BsePart *self,
 {
   BsePartEventNote key = { 0 };
   const bool use_any_channel = channel == ~uint (0);
-  assert_return (BSE_IS_PART (self), Bse::Error::INTERNAL);
+  assert_return (BSE_IS_PART (self), 0);
   if (use_any_channel)
     channel = 0;
   else if (channel >= self->n_channels)
@@ -839,7 +839,7 @@ bse_part_insert_control (BsePart          *self,
   BsePartTickNode *node;
   BsePartEventControl *cev;
   guint id;
-  assert_return (BSE_IS_PART (self), Bse::Error::INTERNAL);
+  assert_return (BSE_IS_PART (self), 0);
 
   if (!(value >= -1 && value <= +1 &&
         tick < BSE_PART_MAX_TICK &&
diff --git a/bse/bseproject.cc b/bse/bseproject.cc
index 528d31e..f821907 100644
--- a/bse/bseproject.cc
+++ b/bse/bseproject.cc
@@ -651,9 +651,9 @@ bse_project_create_intern_synth (BseProject  *self,
       bse_storage_reset (storage);
       g_object_unref (storage);
       g_free (bse_synth);
-      if (error || !strap.items)
+      if (error != 0 || !strap.items)
        g_warning ("failed to create internal synth \"%s\": %s",
-                  synth_name, bse_error_blurb (error ? error : Bse::Error::NO_ENTRY));
+                  synth_name, bse_error_blurb (error != 0 ? error : Bse::Error::NO_ENTRY));
       else
        synth = (BseItem*) strap.items->data;
       g_slist_free (strap.items);
@@ -763,7 +763,7 @@ bse_project_activate (BseProject *self)
   assert_return (BSE_SOURCE_PREPARED (self) == FALSE, Bse::Error::INTERNAL);
 
   error = bse_server_open_devices (bse_server_get ());
-  if (error)
+  if (error != 0)
     return error;
 
   bse_source_prepare (BSE_SOURCE (self));
diff --git a/bse/bseproject.proc b/bse/bseproject.proc
index 7d65c34..a219f1c 100644
--- a/bse/bseproject.proc
+++ b/bse/bseproject.proc
@@ -82,7 +82,7 @@ METHOD (BseProject, store-bse, "File/Store") {
   error = bse_project_store_bse (project, super, file_name, self_contained);
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
diff --git a/bse/bsescripthelper.cc b/bse/bsescripthelper.cc
index 4b020ee..4b758fa 100644
--- a/bse/bsescripthelper.cc
+++ b/bse/bsescripthelper.cc
@@ -148,7 +148,7 @@ bse_script_procedure_exec (BseProcedureClass *proc,
   g_free (shellpath);
   sfi_ring_free_deep (params, g_free);
 
-  if (error)
+  if (error != 0)
     g_message ("failed to start script \"%s::%s\": %s",
               sdata->script_file, BSE_PROCEDURE_NAME (proc), bse_error_blurb (error));
   else
diff --git a/bse/bseserver.cc b/bse/bseserver.cc
index 1ff61c4..8bd7171 100644
--- a/bse/bseserver.cc
+++ b/bse/bseserver.cc
@@ -474,11 +474,11 @@ server_open_pcm_device (BseServer *server,
   pr.block_size = block_size;
   server->pcm_device = (BsePcmDevice*) bse_device_open_best (BSE_TYPE_PCM_DEVICE, TRUE, TRUE,
                                                              bse_main_args->pcm_drivers,
-                                                             pcm_request_callback, &pr, error ? NULL : 
&error);
+                                                             pcm_request_callback, &pr, error != 0 ? NULL : 
&error);
   if (!server->pcm_device)
     server->pcm_device = (BsePcmDevice*) bse_device_open_best (BSE_TYPE_PCM_DEVICE, FALSE, TRUE,
                                                                bse_main_args->pcm_drivers,
-                                                               pcm_request_callback, &pr, error ? NULL : 
&error);
+                                                               pcm_request_callback, &pr, error != 0 ? NULL 
: &error);
   if (!server->pcm_device)
     {
       UserMessage umsg;
@@ -541,12 +541,12 @@ bse_server_open_devices (BseServer *self)
   if (!error)
     error = server_open_pcm_device (self, mix_freq, latency, block_size);
   guint aligned_freq = bse_pcm_device_frequency_align (mix_freq);
-  if (error && aligned_freq != mix_freq)
+  if (error != 0 && aligned_freq != mix_freq)
     {
       mix_freq = aligned_freq;
       bse_engine_constrain (latency, mix_freq, BSE_GCONFIG (synth_control_freq), &block_size, NULL);
       Bse::Error new_error = server_open_pcm_device (self, mix_freq, latency, block_size);
-      error = new_error ? error : Bse::Error::NONE;
+      error = new_error != 0 ? error : Bse::Error::NONE;
     }
   if (!error)
     error = server_open_midi_device (self);
@@ -564,7 +564,7 @@ bse_server_open_devices (BseServer *self)
          error = bse_pcm_writer_open (self->pcm_writer, self->wave_file,
                                        n_channels, bse_engine_sample_freq (),
                                        n_channels * bse_engine_sample_freq() * self->wave_seconds);
-         if (error)
+         if (error != 0)
            {
               UserMessage umsg;
               umsg.utype = Bse::ERROR;
diff --git a/bse/bsesong.cc b/bse/bsesong.cc
index 93a4d6d..9398fb8 100644
--- a/bse/bsesong.cc
+++ b/bse/bsesong.cc
@@ -669,7 +669,7 @@ bse_song_compat_finish (BseSuper       *super,
       for (node = master ? tracks : NULL; node; node = sfi_ring_walk (node, tracks))
         {
           Bse::Error error = bse_bus_connect (BSE_BUS (master), (BseItem*) node->data);
-          if (error)
+          if (error != 0)
             sfi_warning ("Failed to connect track %s: %s", bse_object_debug_name (node->data), 
bse_error_blurb (error));
           clear_undo = TRUE;
         }
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index 8979ef0..d1e4347 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -1377,7 +1377,7 @@ bse_source_get_input (BseSource      *source,
                       BseSource     **osourcep,
                       guint          *ochannelp)
 {
-  assert_return (BSE_IS_SOURCE (source), Bse::Error::INTERNAL);
+  assert_return (BSE_IS_SOURCE (source), false);
   if (ichannel < BSE_SOURCE_N_ICHANNELS (source) &&
       !BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel))
     {
@@ -1428,7 +1428,7 @@ bse_source_must_set_input_loc (BseSource      *source,
                                const gchar    *strloc)
 {
   Bse::Error error = bse_source_set_input (source, ichannel, osource, ochannel);
-  if (error)
+  if (error != 0)
     g_warning ("%s: failed to connect module %s channel %u to module %s channel %u: %s", strloc,
                bse_object_debug_name (source), ichannel,
               bse_object_debug_name (osource), ochannel,
@@ -1825,7 +1825,7 @@ resolve_osource_input (gpointer     data,
           g_free (compat_ochannel_ident);
           cerror = bse_source_set_input (source, ichannel, osource, ochannel);
         }
-      if (cerror)
+      if (cerror != 0)
        bse_storage_warn (storage,
                          "failed to connect input \"%s\" of `%s' to output \"%s\" of `%s': %s",
                          dinput->ichannel_ident ? dinput->ichannel_ident : "???",
diff --git a/bse/bsesource.proc b/bse/bsesource.proc
index b45b154..72ab8f6 100644
--- a/bse/bsesource.proc
+++ b/bse/bsesource.proc
@@ -48,7 +48,7 @@ BODY (BseProcedureClass *proc,
     bse_item_push_undo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
@@ -93,7 +93,7 @@ BODY (BseProcedureClass *proc,
     bse_item_push_undo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
@@ -139,7 +139,7 @@ BODY (BseProcedureClass *proc,
     }
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
@@ -189,7 +189,7 @@ BODY (BseProcedureClass *proc,
     }
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
@@ -714,7 +714,7 @@ BODY (BseProcedureClass *proc,
     }
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
@@ -772,7 +772,7 @@ BODY (BseProcedureClass *proc,
   Bse::MidiSignalType control_type = Bse::MidiSignalType (0);
   bse_source_get_automation_property (source, property, NULL, &control_type);
   /* set output parameters */
-  g_value_set_enum (out_values++, control_type);
+  g_value_set_enum (out_values++, int (control_type));
 
   return Bse::Error::NONE;
 }
diff --git a/bse/bsestorage.cc b/bse/bsestorage.cc
index 3b0aab0..7051322 100644
--- a/bse/bsestorage.cc
+++ b/bse/bsestorage.cc
@@ -851,7 +851,7 @@ restore_source_automation (BseItem    *item,
   /* close statement */
   parse_or_return (scanner, ')');
   Bse::Error error = bse_source_set_automation_property (BSE_SOURCE (item), pspec->name, midi_channel, 
Bse::MidiSignalType (control_type));
-  if (error)
+  if (error != 0)
     bse_storage_warn (self, "failed to automate property \"%s\": %s", pspec->name, bse_error_blurb (error));
   return G_TOKEN_NONE;
 }
@@ -1473,7 +1473,7 @@ wstore_data_handle_reader (gpointer data,
   if (!wh->opened)
     {
       Bse::Error error = gsl_data_handle_open (wh->dhandle);
-      if (error)
+      if (error != 0)
         {
           bse_storage_error (wh->storage, "failed to open data handle: %s", bse_error_blurb (error));
           return -ENOENT;
diff --git a/bse/bsetool.cc b/bse/bsetool.cc
index 00a513b..70b9842 100644
--- a/bse/bsetool.cc
+++ b/bse/bsetool.cc
@@ -302,7 +302,7 @@ render2wav (const ArgParser &ap)
   auto project = BSE_SERVER.create_project (bsefile);
   project->auto_deactivate (0);
   auto err = project->restore_from_file (bsefile);
-  if (err)
+  if (err != 0)
     return bse_error_blurb (err);
   BSE_SERVER.start_recording (wavfile, n_seconds);
   err = project->play();
@@ -341,7 +341,7 @@ check_load (const ArgParser &ap)
   auto project = BSE_SERVER.create_project (bsefile);
   project->auto_deactivate (0);
   auto err = project->restore_from_file (bsefile);
-  if (err)
+  if (err != 0)
     return string_format ("%s: loading failed: %s", bsefile, bse_error_blurb (err));
   // success
   return "";
diff --git a/bse/bsewave.cc b/bse/bsewave.cc
index 4f31987..11051eb 100644
--- a/bse/bsewave.cc
+++ b/bse/bsewave.cc
@@ -370,7 +370,7 @@ bse_wave_store_private (BseObject  *object,
         {
           GslWaveChunk *wchunk = (GslWaveChunk*) ring->data;
           Bse::Error error = gsl_data_handle_open (wchunk->dcache->dhandle);
-          if (error)
+          if (error != 0)
             {
               bse_storage_warn (storage, "failed to open data handle (%s): %s",
                                 gsl_data_handle_name (wchunk->dcache->dhandle),
@@ -565,7 +565,7 @@ bse_wave_restore_private (BseObject  *object,
       error = bse_wave_load_wave_file (wave, file_name, wave_name,
                                        bse_freq_array_n_values (load_list) ? load_list : 0, skip_list,
                                        FALSE);
-      if (error)
+      if (error != 0)
        bse_storage_warn (storage, "failed to load wave \"%s\" from \"%s\": %s",
                          wave_name, file_name, bse_error_blurb (error));
       expected_token = G_TOKEN_NONE; /* got ')' */
diff --git a/bse/bsewaverepo.proc b/bse/bsewaverepo.proc
index 0f1ed0a..7374dac 100644
--- a/bse/bsewaverepo.proc
+++ b/bse/bsewaverepo.proc
@@ -77,7 +77,7 @@ BODY (BseProcedureClass *proc,
   bse_item_undo_close (ustack);
 
   /* set output parameters */
-  g_value_set_enum (out_values++, error);
+  g_value_set_enum (out_values++, int (error));
 
   return Bse::Error::NONE;
 }
diff --git a/bse/gsldatacache.cc b/bse/gsldatacache.cc
index 8680e59..b404ff9 100644
--- a/bse/gsldatacache.cc
+++ b/bse/gsldatacache.cc
@@ -96,7 +96,7 @@ gsl_data_cache_open (GslDataCache *dcache)
     {
       Bse::Error error;
       error = gsl_data_handle_open (dcache->dhandle);
-      if (error)
+      if (error != 0)
        {
          /* FIXME: this is pretty fatal, throw out zero blocks now? */
          sfi_diag ("%s: failed to open \"%s\": %s", G_STRLOC, dcache->dhandle->name, bse_error_blurb 
(error));
diff --git a/bse/gsldatahandle-mad.cc b/bse/gsldatahandle-mad.cc
index c42881b..bee346b 100644
--- a/bse/gsldatahandle-mad.cc
+++ b/bse/gsldatahandle-mad.cc
@@ -426,7 +426,7 @@ dh_mad_open (GslDataHandle      *dhandle,
   return Bse::Error::NONE;
 
  OPEN_FAILED:
-  if (handle->error)
+  if (handle->error != 0)
     error = handle->error;
   g_free (handle->seeks);
   handle->seeks = NULL;
@@ -723,7 +723,7 @@ gsl_data_handle_mad_testopen (const gchar *file_name,
   Bse::Error error = Bse::Error::NONE;
   dhandle = dh_mad_new (file_name, 439, TRUE, &error);
   if (!dhandle)
-    return error ? error : Bse::Error::FILE_OPEN_FAILED;
+    return error != 0 ? error : Bse::Error::FILE_OPEN_FAILED;
 
   handle = (MadHandle*) dhandle;
   if (n_channels)
diff --git a/bse/gsldatahandle-vorbis.cc b/bse/gsldatahandle-vorbis.cc
index 0a98071..05a7a87 100644
--- a/bse/gsldatahandle-vorbis.cc
+++ b/bse/gsldatahandle-vorbis.cc
@@ -496,7 +496,7 @@ gsl_vorbis1_handle_read (GslVorbis1Handle *v1h, /* returns -errno || length */
     {
       v1h->rfile = gsl_rfile_open (v1h->dhandle->name);
       if (!v1h->rfile)
-        return gsl_error_from_errno (errno, Bse::Error::FILE_OPEN_FAILED);
+        return -(errno ? errno : ENOENT);
       v1h->byte_length = gsl_rfile_length (v1h->rfile);
       if (v1h->rfile_add_zoffset)
         {
diff --git a/bse/gsldatahandle.cc b/bse/gsldatahandle.cc
index 03fefa4..d0b9ce1 100644
--- a/bse/gsldatahandle.cc
+++ b/bse/gsldatahandle.cc
@@ -88,7 +88,7 @@ gsl_data_handle_open (GslDataHandle *dhandle)
          dhandle->vtable->close (dhandle);
          error = Bse::Error::FORMAT_INVALID;
        }
-      if (error)
+      if (error != 0)
        {
          dhandle->spinlock.unlock();
           if (setup.xinfos)
diff --git a/bse/gsldatautils.cc b/bse/gsldatautils.cc
index fdb6ecf..5333766 100644
--- a/bse/gsldatautils.cc
+++ b/bse/gsldatautils.cc
@@ -338,7 +338,7 @@ wstore_context_reader (gpointer data,
   if (!wc->opened)
     {
       Bse::Error error = gsl_data_handle_open (wc->dhandle);
-      if (error)
+      if (error != 0)
        return -ENOENT; /* approximation of OPEN_FAILED */
       wc->opened = TRUE;
     }
diff --git a/bse/mkcproc.pl b/bse/mkcproc.pl
index 075dc7f..64eba7d 100755
--- a/bse/mkcproc.pl
+++ b/bse/mkcproc.pl
@@ -254,7 +254,7 @@ while (<>) {
        $last_node = "(BseExportNode*) &__enode_". ncanon ($proc_name);
 
        print "#line $line \"$file\"\n$1 }\n";
-       print "static Bse::ErrorType\n";
+       print "static Bse::Error\n";
        print "#line $line \"$file\"\n";
        print ncanon ($proc_name) . "_exec (" . $2 . ")\n";
        
diff --git a/bse/tests/loophandle.cc b/bse/tests/loophandle.cc
index fd28eb2..e0aa738 100644
--- a/bse/tests/loophandle.cc
+++ b/bse/tests/loophandle.cc
@@ -157,14 +157,14 @@ check_loop (GslDataHandle *src_handle,
 
   Bse::Error error;
   error = gsl_data_handle_open (loop_handle);
-  if (error)
+  if (error != 0)
     {
       sfi_error ("loop_handle open failed: %s", bse_error_blurb (error));
       exit (1);
     }
 
   error = gsl_data_handle_open (loop_handle_reference);
-  if (error)
+  if (error != 0)
     {
       sfi_error ("loop_handle_reference open failed: %s", bse_error_blurb (error));
       exit (1);
diff --git a/sfi/sfidl-corecxx.cc b/sfi/sfidl-corecxx.cc
index 7485a73..88fa974 100644
--- a/sfi/sfidl-corecxx.cc
+++ b/sfi/sfidl-corecxx.cc
@@ -1258,12 +1258,12 @@ public:
           printf ("      %s (out_values, __return_value);\n", func_value_set_param (mi->result.type));
         printf ("    } catch (std::exception &e) {\n");
         printf ("      sfi_diag (\"%%s: %%s\", \"%s\", e.what());\n", name);
-        printf ("      return Bse::ERROR_PROC_EXECUTION;\n");
+        printf ("      return Bse::Error::PROC_EXECUTION;\n");
         printf ("    } catch (...) {\n");
         printf ("      sfi_diag (\"%%s: %%s\", \"%s\", \"uncaught exception\");\n", name);
-        printf ("      return Bse::ERROR_PROC_EXECUTION;\n");
+        printf ("      return Bse::Error::PROC_EXECUTION;\n");
         printf ("    }\n");
-        printf ("    return Bse::ERROR_NONE;\n");
+        printf ("    return Bse::Error::NONE;\n");
         printf ("  }\n");
 
         /* init */
diff --git a/tests/testwavechunk.cc b/tests/testwavechunk.cc
index b0a4e93..5251b43 100644
--- a/tests/testwavechunk.cc
+++ b/tests/testwavechunk.cc
@@ -51,7 +51,7 @@ run_loop_test (GslWaveLoopType loop_type,
                                44100.0, 44.0,
                               loop_type, loop_first, loop_last, loop_count);
   error = gsl_wave_chunk_open (wchunk);
-  if (error)
+  if (error != 0)
     g_error ("failed to open wave chunk: %s", bse_error_blurb (error));
   gsl_wave_chunk_unref (wchunk);
   if (verbosity >= VERBOSITY_SETUP)
@@ -168,7 +168,7 @@ reversed_datahandle_test (void)
   rhandle2 = gsl_data_handle_new_reverse (rhandle1);
   gsl_data_handle_unref (rhandle1);
   error = gsl_data_handle_open (rhandle2);
-  if (error)
+  if (error != 0)
     g_error ("failed to open rhandle2: %s", bse_error_blurb (error));
   gsl_data_handle_unref (rhandle2);
   TASSERT (gsl_data_handle_length (rhandle2) == gsl_data_handle_length (myhandle));
@@ -277,7 +277,7 @@ multi_channel_test_one (int pingpong,
                                44100.0, 44.0,
                                GslWaveLoopType (LOOP_TYPE), loop_start * channels, loop_end * channels, 
LOOP_COUNT);
   error = gsl_wave_chunk_open (wchunk);
-  if (error)
+  if (error != 0)
     g_error ("failed to open wave chunk: %s", bse_error_blurb (error));
   gsl_wave_chunk_unref (wchunk);
   float *expect = (float*) malloc (my_data_length * sizeof (float) * (LOOP_COUNT + 1));
diff --git a/tools/bsefextract.cc b/tools/bsefextract.cc
index 348d8e9..501698b 100644
--- a/tools/bsefextract.cc
+++ b/tools/bsefextract.cc
@@ -1545,7 +1545,7 @@ main (int    argc,
     }
 
   error = gsl_data_handle_open (dhandle);
-  if (error)
+  if (error != 0)
     {
       fprintf (stderr, "%s: can't open the input file %s: %s\n", options.program_name.c_str(), argv[1], 
bse_error_blurb (error));
       exit (1);
diff --git a/tools/bsewavetool.cc b/tools/bsewavetool.cc
index 8163e7a..da6fe7a 100644
--- a/tools/bsewavetool.cc
+++ b/tools/bsewavetool.cc
@@ -164,7 +164,7 @@ main (int   argc,
     }
   if (!wave && !error)
     error = Bse::Error::IO;       /* unknown */
-  if (error)
+  if (error != 0)
     {
       sfi_error ("problems encountered loading bsewave file \"%s\": %s", input_file.c_str(), bse_error_blurb 
(error));
       exit (1);
@@ -180,7 +180,7 @@ main (int   argc,
       printerr ("SAVE: %s\n", output_file.c_str());
       wave->sort();
       error = wave->store (output_file);
-      if (error)
+      if (error != 0)
         {
           sfi_error ("failed to store wave \"%s\" to file \"%s\": %s", wave->name.c_str(), 
output_file.c_str(), bse_error_blurb (error));
           exit (1);
@@ -768,7 +768,7 @@ public:
         gsl_vorbis_encoder_set_n_channels (enc, wave->n_channels);
         gsl_vorbis_encoder_set_sample_freq (enc, guint (gsl_data_handle_mix_freq (dhandle)));
         Bse::Error error = gsl_vorbis_encoder_setup_stream (enc, gsl_vorbis_make_serialno());
-        if (error)
+        if (error != 0)
           {
             sfi_error ("chunk % 7.2f/%.0f: failed to encode: %s",
                        gsl_data_handle_osc_freq (chunk->dhandle), gsl_data_handle_mix_freq (chunk->dhandle),
@@ -854,7 +854,7 @@ public:
             exit (1);
           }
         error = chunk->set_dhandle_from_file (temp_file, gsl_data_handle_osc_freq (dhandle), 
dhandle->setup.xinfos);
-        if (error)
+        if (error != 0)
           {
             sfi_error ("chunk % 7.2f/%.0f: failed to read wave \"%s\": %s",
                        gsl_data_handle_osc_freq (chunk->dhandle), gsl_data_handle_mix_freq (chunk->dhandle),
@@ -1153,7 +1153,7 @@ public:
               error = wave->add_chunk (dhandle, xinfos);
               gsl_data_handle_unref (dhandle);
             }
-          if (error)
+          if (error != 0)
             {
               String msg = string_format (_("failed to add wave chunk from file \"%s\": %s"),
                                           ochunk.sample_file, bse_error_blurb (error));
@@ -1877,7 +1877,7 @@ public:
               deleted.push_back (it);
               error = Bse::Error::NONE;
             }
-          else if (error)
+          else if (error != 0)
             {
               const gchar *reason = bse_error_blurb (error);
               if (!cresult.tail_detected)
@@ -1894,12 +1894,12 @@ public:
               if (cresult.dhandle != chunk->dhandle)
                 {
                   error = chunk->change_dhandle (cresult.dhandle, gsl_data_handle_osc_freq (chunk->dhandle), 
xinfos);
-                  if (error)
+                  if (error != 0)
                     sfi_error ("level clipping failed: %s", bse_error_blurb (error));
                 }
               g_strfreev (xinfos);
             }
-          if (error && !skip_errors)
+          if (error != 0 && !skip_errors)
             exit (1);
         }
     /* really delete chunks */
@@ -1980,13 +1980,13 @@ public:
                 {
                   GslDataHandle *shandle = gsl_data_handle_new_scale (chunk->dhandle, 1. / absmax);
                   error = chunk->change_dhandle (shandle, gsl_data_handle_osc_freq (chunk->dhandle), xinfos);
-                  if (error)
+                  if (error != 0)
                     sfi_error ("level normalizing failed: %s", bse_error_blurb (error));
                   gsl_data_handle_unref (shandle);
                 }
             }
           g_strfreev (xinfos);
-          if (error && !skip_errors)
+          if (error != 0 && !skip_errors)
             exit (1);
         }
     return true;
@@ -2075,7 +2075,7 @@ public:
 
              gsl_data_handle_ref (dhandle);
              Bse::Error error = chunk->change_dhandle (dhandle, gsl_data_handle_osc_freq (dhandle), xinfos);
-             if (error)
+             if (error != 0)
                sfi_error ("looping failed: %s", bse_error_blurb (error));
              g_strfreev (xinfos);
            }
@@ -2505,7 +2505,7 @@ public:
   print_effective_stopband_start (GslDataHandle *fir_handle)
   {
     Bse::Error error = gsl_data_handle_open (fir_handle);
-    if (error)
+    if (error != 0)
       return error;
     int64 freq_inc = 5; // FIXME
     while (freq_inc * 1000 < gsl_data_handle_mix_freq (fir_handle))
@@ -2552,7 +2552,7 @@ public:
            if (!error)
              error = chunk->change_dhandle (fir_handle, 0, 0);
 
-           if (error)
+           if (error != 0)
              {
                sfi_error ("chunk % 7.2f/%.0f: %s",
                           gsl_data_handle_osc_freq (chunk->dhandle), gsl_data_handle_mix_freq 
(chunk->dhandle),
@@ -2657,7 +2657,7 @@ public:
                     bse_resampler2_precision_name (bse_resampler2_find_precision_for_bits 
(m_precision_bits)));
 
           Bse::Error error = chunk->change_dhandle (bse_data_handle_new_upsample2 (dhandle, 
m_precision_bits), 0, 0);
-          if (error)
+          if (error != 0)
             {
               sfi_error ("chunk % 7.2f/%.0f: %s",
                          gsl_data_handle_osc_freq (chunk->dhandle), gsl_data_handle_mix_freq 
(chunk->dhandle),
@@ -2733,7 +2733,7 @@ public:
                     bse_resampler2_precision_name (bse_resampler2_find_precision_for_bits 
(m_precision_bits)));
 
           Bse::Error error = chunk->change_dhandle (bse_data_handle_new_downsample2 (dhandle, 24), 0, 0);
-          if (error)
+          if (error != 0)
             {
               sfi_error ("chunk % 7.2f/%.0f: %s",
                          gsl_data_handle_osc_freq (chunk->dhandle), gsl_data_handle_mix_freq 
(chunk->dhandle),


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