about summary refs log tree commit diff
path: root/src/base
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-04-13 20:37:12 +0200
committeroy <Tom_Adams@web.de>2011-04-13 20:37:12 +0200
commit06115dd49dca2f8eb5f14606437e8fd20037cc4d (patch)
tree5ec4bca6158319b3f5285d7689c5f94ae8da8c93 /src/base
parent63e059b8fff6498e42b765a1dca000e53005ea77 (diff)
downloadzcatch-06115dd49dca2f8eb5f14606437e8fd20037cc4d.tar.gz
zcatch-06115dd49dca2f8eb5f14606437e8fd20037cc4d.zip
added "Whitespace and line Endings cleanup" by GreYFoX
Diffstat (limited to 'src/base')
-rw-r--r--src/base/detect.h4
-rw-r--r--src/base/system.c108
-rw-r--r--src/base/system.h248
-rw-r--r--src/base/tl/algorithm.h14
-rw-r--r--src/base/tl/array.h44
-rw-r--r--src/base/tl/range.h46
-rw-r--r--src/base/tl/sorted_array.h8
-rw-r--r--src/base/tl/string.h20
-rw-r--r--src/base/vmath.h16
9 files changed, 254 insertions, 254 deletions
diff --git a/src/base/detect.h b/src/base/detect.h
index 534339dd..0b66acef 100644
--- a/src/base/detect.h
+++ b/src/base/detect.h
@@ -4,8 +4,8 @@
 #define BASE_DETECT_H
 
 /*
-  this file detected the family, platform and architecture
-  to compile for.
+	this file detected the family, platform and architecture
+	to compile for.
 */
 
 /* platforms */
diff --git a/src/base/system.c b/src/base/system.c
index 0c208b9b..94481f21 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -21,20 +21,20 @@
 	#include <sys/socket.h>
 	#include <sys/ioctl.h>
 	#include <errno.h>
-	#include <netdb.h>      
+	#include <netdb.h>
 	#include <netinet/in.h>
 	#include <fcntl.h>
 	#include <pthread.h>
 	#include <arpa/inet.h>
 
 	#include <dirent.h>
-	
+
 	#if defined(CONF_PLATFORM_MACOSX)
 		#include <Carbon/Carbon.h>
 	#endif
-	
+
 #elif defined(CONF_FAMILY_WINDOWS)
-	#define WIN32_LEAN_AND_MEAN 
+	#define WIN32_LEAN_AND_MEAN
 	#define _WIN32_WINNT 0x0501 /* required for mingw to get getaddrinfo to work */
 	#include <windows.h>
 	#include <winsock2.h>
@@ -176,7 +176,7 @@ void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned al
 	memory_stats.allocated += header->size;
 	memory_stats.total_allocations++;
 	memory_stats.active_allocations++;
-	
+
 	tail->guard = MEM_GUARD_VAL;
 
 	header->prev = (MEMHEADER *)0;
@@ -184,7 +184,7 @@ void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned al
 	if(first)
 		first->prev = header;
 	first = header;
-	
+
 	/*dbg_msg("mem", "++ %p", header+1); */
 	return header+1;
 }
@@ -195,20 +195,20 @@ void mem_free(void *p)
 	{
 		MEMHEADER *header = (MEMHEADER *)p - 1;
 		MEMTAIL *tail = (MEMTAIL *)(((char*)(header+1))+header->size);
-		
+
 		if(tail->guard != MEM_GUARD_VAL)
 			dbg_msg("mem", "!! %p", p);
 		/* dbg_msg("mem", "-- %p", p); */
 		memory_stats.allocated -= header->size;
 		memory_stats.active_allocations--;
-		
+
 		if(header->prev)
 			header->prev->next = header->next;
 		else
 			first = header->next;
 		if(header->next)
 			header->next->prev = header->prev;
-		
+
 		free(header);
 	}
 }
@@ -219,7 +219,7 @@ void mem_debug_dump(IOHANDLE file)
 	MEMHEADER *header = first;
 	if(!file)
 		file = io_open("memory.txt", IOFLAG_WRITE);
-	
+
 	if(file)
 	{
 		while(header)
@@ -228,7 +228,7 @@ void mem_debug_dump(IOHANDLE file)
 			io_write(file, buf, strlen(buf));
 			header = header->next;
 		}
-	
+
 		io_close(file);
 	}
 }
@@ -275,7 +275,7 @@ IOHANDLE io_open(const char *filename, int flags)
 		WIN32_FIND_DATA finddata;
 		HANDLE handle;
 		int length;
-		
+
 		length = str_length(filename);
 		if(!filename || !length || filename[length-1] == '\\')
 			return 0x0;
@@ -630,9 +630,9 @@ int net_host_lookup(const char *hostname, NETADDR *addr, int types)
 	/*
 	dbg_msg("host lookup", "host='%s' port=%d %d", host, port, types);
 	*/
-	
+
 	mem_zero(&hints, sizeof(hints));
-	
+
 	hints.ai_family = AF_UNSPEC;
 
 	if(types == NETTYPE_IPV4)
@@ -655,8 +655,8 @@ static int parse_int(int *out, const char **str)
 	int i = 0;
 	*out = 0;
 	if(**str < '0' || **str > '9')
-		return -1; 
-		
+		return -1;
+
 	i = **str - '0';
 	(*str)++;
 
@@ -665,9 +665,9 @@ static int parse_int(int *out, const char **str)
 		if(**str < '0' || **str > '9')
 		{
 			*out = i;
-			return 0; 
+			return 0;
 		}
-		
+
 		i = (i*10) + (**str - '0');
 		(*str)++;
 	}
@@ -704,7 +704,7 @@ int net_addr_from_str(NETADDR *addr, const char *string)
 {
 	const char *str = string;
 	mem_zero(addr, sizeof(NETADDR));
-	
+
 	if(str[0] == '[')
 	{
 		/* ipv6 */
@@ -760,10 +760,10 @@ int net_addr_from_str(NETADDR *addr, const char *string)
 			str++;
 			if(parse_uint16(&addr->port, &str)) return -1;
 		}
-		
+
 		addr->type = NETTYPE_IPV4;
 	}
-	
+
 	return 0;
 }
 
@@ -825,7 +825,7 @@ static int priv_net_create_socket(int domain, int type, struct sockaddr *addr, i
 		priv_net_close_socket(sock);
 		return -1;
 	}
-	
+
 	/* set non-blocking */
 #if defined(CONF_FAMILY_WINDOWS)
 	ioctlsocket(sock, FIONBIO, &mode);
@@ -835,7 +835,7 @@ static int priv_net_create_socket(int domain, int type, struct sockaddr *addr, i
 
 	/* set boardcast */
 	setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast));
-	
+
 	/* return the newly created socket */
 	return sock;
 }
