aboutsummaryrefslogtreecommitdiff
path: root/fonts/mono_dejavu_sans_100.png
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-05-18 20:55:27 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2017-05-18 20:55:27 +0200
commit1c6d2f596df8fc2254916cf323bdbaf13905aebf (patch)
treef67d89f3a2785250aa0530a32ab9009c0df2b537 /fonts/mono_dejavu_sans_100.png
parent9b5effffbb0599f85014b53c3fd025b6a8222e02 (diff)
downloadminetest-1c6d2f596df8fc2254916cf323bdbaf13905aebf.tar.gz
minetest-1c6d2f596df8fc2254916cf323bdbaf13905aebf.tar.bz2
minetest-1c6d2f596df8fc2254916cf323bdbaf13905aebf.zip
Fix a warning pointed by GCC 7.1
lua_tonumber overflow in snprintf (12 bytes and only 10 can be written)
Diffstat (limited to 'fonts/mono_dejavu_sans_100.png')
0 files changed, 0 insertions, 0 deletions
='n118' href='#n118'>118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
/*

    This file is a part of the JThread package, which contains some object-
    oriented thread wrappers for different thread implementations.

    Copyright (c) 2000-2006  Jori Liesenborgs (jori.liesenborgs@gmail.com)

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.

*/

#include "jthread/jthread.h"
#include <assert.h>
#define UNUSED(expr) do { (void)(expr); } while (0)
#ifndef _WIN32_WCE
	#include <process.h>
#endif // _WIN32_WCE

JThread::JThread()
{
	retval = NULL;
	requeststop = false;
	running = false;
}

JThread::~JThread()
{
	Kill();
}

void JThread::Stop() {
	runningmutex.Lock();
	requeststop = true;
	runningmutex.Unlock();
}

void JThread::Wait() {
	runningmutex.Lock();
	if (running)
	{
		runningmutex.Unlock();
		WaitForSingleObject(threadhandle, INFINITE);
	}
	else
	{
		runningmutex.Unlock();
	}
}

int JThread::Start()
{
	runningmutex.Lock();
	if (running)
	{
		runningmutex.Unlock();
		return ERR_JTHREAD_ALREADYRUNNING;
	}
	requeststop = false;
	runningmutex.Unlock();

	continuemutex.Lock();
#ifndef _WIN32_WCE
	threadhandle = (HANDLE)_beginthreadex(NULL,0,TheThread,this,0,&threadid);
#else
	threadhandle = CreateThread(NULL,0,TheThread,this,0,&threadid);
#endif // _WIN32_WCE
	if (threadhandle == NULL)
	{
		continuemutex.Unlock();
		return ERR_JTHREAD_CANTSTARTTHREAD;
	}

	/* Wait until 'running' is set */

	runningmutex.Lock();
	while (!running)
	{
		runningmutex.Unlock();
		Sleep(1);
		runningmutex.Lock();
	}
	runningmutex.Unlock();

	continuemutex.Unlock();

	continuemutex2.Lock();
	continuemutex2.Unlock();

	return 0;
}

int JThread::Kill()
{
	runningmutex.Lock();
	if (!running)
	{