From 9d5b61c3bb226e91f4293199eff272be7f235c67 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 13 Jan 2014 19:39:36 +0000 Subject: [PATCH] Misc --- source/includes/CarlaDefines.h | 6 +++--- source/utils/CarlaLadspaUtils.hpp | 2 +- source/utils/CarlaLibUtils.hpp | 8 ++++---- source/utils/CarlaMutex.hpp | 9 ++------- source/utils/CarlaThread.hpp | 2 +- source/utils/CarlaUtils.hpp | 19 ++++++++++++------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/source/includes/CarlaDefines.h b/source/includes/CarlaDefines.h index 5c3a90c80..5f83d3a42 100644 --- a/source/includes/CarlaDefines.h +++ b/source/includes/CarlaDefines.h @@ -1,6 +1,6 @@ /* * Carla common defines - * Copyright (C) 2011-2013 Filipe Coelho + * Copyright (C) 2011-2014 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -24,8 +24,8 @@ #endif /* Set Version */ -#define CARLA_VERSION_HEX 0x01091 -#define CARLA_VERSION_STRING "1.9.1" +#define CARLA_VERSION_HEX 0x01092 +#define CARLA_VERSION_STRING "1.9.2" /* Check OS */ #if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) diff --git a/source/utils/CarlaLadspaUtils.hpp b/source/utils/CarlaLadspaUtils.hpp index 58b85f134..f988e50d3 100644 --- a/source/utils/CarlaLadspaUtils.hpp +++ b/source/utils/CarlaLadspaUtils.hpp @@ -140,7 +140,7 @@ bool is_ladspa_rdf_descriptor_valid(const LADSPA_RDF_Descriptor* const rdfDescri // Get default control port value static inline -LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor hintDescriptor, const LADSPA_Data min, const LADSPA_Data max) noexcept +LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor hintDescriptor, const LADSPA_Data min, const LADSPA_Data max) { if (LADSPA_IS_HINT_HAS_DEFAULT(hintDescriptor)) { diff --git a/source/utils/CarlaLibUtils.hpp b/source/utils/CarlaLibUtils.hpp index 6d52030de..e1eb3015b 100644 --- a/source/utils/CarlaLibUtils.hpp +++ b/source/utils/CarlaLibUtils.hpp @@ -1,6 +1,6 @@ /* * Carla library utils - * Copyright (C) 2011-2013 Filipe Coelho + * Copyright (C) 2011-2014 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,7 +34,7 @@ static inline void* lib_open(const char* const filename) { - CARLA_SAFE_ASSERT_RETURN(filename != nullptr, nullptr); + CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', nullptr); #ifdef CARLA_OS_WIN return (void*)LoadLibraryA(filename); @@ -67,7 +67,7 @@ static inline void* lib_symbol(void* const lib, const char* const symbol) { CARLA_SAFE_ASSERT_RETURN(lib != nullptr, nullptr); - CARLA_SAFE_ASSERT_RETURN(symbol != nullptr, nullptr); + CARLA_SAFE_ASSERT_RETURN(symbol != nullptr && symbol[0] != '\0', nullptr); #ifdef CARLA_OS_WIN return (void*)GetProcAddress((HMODULE)lib, symbol); @@ -82,7 +82,7 @@ void* lib_symbol(void* const lib, const char* const symbol) static inline const char* lib_error(const char* const filename) { - CARLA_SAFE_ASSERT_RETURN(filename != nullptr, nullptr); + CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', nullptr); #ifdef CARLA_OS_WIN static char libError[2048+1]; diff --git a/source/utils/CarlaMutex.hpp b/source/utils/CarlaMutex.hpp index 75e78a67e..481a9b653 100644 --- a/source/utils/CarlaMutex.hpp +++ b/source/utils/CarlaMutex.hpp @@ -1,6 +1,6 @@ /* * Carla Mutex - * Copyright (C) 2013 Filipe Coelho + * Copyright (C) 2013-2014 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,12 +34,7 @@ public: CarlaMutex() noexcept : fTryLockWasCalled(false) { - //pthread_mutexattr_t atts; - //pthread_mutexattr_init(&atts); - //pthread_mutexattr_settype(&atts, PTHREAD_MUTEX_RECURSIVE); - - pthread_mutex_init(&fMutex, nullptr /*&atts*/); - //pthread_mutexattr_destroy(&atts); + pthread_mutex_init(&fMutex, nullptr); } /* diff --git a/source/utils/CarlaThread.hpp b/source/utils/CarlaThread.hpp index 6d27c347b..21fbc3b11 100644 --- a/source/utils/CarlaThread.hpp +++ b/source/utils/CarlaThread.hpp @@ -1,6 +1,6 @@ /* * Carla Thread - * Copyright (C) 2013 Filipe Coelho + * Copyright (C) 2013-2014 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/source/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp index b502457d0..f6fcf8bad 100644 --- a/source/utils/CarlaUtils.hpp +++ b/source/utils/CarlaUtils.hpp @@ -1,6 +1,6 @@ /* * Carla common utils - * Copyright (C) 2011-2013 Filipe Coelho + * Copyright (C) 2011-2014 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -325,8 +325,7 @@ void carla_copy(T* dataDst, T* dataSrc, const size_t size) noexcept CARLA_SAFE_ASSERT_RETURN(dataSrc != nullptr,); CARLA_SAFE_ASSERT_RETURN(size > 0,); - for (size_t i=0; i < size; ++i) - *dataDst++ = *dataSrc++; + std::memcpy(dataDst, dataSrc, size*sizeof(T)); } /* @@ -340,8 +339,7 @@ void carla_copy(T* dataDst, const T* dataSrc, const size_t size) noexcept CARLA_SAFE_ASSERT_RETURN(dataSrc != nullptr,); CARLA_SAFE_ASSERT_RETURN(size > 0,); - for (size_t i=0; i < size; ++i) - *dataDst++ = *dataSrc++; + std::memcpy(dataDst, dataSrc, size*sizeof(T)); } /* @@ -354,8 +352,15 @@ void carla_fill(T* data, const size_t size, const T v) noexcept CARLA_SAFE_ASSERT_RETURN(data != nullptr,); CARLA_SAFE_ASSERT_RETURN(size > 0,); - for (size_t i=0; i < size; ++i) - *data++ = v; + if (v == 0) + { + std::memset(data, 0, size*sizeof(T)); + } + else + { + for (size_t i=0; i < size; ++i) + *data++ = v; + } } // -----------------------------------------------------------------------