@@ -937,7 +937,7 @@ int net_udp_send(NETSOCKET sock, const NETADDR *addr, const void *data, int size
 	{
 		char addrstr[256];
 		net_addr_str(addr, addrstr, sizeof(addrstr));
-		
+
 		dbg_msg("net", "sendto error (%d '%s')", errno, strerror(errno));
 		dbg_msg("net", "\tsock = %d %x", sock, sock);
 		dbg_msg("net", "\tsize = %d %x", size, size);
@@ -1005,8 +1005,8 @@ NETSOCKET net_tcp_create(const NETADDR *a)
 		bind(sock.ipv4sock, (struct sockaddr *)&addr, sizeof(addr));
 	}
 
-    /* return */
-    return sock;
+	/* return */
+	return sock;
 }
 
 int net_tcp_set_non_blocking(NETSOCKET sock)
@@ -1122,7 +1122,7 @@ int net_tcp_connect_non_blocking(NETSOCKET sock, const NETADDR *a)
 	/*
 	netaddr_to_sockaddr(a, &addr);
 	net_tcp_set_non_blocking(sock);
-  	res = connect(sock, &addr, sizeof(addr));
+	res = connect(sock, &addr, sizeof(addr));
 	net_tcp_set_blocking(sock);
 	*/
 
@@ -1206,7 +1206,7 @@ int fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user)
 
 	if(!d)
 		return 0;
-		
+
 	str_format(buffer, sizeof(buffer), "%s/", dir);
 	length = str_length(buffer);
 
@@ -1246,7 +1246,7 @@ int fs_storage_path(const char *appname, char *path, int max)
 	for(i = strlen(home)+2; path[i]; i++)
 		path[i] = tolower(path[i]);
 #endif
-	
+
 	return 0;
 #endif
 }
@@ -1286,7 +1286,7 @@ int fs_is_dir(const char *path)
 	struct stat sb;
 	if (stat(path, &sb) == -1)
 		return 0;
-	
+
 	if (S_ISDIR(sb.st_mode))
 		return 1;
 	else
@@ -1326,7 +1326,7 @@ int fs_parent_dir(char *path)
 		if(*path == '/' || *path == '\\')
 			parent = path;
 	}
-	
+
 	if(parent)
 	{
 		*parent = 0;
@@ -1377,16 +1377,16 @@ void swap_endian(void *data, unsigned elem_size, unsigned num)
 
 int net_socket_read_wait(NETSOCKET sock, int time)
 {
-    struct timeval tv;
-    fd_set readfds;
+	struct timeval tv;
+	fd_set readfds;
 	int sockid;
 
-    tv.tv_sec = 0;
-    tv.tv_usec = 1000*time;
+	tv.tv_sec = 0;
+	tv.tv_usec = 1000*time;
 	sockid = 0;
 
-    FD_ZERO(&readfds);
-    if(sock.ipv4sock >= 0)
+	FD_ZERO(&readfds);
+	if(sock.ipv4sock >= 0)
 	{
 		FD_SET(sock.ipv4sock, &readfds);
 		sockid = sock.ipv4sock;
@@ -1398,8 +1398,8 @@ int net_socket_read_wait(NETSOCKET sock, int time)
 			sockid = sock.ipv6sock;
 	}
 
-    /* don't care about writefds and exceptfds */
-    select(sockid+1, &readfds, NULL, NULL, &tv);
+	/* don't care about writefds and exceptfds */
+	select(sockid+1, &readfds, NULL, NULL, &tv);
 
 	if(sock.ipv4sock >= 0 && FD_ISSET(sock.ipv4sock, &readfds))
 		return 1;
@@ -1407,7 +1407,7 @@ int net_socket_read_wait(NETSOCKET sock, int time)
 	if(sock.ipv6sock >= 0 && FD_ISSET(sock.ipv6sock, &readfds))
 		return 1;
 
-    return 0;
+	return 0;
 }
 
 unsigned time_timestamp()
@@ -1427,7 +1427,7 @@ void str_append(char *dst, const char *src, int dst_size)
 		s++;
 		i++;
 	}
-	
+
 	dst[dst_size-1] = 0; /* assure null termination */
 }
 
@@ -1448,12 +1448,12 @@ void str_format(char *buffer, int buffer_size, const char *format, ...)
 	va_list ap;
 	va_start(ap, format);
 	_vsnprintf(buffer, buffer_size, format, ap);
-    va_end(ap);
+	va_end(ap);
 #else
 	va_list ap;
 	va_start(ap, format);
 	vsnprintf(buffer, buffer_size, format, ap);
-    va_end(ap);
+	va_end(ap);
 #endif
 
 	buffer[buffer_size-1] = 0; /* assure null termination */
@@ -1578,7 +1578,7 @@ const char *str_find_nocase(const char *haystack, const char *needle)
 			return haystack;
 		haystack++;
 	}
-	
+
 	return 0;
 }
 
@@ -1598,7 +1598,7 @@ const char *str_find(const char *haystack, const char *needle)
 			return haystack;
 		haystack++;
 	}
-	
+
 	return 0;
 }
 
@@ -1620,7 +1620,7 @@ void str_timestamp(char *buffer, int buffer_size)
 {
 	time_t time_data;
 	struct tm *time_info;
-	
+
 	time(&time_data);
 	time_info = localtime(&time_data);
 	strftime(buffer, buffer_size, "%Y-%m-%d_%H-%M-%S", time_info);
@@ -1700,7 +1700,7 @@ float str_tofloat(const char *str) { return atof(str); }
 
 static int str_utf8_isstart(char c)
 {
-	if((c&0xC0) == 0x80)  /* 10xxxxxx */
+	if((c&0xC0) == 0x80) /* 10xxxxxx */
 		return 0;
 	return 1;
 }
@@ -1721,7 +1721,7 @@ int str_utf8_forward(const char *str, int cursor)
 	const char *buf = str + cursor;
 	if(!buf[0])
 		return cursor;
-	
+
 	if((*buf&0x80) == 0x0)  /* 0xxxxxxx */
 		return cursor+1;
 	else if((*buf&0xE0) == 0xC0) /* 110xxxxx */
@@ -1742,7 +1742,7 @@ int str_utf8_forward(const char *str, int cursor)
 		if(!buf[3]) return cursor+3;
 		return cursor+4;
 	}
-	
+
 	/* invalid */
 	return cursor+1;
 }
@@ -1776,7 +1776,7 @@ int str_utf8_encode(char *ptr, int chr)
 		ptr[3] = 0x80|(chr&0x3F);
 		return 4;
 	}
-	
+
 	return 0;
 }
 
@@ -1784,7 +1784,7 @@ int str_utf8_decode(const char **ptr)
 {
 	const char *buf = *ptr;
 	int ch = 0;
-	
+
 	do
 	{
 		if((*buf&0x80) == 0x0)  /* 0xxxxxxx */
@@ -1819,7 +1819,7 @@ int str_utf8_decode(const char **ptr)
 			buf++;
 			break;
 		}
-		
+
 		*ptr = buf;
 		return ch;
 	} while(0);
