1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +01:00

changes merged back from avifile cvs

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2140 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2001-10-08 22:26:14 +00:00
parent feb1135eda
commit 031c6bf512
5 changed files with 88 additions and 33 deletions

View File

@ -7,14 +7,7 @@
#ifdef HAVE_LIBDL
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <wine/windef.h>
//#include <wine/global.h>
//#include <wine/process.h>
#include <wine/module.h>
#include <wine/heap.h>
#include <wine/elfdll.h>
@ -23,6 +16,10 @@
//DEFAULT_DEBUG_CHANNEL(elfdll)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <dlfcn.h>
struct modref_list_t;

View File

@ -1,4 +1,3 @@
#ifndef loader_ext_h
#define loader_ext_h

View File

@ -6,6 +6,8 @@
* and initializes it at the start of player!
*/
#include "ldt_keeper.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
@ -14,7 +16,6 @@
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#ifdef __linux__
#include <asm/unistd.h>
#include <asm/ldt.h>
@ -36,8 +37,8 @@ extern int sysi86(int, void*);
}
#endif
#ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */
#define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */
#ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */
#define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */
#endif
#define TEB_SEL_IDX NUMSYSLDTS
@ -72,8 +73,6 @@ struct modify_ldt_ldt_s {
#endif
#define TEB_SEL LDT_SEL(TEB_SEL_IDX)
#include "ldt_keeper.h"
/**
*
* This should be performed before we create first thread. See remarks
@ -81,8 +80,8 @@ struct modify_ldt_ldt_s {
*
*/
static void* fs_seg=NULL;
static char* prev_struct=NULL;
static void* fs_seg = NULL;
static char* prev_struct = NULL;
/**
* here is a small logical problem with Restore for multithreaded programs -
* in C++ we use static class for this...
@ -200,18 +199,18 @@ void Setup_LDT_Keeper(void)
#if defined(__svr4__)
{
struct ssd ssd;
ssd.sel = TEB_SEL;
ssd.bo = array.base_addr;
ssd.ls = array.limit - array.base_addr;
ssd.acc1 = ((array.read_exec_only == 0) << 1) |
(array.contents << 2) |
0xf0; /* P(resent) | DPL3 | S */
ssd.acc2 = 0x4; /* byte limit, 32-bit segment */
if (sysi86(SI86DSCR, &ssd) < 0) {
perror("sysi86(SI86DSCR)");
printf("Couldn't install fs segment, expect segfault\n");
}
struct ssd ssd;
ssd.sel = TEB_SEL;
ssd.bo = array.base_addr;
ssd.ls = array.limit - array.base_addr;
ssd.acc1 = ((array.read_exec_only == 0) << 1) |
(array.contents << 2) |
0xf0; /* P(resent) | DPL3 | S */
ssd.acc2 = 0x4; /* byte limit, 32-bit segment */
if (sysi86(SI86DSCR, &ssd) < 0) {
perror("sysi86(SI86DSCR)");
printf("Couldn't install fs segment, expect segfault\n");
}
}
#endif

View File

@ -19,10 +19,16 @@
#include "wine/winerror.h"
#include "wine/debugtools.h"
#include "wine/module.h"
#include "win32.h"
#include <stdio.h>
#include "win32.h"
#include "registry.h"
#include "loader.h"
#include "com.h"
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <pthread.h>
#include <errno.h>
@ -39,9 +45,6 @@
#include <kstat.h>
#endif
#include "registry.h"
#include "loader.h"
#include "com.h"
char* def_path=WIN32_PATH;
@ -221,7 +224,7 @@ void* my_mreq(int size, int to_zero)
if(to_zero)
memset(heap+heap_counter, 0, size);
else
memset(heap+heap_counter, 0xcc, size); // make crash reprocable
memset(heap+heap_counter, 0xcc, size); // make crash reproducable
heap_counter+=size;
return heap+heap_counter-size;
}
@ -1945,7 +1948,33 @@ int WINAPI expWritePrivateProfileStringA(const char* appname, const char* keynam
dbgprintf(" => 0\n");
return 0;
}
int expsprintf(char* str, const char* format, ...)
{
va_list args;
int r;
dbgprintf("sprintf(%s, %s)\n", str, format);
va_start(args, format);
r = vsprintf(str, format, args);
va_end(args);
return r;
}
int expsscanf(const char* str, const char* format, ...)
{
va_list args;
int r;
dbgprintf("sscanf(%s, %s)\n", str, format);
va_start(args, format);
r = vsscanf(str, format, args);
va_end(args);
return r;
}
void* expfopen(const char* path, const char* mode)
{
//fails
printf("fopen: \"%s\" mode:%s\n", path, mode);
//return fopen(path, mode);
return 0;
}
unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, INT default_value, const char* filename)
{
return expGetPrivateProfileIntA(appname, keyname, default_value, filename);
@ -2063,6 +2092,21 @@ time_t exptime(time_t* t)
return result;
}
int exprand()
{
return rand();
}
void expsrand(int seed)
{
srand(seed);
}
int exp_ftol(float f)
{
return (int)(f+.5);
}
int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax)
{
int result=snprintf(str, cbMax, "%.8x-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
@ -2818,6 +2862,12 @@ FF(isalnum, -1)
FF(memmove, -1)
FF(memcmp, -1)
FF(time, -1)
FF(_ftol,-1)
FF(rand, -1)
FF(srand, -1)
FF(sprintf,-1)
FF(sscanf,-1)
FF(fopen,-1)
};
struct exports exp_winmm[]={
FF(GetDriverModuleHandle, -1)

View File

@ -201,6 +201,7 @@ extern LONG WINAPI explstrcpynA(char* str1, const char* str2,int len);
extern LONG WINAPI explstrcatA(char* str1, const char* str2);
extern LONG WINAPI expInterlockedExchange(long *dest, long l);
extern void* CDECL expmalloc(int size);
extern void CDECL expfree(void* mem);
extern void* CDECL expnew(int size);
@ -219,7 +220,16 @@ extern int expmemmove(void* dest, void* src, int n);
extern int expmemcmp(void* dest, void* src, int n);
extern void *expmemcpy(void* dest, void* src, int n) ;
extern time_t exptime(time_t* t);
extern int expsprintf(char* str, const char* format, ...);
extern int expsscanf(const char* str, const char* format, ...);
extern void* expfopen(const char* path, const char* mode);
extern void* LookupExternal(const char* library, int ordinal);
extern void* LookupExternalByName(const char* library, const char* name);
extern int exprand();
extern int exp_ftol(float f);
extern void WINAPI expInitCommonControls();
#endif