mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 15:52:25 +00:00
24be34f1e9
Some of the code, especially the dshow and windows codec loader parts, are extremely hacky and likely full of bugs. The goal is merely getting rid of warnings that could obscure more important warnings and actual bugs, instead of fixing actual problems. This reduces the number of warnings from over 500 to almost the same as when compiling on Linux. Note that many problems stem from using the ancient wine-derived windows headers. There are some differences to the "proper" windows header. Changing the code to compile with the proper headers would be too much trouble, and it still has to work on Unix. Some of the changes might actually break compilation on legacy MinGW, but we don't support that anymore. Always use MinGW-w64, even when compiling to 32 bit. Fixes some warnings in the win32 loader code on Linux too.
44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
/*
|
|
* setenv implementation for systems lacking it.
|
|
*
|
|
* This file is part of MPlayer.
|
|
*
|
|
* MPlayer is free software; you can redistribute it and/or 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.
|
|
*
|
|
* MPlayer 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.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <assert.h>
|
|
|
|
int setenv(const char *name, const char *val, int overwrite);
|
|
|
|
int setenv(const char *name, const char *val, int overwrite)
|
|
{
|
|
int len = strlen(name) + strlen(val) + 2;
|
|
char *env = malloc(len);
|
|
if (!env) { return -1; }
|
|
|
|
assert(overwrite != 0);
|
|
|
|
strcpy(env, name);
|
|
strcat(env, "=");
|
|
strcat(env, val);
|
|
putenv(env);
|
|
|
|
return 0;
|
|
}
|