@@ -1827,7 +1827,7 @@ int str_utf8_decode(const char **ptr)
 	/* out of bounds */
 	*ptr = buf;
 	return -1;
-	
+
 }
 
 int str_utf8_check(const char *str)
@@ -1835,7 +1835,7 @@ int str_utf8_check(const char *str)
 	while(*str)
 	{
 		if((*str&0x80) == 0x0)
-			str++;	
+			str++;
 		else if((*str&0xE0) == 0xC0 && (*(str+1)&0xC0) == 0x80)
 			str += 2;
 		else if((*str&0xF0) == 0xE0 && (*(str+1)&0xC0) == 0x80 && (*(str+2)&0xC0) == 0x80)
diff --git a/src/base/system.h b/src/base/system.h
index fea9e452..a486b89d 100644
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -18,28 +18,28 @@ extern "C" {
 /*
 	Function: dbg_assert
 		Breaks into the debugger based on a test.
-	
+
 	Parameters:
 		test - Result of the test.
 		msg - Message that should be printed if the test fails.
-	
+
 	Remarks:
 		Does nothing in release version of the library.
-	
+
 	See Also:
 		<dbg_break>
 */
 void dbg_assert(int test, const char *msg);
-#define dbg_assert(test,msg) dbg_assert_imp(__FILE__, __LINE__, test,  msg)
+#define dbg_assert(test,msg) dbg_assert_imp(__FILE__, __LINE__, test, msg)
 void dbg_assert_imp(const char *filename, int line, int test, const char *msg);
 
 /*
 	Function: dbg_break
 		Breaks into the debugger.
-	
+
 	Remarks:
 		Does nothing in release version of the library.
-	
+
 	See Also:
 		<dbg_assert>
 */
@@ -47,16 +47,16 @@ void dbg_break();
 
 /*
 	Function: dbg_msg
-	
+
 	Prints a debug message.
-	
+
 	Parameters:
 		sys - A string that describes what system the message belongs to
 		fmt - A printf styled format string.
-	
+
 	Remarks:
 		Does nothing in release version of the library.
-		
+
 	See Also:
 		<dbg_assert>
 */
@@ -67,15 +67,15 @@ void dbg_msg(const char *sys, const char *fmt, ...);
 /*
 	Function: mem_alloc
 		Allocates memory.
-	
+
 	Parameters:
 		size - Size of the needed block.
 		alignment - Alignment for the block.
-	
+
 	Returns:
 		Returns a pointer to the newly allocated block. Returns a
 		null pointer if the memory couldn't be allocated.
-		
+
 	Remarks:
 		- Passing 0 to size will allocated the smallest amount possible
 		and return a unique pointer.
@@ -89,12 +89,12 @@ void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned al
 /*
 	Function: mem_free
 		Frees a block allocated through <mem_alloc>.
-	
+
 	Remarks:
 		- In the debug version of the library the function will assert if
 		a non-valid block is passed, like a null pointer or a block that
 		isn't allocated.
-	
+
 	See Also:
 		<mem_alloc>
 */
@@ -103,16 +103,16 @@ void mem_free(void *block);
 /*
 	Function: mem_copy
 		Copies a a memory block.
-	
+
 	Parameters:
 		dest - Destination.
 		source - Source to copy.
 		size - Size of the block to copy.
-	
+
 	Remarks:
 		- This functions DOES NOT handles cases where source and
 		destination is overlapping.
-	
+
 	See Also:
 		<mem_move>
 */
@@ -121,16 +121,16 @@ void mem_copy(void *dest, const void *source, unsigned size);
 /*
 	Function: mem_move
 		Copies a a memory block
-	
+
 	Parameters:
 		dest - Destination
 		source - Source to copy
 		size - Size of the block to copy
-	
+
 	Remarks:
 		- This functions handles cases where source and destination
 		is overlapping
-	
+
 	See Also:
 		<mem_copy>
 */
@@ -139,7 +139,7 @@ void mem_move(void *dest, const void *source, unsigned size);
 /*
 	Function: mem_zero
 		Sets a complete memory block to 0
-	
+
 	Parameters:
 		block - Pointer to the block to zero out
 		size - Size of the block
@@ -149,12 +149,12 @@ void mem_zero(void *block, unsigned size);
 /*
 	Function: mem_comp
 		Compares two blocks of memory
-	
+
 	Parameters:
 		a - First block of data
 		b - Second block of data
 		size - Size of the data to compare
-		
+
 	Returns:
 		<0 - Block a is lesser then block b
 		0 - Block a is equal to block b
@@ -168,7 +168,7 @@ int mem_comp(const void *a, const void *b, int size);
 		Will trigger a assert if memory has failed.
 */
 int mem_check_imp();
-#define mem_check() dbg_assert_imp(__FILE__, __LINE__, mem_check_imp(),  "Memory check failed")
+#define mem_check() dbg_assert_imp(__FILE__, __LINE__, mem_check_imp(), "Memory check failed")
 
 /* Group: File IO */
 enum {
@@ -205,7 +205,7 @@ IOHANDLE io_open(const char *filename, int flags);
 		io - Handle to the file to read data from.
 		buffer - Pointer to the buffer that will recive the data.
 		size - Number of bytes to read from the file.
-		
+
 	Returns:
 		Number of bytes read.
 
@@ -215,11 +215,11 @@ unsigned io_read(IOHANDLE io, void *buffer, unsigned size);
 /*
 	Function: io_skip
 		Skips data in a file.
-	
+
 	Parameters:
 		io - Handle to the file.
 		size - Number of bytes to skip.
-		
+
 	Returns:
 		Number of bytes skipped.
 */
@@ -228,12 +228,12 @@ unsigned io_skip(IOHANDLE io, int size);
 /*
 	Function: io_write
 		Writes data from a buffer to file.
-	
+
 	Parameters:
 		io - Handle to the file.
 		buffer - Pointer to the data that should be written.
 		size - Number of bytes to write.
-		
+
 	Returns:
 		Number of bytes written.
 */
@@ -242,12 +242,12 @@ unsigned io_write(IOHANDLE io, const void *buffer, unsigned size);
 /*
 	Function: io_seek
 		Seeks to a specified offset in the file.
-	
+
 	Parameters:
 		io - Handle to the file.
 		offset - Offset from pos to stop.
 		origin - Position to start searching from.
-		
+
 	Returns:
 		Returns 0 on success.
 */
@@ -256,10 +256,10 @@ int io_seek(IOHANDLE io, int offset, int origin);
 /*
 	Function: io_tell
 		Gets the current position in the file.
-	
+
 	Parameters:
 		io - Handle to the file.
-		
+
 	Returns:
 		Returns the current position. -1L if an error occured.
 */
@@ -268,10 +268,10 @@ long int io_tell(IOHANDLE io);
 /*
 	Function: io_length
 		Gets the total length of the file. Resetting cursor to the beginning
-	
+
 	Parameters:
 		io - Handle to the file.
-		
+
 	Returns:
 		Returns the total size. -1L if an error occured.
 */
@@ -280,10 +280,10 @@ long int io_length(IOHANDLE io);
 /*
 	Function: io_close
 		Closes a file.
-	
+
 	Parameters:
 		io - Handle to the file.
-		
+
 	Returns:
 		Returns 0 on success.
 */
@@ -292,10 +292,10 @@ int io_close(IOHANDLE io);
 /*
 	Function: io_flush
 		Empties all buffers and writes all pending data.
-	
+
 	Parameters:
 		io - Handle to the file.
-		
+
 	Returns:
 		Returns 0 on success.
 */
@@ -326,7 +326,7 @@ IOHANDLE io_stderr();
 /*
 	Function: thread_sleep
 		Suspends the current thread for a given period.
-	
+
 	Parameters:
 		milliseconds - Number of milliseconds to sleep.
 */
@@ -335,18 +335,18 @@ void thread_sleep(int milliseconds);
 /*
 	Function: thread_create
 		Creates a new thread.
-	
+
 	Parameters:
 		threadfunc - Entry point for the new thread.
 		user - Pointer to pass to the thread.
-		
+
 */
 void *thread_create(void (*threadfunc)(void *), void *user);
 
 /*
 	Function: thread_wait
 		Waits for a thread to be done or destroyed.
-	
+
 	Parameters:
 		thread - Thread to wait for.
 */
@@ -355,7 +355,7 @@ void thread_wait(void *thread);
 /*
 	Function: thread_destroy
 		Destroys a thread.
-	
+
 	Parameters:
 		thread - Thread to destroy.
 */
@@ -390,7 +390,7 @@ typedef long long int64;
 /*
 	Function: time_get
 		Fetches a sample from a high resolution timer.
-	
+
 	Returns:
 		Current value of the timer.
 
@@ -402,7 +402,7 @@ int64 time_get();
 /*
 	Function: time_freq
 		Returns the frequency of the high resolution timer.
-	
+
 	Returns:
 		Returns the frequency of the high resolution timer.
 */
@@ -411,7 +411,7 @@ int64 time_freq();
 /*
 	Function: time_timestamp
 		Retrives the current time as a UNIX timestamp
-	
+
 	Returns:
 		The time as a UNIX timestamp
 */
@@ -428,7 +428,7 @@ typedef struct
 enum
 {
 	NETADDR_MAXSTRSIZE = 1+(8*4+7)+1+1+5+1, // [XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX]:XXXXX
-	
+
 	NETTYPE_INVALID = 0,
 	NETTYPE_IPV4 = 1,
 	NETTYPE_IPV6 = 2,
@@ -446,10 +446,10 @@ typedef struct
 /*
 	Function: net_init
 		Initiates network functionallity.
-	
+
 	Returns:
 		Returns 0 on success,
-		
+
 	Remarks:
 		You must call this function before using any other network
 		functions.
@@ -469,11 +469,11 @@ int net_host_lookup(const char *hostname, NETADDR *addr, int types);
 /*
 	Function: net_addr_comp
 		Compares two network addresses.
-	
+
 	Parameters:
 		a - Address to compare
 		b - Address to compare to.
-	
+
 	Returns:
 		<0 - Address a is lesser then address b
 		0 - Address a is equal to address b
@@ -484,12 +484,12 @@ int net_addr_comp(const NETADDR *a, const NETADDR *b);
 /*
 	Function: net_addr_str
 		Turns a network address into a representive string.
-	
+
 	Parameters:
 		addr - Address to turn into a string.
 		string - Buffer to fill with the string.
 		max_length - Maximum size of the string.
-		
+
 	Remarks:
 		- The string will always be zero terminated
 
@@ -499,10 +499,10 @@ void net_addr_str(const NETADDR *addr, char *string, int max_length);
 /*
 	Function: net_addr_from_str
 		Turns string into a network address.
-	
+
 	Returns:
 		0 on success
-	
+
 	Parameters:
 		addr - Address to fill in.
 		string - String to parse.
@@ -517,7 +517,7 @@ int net_addr_from_str(NETADDR *addr, const char *string);
 
 	Parameters:
 		bindaddr - Address to bind the socket to.
-	
+
 	Returns:
 		On success it returns an handle to the socket. On failure it
 		returns NETSOCKET_INVALID.
@@ -533,7 +533,7 @@ NETSOCKET net_udp_create(NETADDR bindaddr);
 		addr - Where to send the packet.
 		data - Pointer to the packet data to send.
 		size - Size of the packet.
-	
+
 	Returns:
 		On success it returns the number of bytes sent. Returns -1
 		on error.
@@ -549,7 +549,7 @@ int net_udp_send(NETSOCKET sock, const NETADDR *addr, const void *data, int size
 		addr - Pointer to an NETADDR that will recive the address.
 		data - Pointer to a buffer that will recive the data.
 		maxsize - Maximum size to recive.
-	
+
 	Returns:
 		On success it returns the number of bytes recived. Returns -1
 		on error.
@@ -562,7 +562,7 @@ int net_udp_recv(NETSOCKET sock, NETADDR *addr, void *data, int maxsize);
 
 	Parameters:
 		sock - Socket to close.
-	
+
 	Returns:
 		Returns 0 on success. -1 on error.
 */
@@ -574,7 +574,7 @@ int net_udp_close(NETSOCKET sock);
 /*
 	Function: net_tcp_create
 		Creates a TCP socket.
-	
+
 	Parameters:
 		bindaddr - Address to bind the socket to.
 
@@ -586,11 +586,11 @@ NETSOCKET net_tcp_create(const NETADDR *a);
 /*
 	Function: net_tcp_listen
 		Makes the socket start listening for new connections.
-	
+
 	Parameters:
 		sock - Socket to start listen to.
 		backlog - Size of the queue of incomming connections to keep.
-	
+
 	Returns:
 		Returns 0 on success.
 */
@@ -599,12 +599,12 @@ int net_tcp_listen(NETSOCKET sock, int backlog);
 /*
 	Function: net_tcp_accept
 		Polls a listning socket for a new connection.
-		
+
 	Parameters:
 		sock - Listning socket to poll.
 		new_sock - Pointer to a socket to fill in with the new socket.
 		addr - Pointer to an address that will be filled in the remote address (optional, can be NULL).
-	
+
 	Returns:
 		Returns a non-negative integer on success. Negative integer on failure.
 */
@@ -613,26 +613,26 @@ int net_tcp_accept(NETSOCKET sock, NETSOCKET *new_sock, NETADDR *addr);
 /*
 	Function: net_tcp_connect
 		Connects one socket to another.
-		
+
 	Parameters:
 		sock - Socket to connect.
 		addr - Address to connect to.
 
 	Returns:
 		Returns 0 on success.
-			
+
 */
 int net_tcp_connect(NETSOCKET sock, const NETADDR *addr);
 
 /*
 	Function: net_tcp_send
 		Sends data to a TCP stream.
-	
+
 	Parameters:
 		sock - Socket to send data to.
 		data - Pointer to the data to send.
 		size - Size of the data to send.
-	
+
 	Returns:
 		Number of bytes sent. Negative value on failure.
 */
@@ -641,12 +641,12 @@ int net_tcp_send(NETSOCKET sock, const void *data, int size);
 /*
 	Function: net_tcp_recv
 		Recvives data from a TCP stream.
-		
+
 	Parameters:
 		sock - Socket to recvive data from.
 		data - Pointer to a buffer to write the data to
 		max_size - Maximum of data to write to the buffer.
-		
+
 	Returns:
 		Number of bytes recvived. Negative value on failure. When in
 		non-blocking mode, it returns 0 when there is no more data to
@@ -657,10 +657,10 @@ int net_tcp_recv(NETSOCKET sock, void *data, int maxsize);
 /*
 	Function: net_tcp_close
 		Closes a TCP socket.
-	
+
 	Parameters:
 		sock - Socket to close.
-	
+
 	Returns:
 		Returns 0 on success. Negative value on failure.
 */
@@ -671,12 +671,12 @@ int net_tcp_close(NETSOCKET sock);
 /*
 	Function: str_append
 		Appends a string to another.
-	
+
 	Parameters:
 		dst - Pointer to a buffer that contains a string.
 		src - String to append.
 		dst_size - Size of the buffer of the dst string.
-		
+
 	Remarks:
 		- The strings are treated as zero-termineted strings.
 		- Garantees that dst string will contain zero-termination.
@@ -686,7 +686,7 @@ void str_append(char *dst, const char *src, int dst_size);
 /*
 	Function: str_copy
 		Copies a string to another.
-		
+
 	Parameters:
 		dst - Pointer to a buffer that shall recive the string.
 		src - String to be copied.
@@ -701,10 +701,10 @@ void str_copy(char *dst, const char *src, int dst_size);
 /*
 	Function: str_length
 		Returns the length of a zero terminated string.
-		
+
 	Parameters:
 		str - Pointer to the string.
-		
+
 	Returns:
 		Length of string in bytes excluding the zero termination.
 */
@@ -713,7 +713,7 @@ int str_length(const char *str);
 /*
 	Function: str_format
 		Performs printf formating into a buffer.
-		
+
 	Parameters:
 		buffer - Pointer to the buffer to recive the formated string.
 		buffer_size - Size of the buffer.
@@ -730,7 +730,7 @@ void str_format(char *buffer, int buffer_size, const char *format, ...);
 /*
 	Function: str_sanitize_strong
 		Replaces all characters below 32 and above 127 with whitespace.
-	
+
 	Parameters:
 		str - String to sanitize.
 
@@ -742,7 +742,7 @@ void str_sanitize_strong(char *str);
 /*
 	Function: str_sanitize_cc
 		Replaces all characters below 32 with whitespace.
-	
+
 	Parameters:
 		str - String to sanitize.
 
@@ -755,7 +755,7 @@ void str_sanitize_cc(char *str);
 	Function: str_sanitize
 		Replaces all characters below 32 with whitespace with
 		exception to \t, \n and \r.
-	
+
 	Parameters:
 		str - String to sanitize.
 
@@ -767,7 +767,7 @@ void str_sanitize(char *str);
 /*
 	Function: str_skip_to_whitespace
 		Skips leading non-whitespace characters(all but ' ', '\t', '\n', '\r').
-	
+
 	Parameters:
 		str - Pointer to the string.
 
@@ -783,7 +783,7 @@ char *str_skip_to_whitespace(char *str);
 /*
 	Function: str_skip_whitespaces
 		Skips leading whitespace characters(' ', '\t', '\n', '\r').
-	
+
 	Parameters:
 		str - Pointer to the string.
 
@@ -799,12 +799,12 @@ char *str_skip_whitespaces(char *str);
 /*
 	Function: str_comp_nocase
 		Compares to strings case insensitive.
-	
+
 	Parameters:
 		a - String to compare.
 		b - String to compare.
-	
-	Returns:	
+
+	Returns:
 		<0 - String a is lesser then string b
 		0 - String a is equal to string b
 		>0 - String a is greater then string b
@@ -819,12 +819,12 @@ int str_comp_nocase(const char *a, const char *b);
 /*
 	Function: str_comp
 		Compares to strings case sensitive.
-	
+
 	Parameters:
 		a - String to compare.
 		b - String to compare.
-	
-	Returns:	
+
+	Returns:
 		<0 - String a is lesser then string b
 		0 - String a is equal to string b
 		>0 - String a is greater then string b
@@ -837,13 +837,13 @@ int str_comp(const char *a, const char *b);
 /*
 	Function: str_comp_num
 		Compares up to num characters of two strings case sensitive.
-	
+
 	Parameters:
 		a - String to compare.
 		b - String to compare.
 		num - Maximum characters to compare
-	
-	Returns:	
+
+	Returns:
 		<0 - String a is lesser then string b
 		0 - String a is equal to string b
 		>0 - String a is greater then string b
@@ -856,12 +856,12 @@ int str_comp_num(const char *a, const char *b, const int num);
 /*
 	Function: str_comp_filenames
 		Compares two strings case sensitive, digit chars will be compared as numbers.
-	
+
 	Parameters:
 		a - String to compare.
 		b - String to compare.
-	
-	Returns:	
+
+	Returns:
 		<0 - String a is lesser then string b
 		0 - String a is equal to string b
 		>0 - String a is greater then string b
@@ -878,7 +878,7 @@ int str_comp_filenames(const char *a, const char *b);
 	Parameters:
 		haystack - String to search in
 		needle - String to search for
-		
+
 	Returns:
 		A pointer into haystack where the needle was found.
 		Returns NULL of needle could not be found.
@@ -896,7 +896,7 @@ const char *str_find_nocase(const char *haystack, const char *needle);
 	Parameters:
 		haystack - String to search in
 		needle - String to search for
-		
+
 	Returns:
 		A pointer into haystack where the needle was found.
 		Returns NULL of needle could not be found.
@@ -939,13 +939,13 @@ void str_timestamp(char *buffer, int buffer_size);
 /*
 	Function: fs_listdir
 		Lists the files in a directory
-		
+
 	Parameters:
 		dir - Directory to list
 		cb - Callback function to call for each entry
 		type - Type of the directory
 		user - Pointer to give to the callback
-	
+
 	Returns:
 		Always returns 0.
 */
@@ -955,13 +955,13 @@ int fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user);
 /*
 	Function: fs_makedir
 		Creates a directory
-	
+
 	Parameters:
 		path - Directory to create
-	
+
 	Returns:
 		Returns 0 on success. Negative value on failure.
-	
+
 	Remarks:
 		Does not create several directories if needed. "a/b/c" will result
 		in a failure if b or a does not exist.
@@ -971,10 +971,10 @@ int fs_makedir(const char *path);
 /*
 	Function: fs_storage_path
 		Fetches per user configuration directory.
-	
+
 	Returns:
 		Returns 0 on success. Negative value on failure.
-	
+
 	Remarks:
 		- Returns ~/.appname on UNIX based systems
 		- Returns ~/Library/Applications Support/appname on Mac OS X
@@ -985,7 +985,7 @@ int fs_storage_path(const char *appname, char *path, int max);
 /*
 	Function: fs_is_dir
 		Checks if directory exists
-	
+
 	Returns:
 		Returns 1 on success, 0 on failure.
 */
@@ -994,7 +994,7 @@ int fs_is_dir(const char *path);
 /*
 	Function: fs_chdir
 		Changes current working directory
-	
+
 	Returns:
 		Returns 0 on success, 1 on failure.
 */
@@ -1003,7 +1003,7 @@ int fs_chdir(const char *path);
 /*
 	Function: fs_getcwd
 		Gets the current working directory.
-	
+
 	Returns:
 		Returns a pointer to the buffer on success, 0 on failure.
 */
@@ -1012,7 +1012,7 @@ char *fs_getcwd(char *buffer, int buffer_size);
 /*
 	Function: fs_parent_dir
 		Get the parent directory of a directory
-	
+
 	Parameters:
 		path - The directory string
 
@@ -1027,7 +1027,7 @@ int fs_parent_dir(char *path);
 /*
 	Function: fs_remove
 		Deletes the file with the specified name.
-	
+
 	Parameters:
 		filename - The file to delete
 
@@ -1042,7 +1042,7 @@ int fs_remove(const char *filename);
 /*
 	Function: fs_rename
 		Renames the file or directory. If the paths differ the file will be moved.
-	
+
 	Parameters:
 		oldname - The actual name
 		newname - The new name
@@ -1062,7 +1062,7 @@ int fs_rename(const char *oldname, const char *newname);
 
 /*
 	Function: net_tcp_connect_non_blocking
-	
+
 	DOCTODO: serp
 */
 int net_tcp_connect_non_blocking(NETSOCKET sock, const NETADDR *a);
@@ -1121,7 +1121,7 @@ enum {
 #define DBG_LEVEL_LOW DBG_LEVEL_IMPORTANT
 #define DBG_LEVEL_HIGH DBG_LEVEL_INFO
 
-typedef void (*DBG_LOGGER)(const char *line); 
+typedef void (*DBG_LOGGER)(const char *line);
 void dbg_logger(DBG_LOGGER logger);
 
 void dbg_logger_stdout();
@@ -1157,7 +1157,7 @@ unsigned str_quickhash(const char *str);
 /*
 	Function: gui_messagebox
 		Display plain OS-dependent message box
-	
+
 	Parameters:
 		title - title of the message box
 		message - text to display
@@ -1168,7 +1168,7 @@ void gui_messagebox(const char *title, const char *message);
 /*
 	Function: str_utf8_rewind
 		Moves a cursor backwards in an utf8 string
-	
+
 	Parameters:
 		str - utf8 string
 		cursor - position in the string
@@ -1184,11 +1184,11 @@ int str_utf8_rewind(const char *str, int cursor);
 /*
 	Function: str_utf8_forward
 		Moves a cursor forwards in an utf8 string
-	
+
 	Parameters:
 		str - utf8 string
 		cursor - position in the string
-		
+
 	Returns:
 		New cursor position.
 
@@ -1200,10 +1200,10 @@ int str_utf8_forward(const char *str, int cursor);
 /*
 	Function: str_utf8_decode
 		Decodes an utf8 character
-	
+
 	Parameters:
 		ptr - pointer to an utf8 string. this pointer will be moved forward
-		
+
 	Returns:
 		Unicode value for the character. -1 for invalid characters and 0 for end of string.
 
@@ -1215,10 +1215,10 @@ int str_utf8_decode(const char **ptr);
 /*
 	Function: str_utf8_encode
 		Encode an utf8 character
-	
+
 	Parameters:
 		ptr - Pointer to a buffer that should recive the data. Should be able to hold at least 4 bytes.
-		
+
 	Returns:
 		Number of bytes put into the buffer.
 
@@ -1230,10 +1230,10 @@ int str_utf8_encode(char *ptr, int chr);
 /*
 	Function: str_utf8_check
 		Checks if a strings contains just valid utf8 characters.
-	
+
 	Parameters:
 		str - Pointer to a possible utf8 string.
-		
+
 	Returns:
 		0 - invalid characters found.
 		1 - only valid characters found.
diff --git a/src/base/tl/algorithm.h b/src/base/tl/algorithm.h
index c5cd74c3..6b2e542a 100644
--- a/src/base/tl/algorithm.h
+++ b/src/base/tl/algorithm.h
@@ -8,7 +8,7 @@
 
 /*
 	insert 4
-	      v
+		v
 	1 2 3 4 5 6
 
 */
@@ -38,12 +38,12 @@ R partition_binary(R range, T value)
 	concept_size::check(range);
 	concept_slice::check(range);
 	concept_sorted::check(range);
-	
+
 	if(range.empty())
 		return range;
 	if(range.back() < value)
 		return R();
-	
+
 	while(range.size() > 1)
 	{
 		unsigned pivot = (range.size()-1)/2;
@@ -82,7 +82,7 @@ void sort_bubble(R range)
 	concept_empty::check(range);
 	concept_forwarditeration::check(range);
 	concept_backwarditeration::check(range);
-	
+
 	// slow bubblesort :/
 	for(; !range.empty(); range.pop_back())
 	{
@@ -119,18 +119,18 @@ bool sort_verify(R range)
 {
 	concept_empty::check(range);
 	concept_forwarditeration::check(range);
-	
+
 	typename R::type *prev = &range.front();
 	range.pop_front();
 	for(; !range.empty(); range.pop_front())
 	{
 		typename R::type *cur = &range.front();
-		
+
 		if(*cur < *prev)
 			return false;
 		prev = cur;
 	}
-	
+
 	return true;
 }
 
diff --git a/src/base/tl/array.h b/src/base/tl/array.h
index 0cee2afc..4f4b2fc3 100644
--- a/src/base/tl/array.h
+++ b/src/base/tl/array.h
@@ -10,10 +10,10 @@
 /*
 	Class: array
 		Normal dynamic array class
-	
+
 	Remarks:
 		- Grows 50% each time it needs to fit new items
-		- Use set_size() if you know how many elements 
+		- Use set_size() if you know how many elements
 		- Use optimize() to reduce the needed space.
 */
 template <class T, class ALLOCATOR = allocator_default<T> >
@@ -24,7 +24,7 @@ class array : private ALLOCATOR
 		list = 0x0;
 		clear();
 	}
-	
+
 public:
 	typedef plain_range<T> range;
 
@@ -35,7 +35,7 @@ public:
 	{
 		init();
 	}
-	
+
 	/*
 		Function: array copy constructor
 	*/
@@ -60,7 +60,7 @@ public:
 
 	/*
 		Function: delete_all
-		
+
 		Remarks:
 			- Invalidates ranges
 	*/
@@ -74,7 +74,7 @@ public:
 
 	/*
 		Function: clear
-	
+
 		Remarks:
 			- Invalidates ranges
 	*/
@@ -124,7 +124,7 @@ public:
 
 	/*
 		Function: remove_index
-		
+
 		Remarks:
 			- Invalidates ranges
 	*/
@@ -132,7 +132,7 @@ public:
 	{
 		for(int i = index+1; i < num_elements; i++)
 			list[i-1] = list[i];
-		
+
 		set_size(size()-1);
 	}
 
@@ -156,10 +156,10 @@ public:
 	/*
 		Function: add
 			Adds an item to the array.
-		
+
 		Arguments:
 			item - Item to add.
-			
+
 		Remarks:
 			- Invalidates ranges
 			- See remarks about <array> how the array grows.
@@ -175,9 +175,9 @@ public:
 	/*
 		Function: insert
 			Inserts an item into the array at a specified location.
-			
+
 		Arguments:
-			item - Item to insert.		
+			item - Item to insert.
 			r - Range where to insert the item
 
 		Remarks:
@@ -188,16 +188,16 @@ public:
 	{
 		if(r.empty())
 			return add(item);
-			
+
 		int index = (int)(&r.front()-list);
 		incsize();
 		set_size(size()+1);
-		
+
 		for(int i = num_elements-1; i > index; i--)
 			list[i] = list[i-1];
 
 		list[index] = item;
-		
+
 		return num_elements-1;
 	}
 
@@ -236,7 +236,7 @@ public:
 	/*
 		Function: set_size
 			Resizes the array to the specified size.
-			
+
 		Arguments:
 			new_size - The new size for the array.
 	*/
@@ -251,10 +251,10 @@ public:
 		Function: hint_size
 			Allocates the number of elements wanted but
 			does not increase the list size.
-			
+
 		Arguments:
 			hint - Size to allocate.
-			
+
 		Remarks:
 			- If the hint is smaller then the number of elements, nothing will be done.
 			- Invalidates ranges
@@ -302,7 +302,7 @@ public:
 			(*this)[i] = other[i];
 		return *this;
 	}
-	
+
 	/*
 		Function: all
 			Returns a range that contains the whole array.
@@ -318,18 +318,18 @@ protected:
 				alloc(list_size+1);
 			else
 				alloc(list_size+list_size/2);
-		}		
+		}
 	}
 
 	void alloc(int new_len)
 	{
 		list_size = new_len;
 		T *new_list = ALLOCATOR::alloc_array(list_size);
-		
+
 		int end = num_elements < list_size ? num_elements : list_size;
 		for(int i = 0; i < end; i++)
 			new_list[i] = list[i];
-		
+
 		ALLOCATOR::free_array(list);
 
 		num_elements = num_elements < list_size ? num_elements : list_size;
diff --git a/src/base/tl/range.h b/src/base/tl/range.h
index 25047d31..f05169fa 100644
--- a/src/base/tl/range.h
+++ b/src/base/tl/range.h
@@ -11,7 +11,7 @@
 
 /*
 	Concept: concept_empty
-		
+
 		template<class T>
 		struct range
 		{
@@ -25,7 +25,7 @@ struct concept_empty
 
 /*
 	Concept: concept_index
-		
+
 		template<class T>
 		struct range
 		{
@@ -39,7 +39,7 @@ struct concept_index
 
 /*
 	Concept: concept_size
-		
+
 		template<class T>
 		struct range
 		{
@@ -53,7 +53,7 @@ struct concept_size
 
 /*
 	Concept: concept_slice
-		
+
 		template<class T>
 		struct range
 		{
@@ -67,7 +67,7 @@ struct concept_slice
 
 /*
 	Concept: concept_sorted
-		
+
 		template<class T>
 		struct range
 		{
@@ -82,13 +82,13 @@ struct concept_sorted
 /*
 	Concept: concept_forwarditeration
 		Checks for the front and pop_front methods
-		
+
 		template<class T>
 		struct range
 		{
 			void pop_front();
 			T &front() const;
-		};		
+		};
 */
 struct concept_forwarditeration
 {
@@ -98,13 +98,13 @@ struct concept_forwarditeration
 /*
 	Concept: concept_backwarditeration
 		Checks for the back and pop_back methods
-		
+
 		template<class T>
 		struct range
 		{
 			void pop_back();
 			T &back() const;
-		};			
+		};
 */
 struct concept_backwarditeration
 {
@@ -119,7 +119,7 @@ struct concept_backwarditeration
 
 /*
 	Class: plain_range
-	
+
 	Concepts:
 		<concept_empty>
 		<concept_index>
@@ -142,13 +142,13 @@ public:
 	{
 		*this = r;
 	}
-		
+
 	plain_range(T *b, T *e)
 	{
 		begin = b;
 		end = e;
 	}
-	
+
 	bool empty() const { return begin >= end; }
 	void pop_front() { assert(!empty()); begin++; }
 	void pop_back() { assert(!empty()); end--; }
@@ -160,7 +160,7 @@ public:
 	{
 		return plain_range(begin+startindex, begin+endindex);
 	}
-	
+
 protected:
 	T *begin;
 	T *end;
@@ -168,7 +168,7 @@ protected:
 
 /*
 	Class: plain_range_sorted
-	
+
 	Concepts:
 		Same as <plain_range> but with these additions:
 		<concept_sorted>
@@ -180,7 +180,7 @@ class plain_range_sorted : public plain_range<T>
 public:
 	/* sorted concept */
 	void sorted() const { }
-	
+
 	plain_range_sorted()
 	{}
 
@@ -188,11 +188,11 @@ public:
 	{
 		*this = r;
 	}
-		
+
 	plain_range_sorted(T *b, T *e)
 	: parent(b, e)
 	{}
-	
+
 	plain_range_sorted slice(unsigned start, unsigned count)
 	{
 		return plain_range_sorted(parent::begin+start, parent::begin+start+count);
@@ -206,29 +206,29 @@ private:
 	reverse_range() {}
 public:
 	typedef typename R::type type;
-	
+
 	reverse_range(R r)
 	{
 		range = r;
 	}
-	
+
 	reverse_range(const reverse_range &other) { range = other.range; }
-	
+
 
 	bool empty() const { return range.empty(); }
 	void pop_front() { range.pop_back(); }
 	void pop_back() { range.pop_front(); }
 	type& front() { return range.back(); }
 	type& back() { return range.front(); }
-	
+
 	R range;
 };
 
 template<class R> reverse_range<R> reverse(R range) {
-   return reverse_range<R>(range);
+	return reverse_range<R>(range);
 }
 template<class R> R reverse(reverse_range<R> range) {
-   return range.range;
+	return range.range;
 }
 
 #endif // TL_FILE_RANGE_HPP
diff --git a/src/base/tl/sorted_array.h b/src/base/tl/sorted_array.h
index 94ccd543..7e312e1e 100644
--- a/src/base/tl/sorted_array.h
+++ b/src/base/tl/sorted_array.h
@@ -10,11 +10,11 @@ template <class T, class ALLOCATOR = allocator_default<T> >
 class sorted_array : public array<T, ALLOCATOR>
 {
 	typedef array<T, ALLOCATOR> parent;
-	
+
 	// insert and size is not allowed
 	int insert(const T& item, typename parent::range r) { dbg_break(); return 0; }
 	int set_size(int new_size) { dbg_break(); return 0; }
-		
+
 public:
 	typedef plain_range_sorted<T> range;
 
@@ -27,7 +27,7 @@ public:
 	{

 		return parent::add(item);

 	}

-	

+

 	void sort_range()

 	{

 		sort(all());

@@ -37,7 +37,7 @@ public:
 	/*
 		Function: all
 			Returns a sorted range that contains the whole array.
-	*/	
+	*/
 	range all() { return range(parent::list, parent::list+parent::num_elements); }
 };
 
diff --git a/src/base/tl/string.h b/src/base/tl/string.h
index 18fab4d4..e0b891ad 100644
--- a/src/base/tl/string.h
+++ b/src/base/tl/string.h
@@ -11,38 +11,38 @@ class string_base : private ALLOCATOR
 {
 	char *str;
 	int length;
-	
+
 	void reset()
 	{
 		str = 0; length = 0;
 	}
-	
+
 	void free()
 	{
 		ALLOCATOR::free_array(str);
 		reset();
-	}	
-	
+	}
+
 	void copy(const char *other_str, int other_length)
 	{
 		length = other_length;
 		str = ALLOCATOR::alloc_array(length+1);
 		mem_copy(str, other_str, length+1);
 	}
-		
+
 	void copy(const string_base &other)
 	{
 		if(!other.str)
 			return;
 		copy(other.str, other.length);
 	}
-	
+
 public:
 	string_base() { reset(); }
 	string_base(const char *other_str) { copy(other_str, str_length(other_str)); }
 	string_base(const string_base &other) { reset(); copy(other); }
 	~string_base() { free(); }
-	
+
 	string_base &operator = (const char *other)
 	{
 		free();
@@ -50,17 +50,17 @@ public:
 			copy(other, str_length(other));
 		return *this;
 	}
-	
+
 	string_base &operator = (const string_base &other)
 	{
 		free();
 		copy(other);
 		return *this;
 	}
-		
+
 	bool operator < (const char *other_str) const { return str_comp(str, other_str) < 0; }
 	operator const char *() const { return str; }
-	
+
 	const char *cstr() const { return str; }
 };
 
diff --git a/src/base/vmath.h b/src/base/vmath.h
index e4443da2..3461adf8 100644
--- a/src/base/vmath.h
+++ b/src/base/vmath.h
@@ -13,19 +13,19 @@ class vector2_base
 public:
 	union { T x,u; };
 	union { T y,v; };
-	
+
 	vector2_base() {}
 	vector2_base(float nx, float ny)
 	{
 		x = nx;
 		y = ny;
 	}
-	
+
 	vector2_base operator -() const { return vector2_base(-x, -y); }
 	vector2_base operator -(const vector2_base &v) const { return vector2_base(x-v.x, y-v.y); }
 	vector2_base operator +(const vector2_base &v) const { return vector2_base(x+v.x, y+v.y); }
 	vector2_base operator *(const T v) const { return vector2_base(x*v, y*v); }
-	
+
 	const vector2_base &operator =(const vector2_base &v) { x = v.x; y = v.y; return *this; }
 
 	const vector2_base &operator +=(const vector2_base &v) { x += v.x; y += v.y; return *this; }
@@ -81,7 +81,7 @@ inline vector2_base<T> closest_point_on_line(vector2_base<T> line_point0, vector
 	if (t > 1.0f) return 1.0f;
 	return t;*/
 }
-	
+
 // ------------------------------------
 template<typename T>
 class vector3_base
@@ -98,7 +98,7 @@ public:
 		y = ny;
 		z = nz;
 	}
-	
+
 	const vector3_base &operator =(const vector3_base &v) { x = v.x; y = v.y; z = v.z; return *this; }
 
 	vector3_base operator -(const vector3_base &v) const { return vector3_base(x-v.x, y-v.y, z-v.z); }
@@ -107,7 +107,7 @@ public:
 	vector3_base operator *(const T v) const { return vector3_base(x*v, y*v, z*v); }
 	vector3_base operator *(const vector3_base &v) const { return vector3_base(x*v.x, y*v.y, z*v.z); }
 	vector3_base operator /(const T v) const { return vector3_base(x/v, y/v, z/v); }
-	
+
 	const vector3_base &operator +=(const vector3_base &v) { x += v.x; y += v.y; z += v.z; return *this; }
 	const vector3_base &operator -=(const vector3_base &v) { x -= v.x; y -= v.y; z -= v.z; return *this; }
 	const vector3_base &operator *=(const T v) { x *= v; y *= v; z *= v; return *this;	}
@@ -174,13 +174,13 @@ public:
 		z = nz;
 		w = nw;
 	}
-	
+
 	vector4_base operator +(const vector4_base &v) const { return vector4_base(x+v.x, y+v.y, z+v.z, w+v.w); }
 	vector4_base operator -(const vector4_base &v) const { return vector4_base(x-v.x, y-v.y, z-v.z, w-v.w); }
 	vector4_base operator -() const { return vector4_base(-x, -y, -z, -w); }
 	vector4_base operator *(const vector4_base &v) const { return vector4_base(x*v.x, y*v.y, z*v.z, w*v.w); }
 	vector4_base operator *(const T v) const { return vector4_base(x*v, y*v, z*v, w*v); }
-	
+
 	const vector4_base &operator =(const vector4_base &v) { x = v.x; y = v.y; z = v.z; w = v.w; return *this; }
 
 	const vector4_base &operator +=(const vector4_base &v) { x += v.x; y += v.y; z += v.z; w += v.w; return *this; }