Little fixes and recursive mutex in NzFile

Former-commit-id: 7b5f3a6b14d027dc664e5d220257a22caca25c95
This commit is contained in:
Youri Hubaut
2015-05-02 16:19:46 +02:00
parent 854efefda1
commit b29d1ffcd8
8 changed files with 26 additions and 23 deletions

View File

@@ -35,7 +35,7 @@ bool NzConditionVariableImpl::Wait(NzMutexImpl* mutex, nzUInt32 timeout)
{
// get the current time
timeval tv;
gettimeofday(&tv, NULL);
gettimeofday(&tv, nullptr);
// construct the time limit (current time + time to wait)
timespec ti;

View File

@@ -82,14 +82,15 @@ bool NzDirectoryImpl::Exists(const NzString& dirPath)
NzString NzDirectoryImpl::GetCurrent()
{
NzString currentPath;
char* path = new char[_PC_PATH_MAX];
char* path = getcwd(nullptr, 0);
if (getcwd(path, _PC_PATH_MAX))
if (path)
{
currentPath = path;
free(path);
}
else
NazaraError("Unable to get current directory: " + NzError::GetLastSystemError());
delete[] path;
NazaraError("Unable to get current directory: " + NzError::GetLastSystemError()); // Bug: initialisation -> if no path for log !
return currentPath;
}

View File

@@ -7,7 +7,7 @@
NzMutexImpl::NzMutexImpl()
{
pthread_mutex_init(&m_handle, NULL);
pthread_mutex_init(&m_handle, nullptr);
}
NzMutexImpl::~NzMutexImpl()

View File

@@ -57,9 +57,9 @@ void NzThreadImpl::Sleep(nzUInt32 time)
// create a mutex and thread condition
pthread_mutex_t mutex;
pthread_mutex_init(&mutex, 0);
pthread_mutex_init(&mutex, nullptr);
pthread_cond_t condition;
pthread_cond_init(&condition, 0);
pthread_cond_init(&condition, nullptr);
// wait...
pthread_mutex_lock(&mutex);