view src/impl/hoofbaby/codec/libav/mingw.d @ 0:3425707ddbf6

Initial import (hopefully this mercurial stuff works...)
author fraserofthenight
date Mon, 06 Jul 2009 08:06:28 -0700
parents
children
line wrap: on
line source

/**
 * Hoofbaby -- http://www.dsource.org/projects/hoofbaby
 * Copyright (C) 2009 Robert Fraser
 * 
 * This program is free software; you can redistribute it andor
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

module hoofbaby.codec.libav.mingw;

import tango.stdc.stdlib;
import tango.stdc.math;
import tango.stdc.ctype;
import tango.stdc.stdio;
import tango.stdc.stdarg;
import tango.sys.win32.UserGdi;

// Some implementations of MinGW/libc functions required to link with libav*

extern(C) double __strtod(in char* nptr, char** endptr) { return strtod(nptr, endptr); }
extern(C) uint __fpclassifyf(float x) { return __fpclassify_f(x); }
extern(C) int __mingw_vfprintf(FILE* stream, char* format, va_list va) { return vfprintf(stream, format, va); }
extern(C) long _lseeki64(HFILE handle, long offset, int whence) { return _llseek(handle, offset, whence); }

extern(C) int strcasecmp(char* s1, char* s2)
{
	while(toupper(*s1) == toupper(*s2))
	{
		if(*s1 == '\0')
			return 0;
		s1++;
		s2++;
	}
	return toupper(*s1) - toupper(*s2);
}

extern(C) int strncasecmp(char* s1, char* s2, size_t n)
{
	while(toupper(*s1) == toupper(*s2))
	{
		if(--n == 0 || *s1 == '\0')
			return 0;
		s1++;
		s2++;
	}
	return toupper(*s1) - toupper(*s2);
}

// This isn't extern(C) in Tango for some odd reason
extern(C) int snprintf(char* s, size_t n, char* fmt, ...)
{
	va_list va;
	va_start(va, fmt);
	return _vsnprintf(s, n, fmt, va);
	va_end(va);
}

// TODO -- too lazy to implement these until I'm sure they're needed
extern(C) int gettimeofday(void* tp, void* tz) { assert(false); }