Browse Source

More file checking

tags/1.9.4
falkTX 11 years ago
parent
commit
4b1157da60
7 changed files with 40 additions and 30 deletions
  1. +0
    -2
      source/tests/Print.cpp
  2. +24
    -6
      source/tests/Utils.cpp
  3. +12
    -17
      source/utils/CarlaPipeUtils.hpp
  4. +1
    -2
      source/utils/CarlaRingBuffer.hpp
  5. +1
    -1
      source/utils/CarlaShmUtils.hpp
  6. +1
    -1
      source/utils/CarlaThread.hpp
  7. +1
    -1
      source/utils/CarlaVstUtils.hpp

+ 0
- 2
source/tests/Print.cpp View File

@@ -25,5 +25,3 @@ int main()
carla_stderr2("STDERR2");
return 0;
}

#include "../utils/Utils.cpp"

+ 24
- 6
source/tests/Utils.cpp View File

@@ -16,15 +16,31 @@
*/

#include "CarlaUtils.hpp"
#include "CarlaLibUtils.hpp"
#include "CarlaJuceUtils.hpp"

#include "CarlaBackendUtils.hpp"
#include "CarlaBridgeUtils.hpp"
// #include "CarlaDssiUtils.hpp"
#include "CarlaJuceUtils.hpp"
#include "CarlaLadspaUtils.hpp"
#include "CarlaLibUtils.hpp"
// #include "CarlaLv2Utils.hpp"
#include "CarlaOscUtils.hpp"
#include "CarlaPipeUtils.hpp"
#include "CarlaShmUtils.hpp"
// #include "CarlaStateUtils.hpp"
#include "CarlaVstUtils.hpp"

#include "CarlaLibCounter.hpp"
//#include "CarlaLogThread.hpp"
#include "CarlaMutex.hpp"
#include "CarlaRingBuffer.hpp"
#include "CarlaString.hpp"
#include "CarlaThread.hpp"
#include "List.hpp"
#include "Lv2AtomQueue.hpp"
#include "RtList.hpp"

#include <cassert>
#include <cstdlib>
//#include "JucePluginWindow.hpp"

struct MyStruct {
char pad[100];
@@ -76,6 +92,10 @@ protected:
carla_sleep(1);

carla_stderr("Thread finished");

return;

vstPluginCanDo(nullptr, "something");
}

private:
@@ -264,5 +284,3 @@ int main()

return 0;
}

#include "../utils/Utils.cpp"

+ 12
- 17
source/utils/CarlaPipeUtils.hpp View File

@@ -66,7 +66,7 @@ public:

//----------------------------------------------------------------

const char* argv[6];
const char* argv[5];

//----------------------------------------------------------------
// argv[0] => filename
@@ -109,11 +109,6 @@ public:
argv[3] = uiPipeRecv; // reading end
argv[4] = uiPipeSend; // writting end

//----------------------------------------------------------------
// argv[5] => NULL

argv[5] = nullptr;

//----------------------------------------------------------------
// fork

@@ -147,9 +142,9 @@ public:

for (int i=0; ;)
{
ret = read(fPipeRecv, &ch, 1);
ssize_t ret2 = read(fPipeRecv, &ch, 1);

switch (ret)
switch (ret2)
{
case -1:
if (errno == EAGAIN)
@@ -176,7 +171,7 @@ public:
break;

default:
carla_stderr("read() returned %d", ret);
carla_stderr("read() returned %d", ret2);
break;
}

@@ -267,7 +262,7 @@ public:

if (char* const msg = readline())
{
value = atoi(msg);
value = std::atoi(msg);
std::free(msg);
return true;
}
@@ -282,7 +277,7 @@ public:

if (char* const msg = readline())
{
bool ret = (sscanf(msg, "%f", &value) == 1);
bool ret = (std::sscanf(msg, "%f", &value) == 1);
std::free(msg);
return ret;
}
@@ -416,18 +411,18 @@ private:
return nullptr;
}

static bool fork_exec(const char* const argv[6], int* const retp)
static bool fork_exec(const char* const argv[5], int* const retp)
{
pid_t ret = *retp = vfork();

switch (ret)
{
case 0: /* child process */
execvp(argv[0], (char* const*)argv);
carla_stderr2("exec of UI failed: %s", strerror(errno));
execlp(argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], nullptr);
carla_stderr2("exec of UI failed: %s", std::strerror(errno));
return false;
case -1:
carla_stderr2("fork() failed to create new process for plugin UI");
case -1: /* error */
carla_stderr2("vfork() failed: %s", std::strerror(errno));
return false;
}

@@ -447,7 +442,7 @@ private:

for (i = 0; i < WAIT_ZOMBIE_TIMEOUT / WAIT_STEP; ++i)
{
ret = waitpid(pid, NULL, WNOHANG);
ret = waitpid(pid, nullptr, WNOHANG);

if (ret != 0)
{


+ 1
- 2
source/utils/CarlaRingBuffer.hpp View File

@@ -28,12 +28,11 @@
// -----------------------------------------------------------------------
// RingBuffer struct

PRE_PACKED_STRUCTURE
struct RingBuffer {
int32_t head, tail, written;
bool invalidateCommit;
char buf[RING_BUFFER_SIZE];
} POST_PACKED_STRUCTURE;
};

// -----------------------------------------------------------------------
// RingBufferControl class


+ 1
- 1
source/utils/CarlaShmUtils.hpp View File

@@ -152,7 +152,7 @@ void* carla_shm_map(shm_t& shm, const size_t size)

return ptr;
#else
if (ftruncate(shm, size) != 0)
if (ftruncate(shm, static_cast<off_t>(size)) != 0)
return nullptr;

return mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED, shm, 0);


+ 1
- 1
source/utils/CarlaThread.hpp View File

@@ -154,8 +154,8 @@ public:
}

private:
CarlaMutex fLock; // Thread lock
const CarlaString fName; // Thread name
volatile CarlaMutex fLock; // Thread lock
volatile pthread_t fHandle; // Handle for this thread
volatile bool fShouldExit; // true if thread should exit



+ 1
- 1
source/utils/CarlaVstUtils.hpp View File

@@ -130,7 +130,7 @@ typedef AEffect* (*VST_Function)(audioMasterCallback);
static inline
bool vstPluginCanDo(AEffect* const effect, const char* const feature)
{
return (effect->dispatcher(effect, effCanDo, 0, 0, (void*)feature, 0.0f) == 1);
return (effect->dispatcher(effect, effCanDo, 0, 0, const_cast<char*>(feature), 0.0f) == 1);
}

// -----------------------------------------------------------------------


Loading…
Cancel
Save