aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Knight <q@1bpm.net>2021-07-21 22:22:01 +0100
committerRichard Knight <q@1bpm.net>2021-07-21 22:22:01 +0100
commitf71024077af151e0eeb37151fb0754e61ee9a2ea (patch)
tree89b59784cc7a0064ecd20ce783488a9522d8ff76
parent1b40e87a3f54a70d4994262dd7fad4297caaeca3 (diff)
downloadcsound-sqldb-f71024077af151e0eeb37151fb0754e61ee9a2ea.tar.gz
csound-sqldb-f71024077af151e0eeb37151fb0754e61ee9a2ea.tar.bz2
csound-sqldb-f71024077af151e0eeb37151fb0754e61ee9a2ea.zip
new cmake approach
-rw-r--r--CMakeLists.txt328
-rw-r--r--Plugin.cmake45
-rw-r--r--cmake/CompilerOptimizations.cmake53
-rw-r--r--src/mysql.cpp8
-rw-r--r--src/postgresql.cpp2
-rw-r--r--src/sqlite3.cpp8
6 files changed, 264 insertions, 180 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb38a90..612d056 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,217 +1,203 @@
-project("csound_sqldb")
+# from https://github.com/csound/plugins : common CMake operations
+cmake_minimum_required(VERSION 2.8.12)
+project(Csound-plugins)
-cmake_minimum_required(VERSION 3.8)
-
-set(APIVERSION "6.0")
+if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+ set(CMAKE_COMPILER_IS_CLANG 1)
+endif()
-# Release or Debug
-set(CMAKE_BUILD_TYPE "Release")
+# C++11 needed
+if(NOT MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+endif()
-# force make to print the command lines
-set(CMAKE_VERBOSE_MAKEFILE on)
+set(APIVERSION "6.0")
-# path to Csound cmake module
+set(CMAKE_MACOSX_RPATH 1)
+set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
-# set compilation flags
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11 -fpermissive -fPIC -w -DUSE_DOUBLE -DB64BIT")
-
-# options
-option(USE_LIB64 "Set to on to set installation dir for libs to lib64" OFF)
-option(USE_DOUBLE "Use doubles for audio calculations" ON)
-option(CPP11 "c++11" ON)
-
-set(BUILDING_CSOUND_PLUGINS ON)
-
-# ----------------------------------------------
-
-include(FindCsound)
-include(FindPostgreSQL)
-include(FindSqlite3)
-include(FindMySQL)
-
+include(TestBigEndian)
+include(CheckFunctionExists)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
-# -----------------------------------------------
-
-function(addflag flag flagname)
- check_c_compiler_flag(${flag} ${flagname})
- if (${flagname})
- # message(STATUS "Setting C flag ${flag}")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE)
- endif()
- check_cxx_compiler_flag(${flag} CXX_${flagname})
- if (CXX_${flagname})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
- endif()
-endfunction(addflag)
-
-
-MACRO(SUBDIRLIST result curdir)
- FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
- SET(dirlist "")
- FOREACH(child ${children})
- message(STATUS "looking at ${child}")
- IF(IS_DIRECTORY ${curdir}/${child})
- LIST(APPEND dirlist ${child})
- ENDIF()
- ENDFOREACH()
- SET(${result} ${dirlist})
-ENDMACRO()
-
-
-MACRO(ADD_ALL_SUBDIRECTORIES directory)
- subdirlist(SUBDIRS ${directory})
- message(STATUS "Found subdirs: ${SUBDIRS}")
- foreach(SUBDIR ${SUBDIRS})
- set(thissubdir "${directory}/${SUBDIR}")
- if(EXISTS "${directory}/${SUBDIR}/CMakeLists.txt")
- message(STATUS "Adding subdir: ${thissubdir}")
- add_subdirectory(${directory}/${SUBDIR})
- else()
- message(WARNING "Skipping ${directory}/${SUBDIR} because no CMakeLists.txt file was found")
- endif()
- endforeach()
-ENDMACRO()
-
-
+### COMPILER OPTIMIZATION FLAGS
+option(USE_COMPILER_OPTIMIZATIONS "Use the default Csound compiler optimization flags" ON)
+if(USE_COMPILER_OPTIMIZATIONS)
+ include(${CMAKE_SOURCE_DIR}/cmake/CompilerOptimizations.cmake)
+endif()
-# set optimization flags
-if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
- add_definitions(-fvisibility=hidden)
- if(NATIVE)
- add_definitions(-march=native)
- endif()
-
- include(CheckCCompilerFlag)
- include(CheckCXXCompilerFlag)
+if(APPLE)
+ set(OSX_VERSION " ")
+endif()
- addflag(-msse HAS_SSE)
- addflag(-msse2 HAS_SSE2)
- addflag(-mfgpath=sse HAS_FPMATH_SSE)
-
+## USER OPTIONS ##
+# Optional targets, they should all default to ON (check_deps will disable them if not possible to build)
+option(USE_DOUBLE "Set to use double-precision floating point for audio samples." ON)
+option(USE_LRINT "Use lrint/lrintf for converting floating point values to integers." ON)
+option(BUILD_RELEASE "Build for release" ON)
+option(USE_GIT_COMMIT "Show the git commit in version information" ON)
+
+# in Release configuration, set NDEBUG
+if(${CMAKE_BUILD_TYPE} MATCHES "Release")
+message("-----> Release mode")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNDEBUG")
+elseif(${CMAKE_BUILD_TYPE} MATCHES "Debug")
+message("-----> Debug mode")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBETA")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBETA")
endif()
-if(MINGW)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstackrealign")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")
+# set -Werror if in Debug configuration
+if(NOT MSVC AND NOT WASM)
+ set(CMAKE_CXX_FLAGS_RELEASE "-O3 ")
+ set(CMAKE_C_FLAGS_RELEASE "-O3 ")
+ if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-missing-field-initializers")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-missing-field-initializers")
+ endif()
endif()
-addflag(-ftree-vectorize HAS_TREE_VECTORIZE)
-addflag(-ffast-math HAS_FAST_MATH)
-addflag(-fomit-frame-pointer HAS_OMIT_FRAME_POINTER)
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ set(LINUX YES)
+else()
+ set(LINUX NO)
+endif()
-# -------------------------------------------------------------------
+set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
-set(CS_FRAMEWORK_DEST "~/Library/Frameworks")
+check_c_compiler_flag(-fvisibility=hidden HAS_VISIBILITY_HIDDEN)
+check_cxx_compiler_flag(-fvisibility=hidden HAS_CXX_VISIBILITY_HIDDEN)
+if (HAS_VISIBILITY_HIDDEN)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+endif()
+if (HAS_CXX_VISIBILITY_HIDDEN)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+endif()
+
+check_c_compiler_flag(-std=gnu99 HAS_GNU99)
+if (HAS_GNU99)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
+endif()
+if (HAS_CXX_VISIBILITY_HIDDEN)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+endif()
+find_package(Csound)
+option(USE_LIB64 "Set to on to set installation directory for libraries to lib64" OFF)
if(USE_LIB64)
- set(LIBRARY_INSTALL_DIR "lib64")
- add_definitions("-DLIB64")
+ set(LIBRARY_INSTALL_DIR "lib64")
+ add_definitions("-DLIB64")
else()
- set(LIBRARY_INSTALL_DIR "lib")
+ set(LIBRARY_INSTALL_DIR "lib")
endif()
-
message(STATUS "LIBRARY INSTALL DIR: ${LIBRARY_INSTALL_DIR}")
-# -------------------------------------------------------------------
-
-
if(USE_DOUBLE)
- message(STATUS ">>> using doubles")
-
- if(APPLE)
- set(CSOUNDLIB "CsoundLib64")
- set(PLUGIN_INSTALL_DIR "${CS_FRAMEWORK_DEST}/${CSOUNDLIB}.framework/Versions/${APIVERSION}/Resources/Opcodes64")
- else()
- set(CSOUNDLIB "csound64")
+ message(STATUS "Building with 64-bit floats")
set(PLUGIN_INSTALL_DIR "${LIBRARY_INSTALL_DIR}/csound/plugins64-${APIVERSION}")
- endif()
+ if(APPLE)
+ set(PLUGIN_INSTALL_DIR "${CS_FRAMEWORK_DEST}/${CSOUNDLIB}.framework/Versions/${APIVERSION}/Resources/Opcodes64")
+ endif()
else()
- message(STATUS ">>> not using doubles")
- if(APPLE)
- set(CSOUNDLIB "CsoundLib")
- set(PLUGIN_INSTALL_DIR "${CS_FRAMEWORK_DEST}/${CSOUNDLIB}.framework/Versions/${APIVERSION}/Resources/Opcodes")
- else()
- set(CSOUNDLIB "csound")
+ message(STATUS "Building with 32-bit floats")
set(PLUGIN_INSTALL_DIR "${LIBRARY_INSTALL_DIR}/csound/plugins-${APIVERSION}")
- endif()
+ if(APPLE)
+ set(PLUGIN_INSTALL_DIR "${CS_FRAMEWORK_DEST}/${CSOUNDLIB}.framework/Versions/${APIVERSION}/Resources/Opcodes")
+ endif()
endif()
-# -------------------------------------------------------------------
-
-# Csound opcode build
-find_package(Csound)
-
-
-set(BUILD_PLUGINS_DIR ${CMAKE_CURRENT_BINARY_DIR})
-
-if(NOT CSOUND_FOUND)
- message(FATAL_ERROR "Csound installation not found")
-endif()
-
-if(NOT PostgreSQL_FOUND AND NOT SQLITE3_FOUND AND NOT MYSQLCONNECTORCPP_FOUND)
- message(FATAL_ERROR "No database libraries could be found")
-endif()
+# Checks if dependencies for an enabled target are fulfilled.
+# If FAIL_MISSING is true and the dependencies are not fulfilled,
+# it will abort the cmake run.
+# If FAIL_MISSING is false, it will set the option to OFF.
+# If the target is not enabled, it will do nothing.
+# example: check_deps(BUILD_NEW_PARSER FLEX_EXECUTABLE BISON_EXECUTABLE)
+function(check_deps option)
+ if(${option})
+ set(i 1)
+ while( ${i} LESS ${ARGC} )
+ set(dep ${ARGV${i}})
+ if(NOT ${dep})
+ if(FAIL_MISSING)
+ message(FATAL_ERROR
+ "${option} is enabled, but ${dep}=\"${${dep}}\"")
+ else()
+ message(STATUS "${dep}=\"${${dep}}\", so disabling ${option}")
+ set(${option} OFF PARENT_SCOPE)
+ # Set it in the local scope too
+ set(${option} OFF)
+ endif()
+ endif()
+ math(EXPR i "${i}+1")
+ endwhile()
+ endif()
+ if(${option})
+ message(STATUS "${option} is enabled.")
+ else()
+ message(STATUS "${option} is disabled.")
+ endif()
+endfunction(check_deps)
+# Utility function to make plugins. All plugin targets should use this as it
+# sets up output directory set in top-level CmakeLists.txt
+# and adds the appropriate install target
#
-#if(APPLE)
-# add_library(sqldb SHARED ${srcs})
-#else()
-# add_library(sqldb MODULE ${srcs})
-#endif()
-
-set(CPPFILES src/opcodes.cpp src/connection.cpp)
-
-
-if (PostgreSQL_FOUND)
- message(STATUS "Using PostgreSQL")
- list(APPEND CPPFILES "src/postgresql.cpp")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_POSTGRES")
-endif()
+# libname - name of library to produce
+# srcs - list of src files (must be quoted if a list)
+# extralibs (OPTIONAL) - extra libraries to link the plugin to
+#
+# NB - this was moved here as it needs some VARS defined above
+# for setting up the framework
+function(make_plugin libname srcs)
+ if(APPLE)
+ add_library(${libname} SHARED ${srcs})
+ else()
+ add_library(${libname} MODULE ${srcs})
+ endif()
-if (SQLITE3_FOUND)
- message(STATUS "Using SQLite3")
- list(APPEND CPPFILES "src/sqlite3.cpp")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_SQLITE")
-endif()
+ set(i 2)
+ while( ${i} LESS ${ARGC} )
+ target_link_libraries(${libname} ${ARGV${i}})
+ math(EXPR i "${i}+1")
+ endwhile()
-if (MYSQLCONNECTORCPP_FOUND)
- message(STATUS "Using MySQL")
- list(APPEND CPPFILES "src/mysql.cpp")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_MYSQL")
-endif()
+ set_target_properties(${libname} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ install(TARGETS ${libname}
+ LIBRARY DESTINATION "${PLUGIN_INSTALL_DIR}"
+ ARCHIVE DESTINATION "${PLUGIN_INSTALL_DIR}" )
+endfunction(make_plugin)
+# Linux does not have a separate libintl, it is part of libc
+set(LIBINTL_AVAIL (LIBINTL_LIBRARY OR LINUX))
-#include_directories(/usr/include)
-include_directories(${CSOUND_INCLUDE_DIRS})
-include_directories(include)
+if(LINUX)
+ message(STATUS "Building on Linux.")
+ add_definitions(-DLINUX -DPIPES -D_GNU_SOURCE -DHAVE_SOCKETS)
+ list(APPEND libcsound_LIBS ${MATH_LIBRARY} dl)
-if (PostgreSQL_FOUND)
- link_libraries(${PostgreSQL_LIBRARIES})
- include_directories(${PostgreSQL_INCLUDE_DIRS})
endif()
-if (SQLITE3_FOUND)
- link_libraries(${SQLITE3_LIBRARIES})
- include_directories(${SQLITE3_INCLUDE_DIRS})
+if(APPLE AND NOT IOS)
+ message(STATUS "Building on OSX")
+ add_definitions(-DMACOSX -DPIPES -DNO_FLTK_THREADS -DHAVE_SOCKETS)
+ find_library(ACCELERATE_LIBRARY Accelerate)
+ find_path(VECLIB_PATH "Accelerate/Accelerate.h")
+ include_directories(${VECLIB_PATH})
+ list(APPEND libcsound_LIBS ${MATH_LIBRARY} dl ${ACCELERATE_LIBRARY})
endif()
-if (MYSQLCONNECTORCPP_FOUND)
- link_libraries(${MYSQLCONNECTORCPP_LIBRARIES})
- include_directories(${MYSQLCONNECTORCPP_INCLUDE_DIRS})
+if(WIN32)
+ add_definitions(-DWIN32)
endif()
-add_library(sqldb SHARED ${CPPFILES})
-
-set_target_properties(sqldb PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${BUILD_PLUGINS_DIR}
- LIBRARY_OUTPUT_DIRECTORY ${BUILD_PLUGINS_DIR})
-
-install(TARGETS sqldb LIBRARY DESTINATION "${PLUGIN_INSTALL_DIR}" )
-
+include(Plugin.cmake)
diff --git a/Plugin.cmake b/Plugin.cmake
new file mode 100644
index 0000000..b02b9b6
--- /dev/null
+++ b/Plugin.cmake
@@ -0,0 +1,45 @@
+set(PLUGIN_NAME sqldb)
+
+# Dependencies
+find_package(PostgreSQL)
+find_package(Sqlite3)
+find_package(MySQL)
+
+# Check databases available
+if(NOT PostgreSQL_FOUND AND NOT SQLITE3_FOUND AND NOT MYSQLCONNECTORCPP_FOUND)
+ message(FATAL_ERROR "No database libraries could be found")
+endif()
+
+# Source files
+set(CPPFILES src/opcodes.cpp)
+set(INCLUDES ${CSOUND_INCLUDE_DIRS} "include")
+set(LIBS "")
+
+if(PostgreSQL_FOUND)
+ message(STATUS "Using PostgreSQL")
+ list(APPEND CPPFILES "src/postgresql.cpp")
+ list(APPEND INCLUDES ${PostgreSQL_INCLUDE_DIRS})
+ list(APPEND LIBS ${PostgreSQL_LIBRARES})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_POSTGRES")
+endif()
+
+if(SQLITE3_FOUND)
+ message(STATUS "Using SQLite3")
+ list(APPEND CPPFILES "src/sqlite3.cpp")
+ list(APPEND INCLUDES ${SQLITE3_INCLUDE_DIRS})
+ list(APPEND LIBS ${SQLITE3_LIBRARIES})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_SQLITE")
+endif()
+
+if(MYSQLCONNECTORCPP_FOUND)
+ message(STATUS "Using MySQL")
+ list(APPEND CPPFILES "src/mysql.cpp")
+ list(APPEND INCLUDES ${MYSQLCONNECTORCPP_INCLUDE_DIRS})
+ list(APPEND LIBS ${MYSQLCONNECTORCPP_LIBRARIES})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_MYSQL")
+endif()
+
+
+make_plugin(${PLUGIN_NAME} "${CPPFILES}" ${LIBS})
+target_include_directories(${PLUGIN_NAME} PRIVATE ${INCLUDES})
+
diff --git a/cmake/CompilerOptimizations.cmake b/cmake/CompilerOptimizations.cmake
new file mode 100644
index 0000000..543daf8
--- /dev/null
+++ b/cmake/CompilerOptimizations.cmake
@@ -0,0 +1,53 @@
+
+check_c_compiler_flag(-ftree-vectorize HAS_TREE_VECTORIZE)
+check_cxx_compiler_flag(-ftree-vectorize HAS_CXX_TREE_VECTORIZE)
+if (HAS_TREE_VECTORISE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftree-vectorize")
+endif()
+if (HAS_CXX_TREE_VECTORISE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize")
+endif()
+
+
+check_c_compiler_flag(-ffast-math HAS_FAST_MATH)
+check_cxx_compiler_flag(-ffast-math HAS_CXX_FAST_MATH)
+if (HAS_FAST_MATH AND NOT MINGW)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
+endif()
+if (HAS_CXX_FAST_MATH AND NOT MINGW)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
+endif()
+
+
+
+if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+check_c_compiler_flag(-mfpmath=sse HAS_FPMATH_SSE)
+check_cxx_compiler_flag(-mfpmath=sse HAS_CXX_FPMATH_SSE)
+ if (HAS_FPMATH_SSE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse")
+endif()
+if (HAS_CXX_FPMATH_SSE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse")
+endif()
+
+endif()
+
+
+check_c_compiler_flag(-msse2 HAS_SSE2)
+check_cxx_compiler_flag(-msse2 HAS_CXX_SSE2)
+ if (HAS_SSE2 AND NOT IOS AND NOT WASM)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
+endif()
+if (HAS_CXX_SSE2 AND NOT IOS AND NOT WASM)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
+endif()
+
+
+check_c_compiler_flag(-fomit-frame-pointer HAS_OMIT_FRAME_POINTER)
+check_cxx_compiler_flag(-fomit-frame-pointer HAS_CXX_OMIT_FRAME_POINTER)
+if (HAS_OMIT_FRAME_POINTER)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
+endif()
+if (HAS_CXX_OMIT_FRAME_POINTER)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer")
+endif()
diff --git a/src/mysql.cpp b/src/mysql.cpp
index 71ea16c..2362d60 100644
--- a/src/mysql.cpp
+++ b/src/mysql.cpp
@@ -91,7 +91,7 @@ char* MySQLConnection::ScalarString(char* sql, int row, int col) {
for (int rowIndex = 0; rowIndex <= row; rowIndex++) {
res->next();
}
- char* result = res->getString(col + 1).c_str();
+ char* result = (char*) res->getString(col + 1).c_str();
delete res;
@@ -104,13 +104,13 @@ void MySQLConnection::ToArray(mysql::ResultSet* result, csnd::Csound* csound, AR
int colNum = meta->getColumnCount();
int rowNum = result->rowsCount();
int totalResults = colNum * rowNum;
- array->sizes = csound->calloc(sizeof(int32_t) * 2);
+ array->sizes = (int32_t*) csound->calloc(sizeof(int32_t) * 2);
array->sizes[0] = rowNum;
array->sizes[1] = colNum;
array->dimensions = 2;
CS_VARIABLE *var = array->arrayType->createVariable(csound, NULL);
array->arrayMemberSize = var->memBlockSize;
- array->data = csound->calloc(var->memBlockSize * totalResults);
+ array->data = (MYFLT*) csound->calloc(var->memBlockSize * totalResults);
STRINGDAT* strings;
if (asString) {
strings = (STRINGDAT*) array->data;
@@ -123,7 +123,7 @@ void MySQLConnection::ToArray(mysql::ResultSet* result, csnd::Csound* csound, AR
colIndex = 0;
while (colIndex < colNum) {
if (asString) {
- char* item = result->getString(colIndex + 1).c_str();
+ char* item = (char*) result->getString(colIndex + 1).c_str();
strings[index].size = strlen(item) + 1;
strings[index].data = csound->strdup(item);
} else {
diff --git a/src/postgresql.cpp b/src/postgresql.cpp
index f2d42be..6b54e29 100644
--- a/src/postgresql.cpp
+++ b/src/postgresql.cpp
@@ -98,7 +98,7 @@ void PostgresConnection::ToArray(PGresult* result, csnd::Csound* csound, ARRAYDA
int rows = PQntuples(result);
int cols = PQnfields(result);
int totalResults = rows * cols;
- array->sizes = csound->calloc(sizeof(int32_t) * 2);
+ array->sizes = (int32_t*) csound->calloc(sizeof(int32_t) * 2);
array->sizes[0] = rows;
array->sizes[1] = cols;
array->dimensions = 2;
diff --git a/src/sqlite3.cpp b/src/sqlite3.cpp
index 0fd96e3..00b2773 100644
--- a/src/sqlite3.cpp
+++ b/src/sqlite3.cpp
@@ -88,7 +88,7 @@ char* SqliteConnection::ScalarString(char* sql, int row, int col) {
rc = sqlite3_finalize(stmt);
throw std::runtime_error("column number out of range");
}
- char* result = sqlite3_column_text(stmt, col);
+ char* result = (char*) sqlite3_column_text(stmt, col);
rc = sqlite3_finalize(stmt);
return result;
}
@@ -115,13 +115,13 @@ void SqliteConnection::ToArray(sqlite3_stmt* stmt, csnd::Csound* csound, ARRAYDA
int colNum = sqlite3_column_count(stmt);
int rowNum = RowCount(stmt);
int totalResults = colNum * rowNum;
- array->sizes = csound->calloc(sizeof(int32_t) * 2);
+ array->sizes = (int32_t*) csound->calloc(sizeof(int32_t) * 2);
array->sizes[0] = rowNum;
array->sizes[1] = colNum;
array->dimensions = 2;
CS_VARIABLE *var = array->arrayType->createVariable(csound, NULL);
array->arrayMemberSize = var->memBlockSize;
- array->data = csound->calloc(var->memBlockSize * totalResults);
+ array->data = (MYFLT*) csound->calloc(var->memBlockSize * totalResults);
STRINGDAT* strings;
if (asString) {
strings = (STRINGDAT*) array->data;
@@ -135,7 +135,7 @@ void SqliteConnection::ToArray(sqlite3_stmt* stmt, csnd::Csound* csound, ARRAYDA
colIndex = 0;
while (colIndex < colNum) {
if (asString) {
- char* item = sqlite3_column_text(stmt, colIndex);
+ char* item = (char*) sqlite3_column_text(stmt, colIndex);
strings[index].size = strlen(item) + 1;
strings[index].data = csound->strdup(item);
} else {