From e14614a7a909f23b2edf07df136833ac5680ee73 Mon Sep 17 00:00:00 2001 From: "niko(depressedTWM)" Date: Tue, 14 Jul 2026 12:43:43 -0400 Subject: [PATCH] Replacing standart C library methods with SDL methods --- CMakeLists.txt | 4 ++-- binding-mri/audio-binding.cpp | 2 +- binding-mri/binding-mri.cpp | 10 +++++----- binding-mri/binding-types.h | 2 +- binding-mri/binding-util.cpp | 4 ++-- binding-mri/binding-util.h | 12 ++++++------ binding-mri/bitmap-binding.cpp | 2 +- binding-mri/disposable-binding.h | 2 +- binding-mri/etc-binding.cpp | 2 +- binding-mri/filesystem-binding.cpp | 2 +- binding-mri/flashable-binding.h | 2 +- binding-mri/font-binding.cpp | 2 +- binding-mri/graphics-binding.cpp | 2 +- binding-mri/input-binding.cpp | 2 +- binding-mri/journal-binding.cpp | 6 +++--- binding-mri/niko-binding.cpp | 4 ++-- binding-mri/oneshot-binding.cpp | 8 +++++--- binding-mri/plane-binding.cpp | 2 +- binding-mri/sceneelement-binding.h | 2 +- binding-mri/screen-binding.cpp | 6 +++--- binding-mri/serializable-binding.h | 2 +- binding-mri/sprite-binding.cpp | 2 +- binding-mri/table-binding.cpp | 2 +- binding-mri/tilemap-binding.cpp | 2 +- binding-mri/time-binding.cpp | 4 ++-- binding-mri/viewport-binding.cpp | 2 +- binding-mri/viewportelement-binding.h | 2 +- binding-mri/wallpaper-binding.cpp | 7 ++++--- binding-mri/window-binding.cpp | 2 +- journal/w32/journal/src/journal.c | 10 +++++----- src/al-util.h | 2 +- src/aldatasource.h | 2 +- src/alstream.cpp | 4 ++-- src/alstream.h | 2 +- src/audio.cpp | 2 +- src/audio.h | 2 +- src/audiostream.cpp | 2 +- src/audiostream.h | 2 +- src/binding.h | 2 +- src/bitmap.cpp | 12 ++++++------ src/bitmap.h | 2 +- src/boost-hash.h | 2 +- src/config.cpp | 4 ++-- src/config.h | 2 +- src/debugwriter.h | 4 ++-- src/disposable.h | 2 +- src/etc-internal.h | 2 +- src/etc.cpp | 2 +- src/etc.h | 2 +- src/eventthread.cpp | 6 +++--- src/eventthread.h | 2 +- src/exception.h | 11 ++++------- src/filesystem.cpp | 8 ++++---- src/filesystem.h | 2 +- src/flashable.h | 2 +- src/font.cpp | 2 +- src/font.h | 2 +- src/gl-debug.cpp | 2 +- src/gl-debug.h | 2 +- src/gl-fun.cpp | 4 ++-- src/gl-fun.h | 2 +- src/gl-meta.cpp | 2 +- src/gl-meta.h | 2 +- src/gl-util.h | 2 +- src/global-ibo.h | 2 +- src/glstate.cpp | 2 +- src/glstate.h | 2 +- src/graphics.cpp | 2 +- src/graphics.h | 2 +- src/i18n.cpp | 8 ++++---- src/input.cpp | 2 +- src/input.h | 2 +- src/intrulist.h | 2 +- src/keybindings.cpp | 2 +- src/keybindings.h | 2 +- src/main.cpp | 4 ++-- src/meow.cpp | 8 ++++---- src/modloader.cpp | 2 +- src/oneshot.cpp | 10 +++++----- src/pipe.h | 2 +- src/plane.cpp | 8 ++++---- src/plane.h | 2 +- src/quad.h | 2 +- src/quadarray.h | 2 +- src/rgssad.cpp | 11 +++++------ src/rgssad.h | 2 +- src/scene.cpp | 2 +- src/scene.h | 6 +++--- src/screen.cpp | 2 +- src/sdl-util.h | 2 +- src/sdlsoundsource.cpp | 2 +- src/serial-util.h | 10 +++++----- src/serializable.h | 2 +- src/shader.cpp | 14 +++++++------- src/shader.h | 2 +- src/sharedstate.cpp | 2 +- src/sharedstate.h | 2 +- src/soundemitter.cpp | 4 ++-- src/soundemitter.h | 2 +- src/sprite.cpp | 2 +- src/sprite.h | 2 +- src/table.cpp | 2 +- src/table.h | 2 +- src/texpool.cpp | 2 +- src/texpool.h | 2 +- src/tileatlas.cpp | 2 +- src/tileatlas.h | 2 +- src/tilemap-common.h | 2 +- src/tilemap.cpp | 2 +- src/tilemap.h | 2 +- src/tilequad.cpp | 2 +- src/tilequad.h | 2 +- src/transform.h | 6 +++--- src/util.h | 2 +- src/vertex.cpp | 2 +- src/vertex.h | 2 +- src/viewport.cpp | 2 +- src/viewport.h | 2 +- src/vorbissource.cpp | 12 ++++++------ src/window.cpp | 2 +- src/window.h | 2 +- src/xdg-user-dir-lookup.c | 6 +++--- steamshim/steamshim_child.c | 20 ++++++++++---------- steamshim_parent/steamshim_parent.cpp | 26 +++++++++++++------------- 124 files changed, 230 insertions(+), 231 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11dbe05..4b446b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,7 +81,7 @@ set(MAIN_HEADERS src/define.h src/signals/signal.h src/signals/signalconnection.h - src/signals/rubyDispatcher.h + src/signals/rubydispatcher.h ) set(MAIN_SOURCE @@ -128,7 +128,7 @@ set(MAIN_SOURCE src/modloader.cpp src/sunshine.cpp src/lightmap.cpp - src/signals/rubyDispatcher.cpp + src/signals/rubydispatcher.cpp ) if(WIN32) diff --git a/binding-mri/audio-binding.cpp b/binding-mri/audio-binding.cpp index 1de027b..541600b 100644 --- a/binding-mri/audio-binding.cpp +++ b/binding-mri/audio-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 6ceeaa0..23f53e0 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -248,7 +248,7 @@ RB_METHOD(mkxpRawKeyStates){ RB_UNUSED_PARAM; VALUE str = rb_str_new(0, sizeof(EventThread::keyStates)); - memcpy(RSTRING_PTR(str), EventThread::keyStates, sizeof(EventThread::keyStates)); + SDL_memcpy(RSTRING_PTR(str), EventThread::keyStates, sizeof(EventThread::keyStates)); return str; } @@ -468,7 +468,7 @@ static void runRMXPScripts(BacktraceData &btData){ char buf[512]; int len; - len = snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName); + len = SDL_snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName); fname = newStringUTF8(buf, len); btData.scriptNames.insert(buf, scriptName); @@ -505,7 +505,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){ char line[16]; std::string file(512, '\0'); - char *p = s + strlen(s); + char *p = s + SDL_strlen(s); char *e; while (p != s) @@ -535,7 +535,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){ *e = ':'; /* Shrink to fit */ - file.resize(strlen(file.c_str())); + file.resize(SDL_strlen(file.c_str())); file = btData.scriptNames.value(file, file); crash(Exception::MEOW, "Script '%s' line %s: %s occured.\n\n%s", file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg)); diff --git a/binding-mri/binding-types.h b/binding-mri/binding-types.h index 1f0b3ae..ac809c8 100644 --- a/binding-mri/binding-types.h +++ b/binding-mri/binding-types.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/binding-util.cpp b/binding-mri/binding-util.cpp index 38a7d9e..568b897 100644 --- a/binding-mri/binding-util.cpp +++ b/binding-mri/binding-util.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -85,7 +85,7 @@ void raiseDisposedAccess(VALUE self){ char buf[32]; strncpy(buf, klassName, sizeof(buf)); - buf[0] = tolower(buf[0]); + buf[0] = SDL_tolower(buf[0]); rb_raise(getRbData()->exc[RGSS], "disposed %s", buf); } diff --git a/binding-mri/binding-util.h b/binding-mri/binding-util.h index b450934..c56d1ac 100644 --- a/binding-mri/binding-util.h +++ b/binding-mri/binding-util.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -24,7 +24,7 @@ #include //костыль ебаный сука -#undef snprintf +#undef SDL_snprintf #undef inline #include "exception.h" @@ -167,14 +167,14 @@ static inline void _rb_define_module_function(VALUE module, const char *name, Ru rb_define_module_function(module, name, RUBY_METHOD_FUNC(func), -1); } -#define GUARD_EXC(exp) \ -{ try { exp } catch (const Exception &exc) { raiseRbExc(exc); } } +#define GUARD_EXC(SDL_exp) \ +{ try { SDL_exp } catch (const Exception &exc) { raiseRbExc(exc); } } -#define GFX_GUARD_EXC(exp) \ +#define GFX_GUARD_EXC(SDL_exp) \ {\ GFX_LOCK; \ try {\ - exp \ + SDL_exp \ } catch (const Exception &exc) {\ GFX_UNLOCK; \ raiseRbExc(exc); \ diff --git a/binding-mri/bitmap-binding.cpp b/binding-mri/bitmap-binding.cpp index 58ef3e1..64a32ad 100644 --- a/binding-mri/bitmap-binding.cpp +++ b/binding-mri/bitmap-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/disposable-binding.h b/binding-mri/disposable-binding.h index eae1dc0..0c8a0f8 100644 --- a/binding-mri/disposable-binding.h +++ b/binding-mri/disposable-binding.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/etc-binding.cpp b/binding-mri/etc-binding.cpp index c33d8c2..d5b1071 100644 --- a/binding-mri/etc-binding.cpp +++ b/binding-mri/etc-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index a78ae35..d42ae2f 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/flashable-binding.h b/binding-mri/flashable-binding.h index 2121a13..7d475e0 100644 --- a/binding-mri/flashable-binding.h +++ b/binding-mri/flashable-binding.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/font-binding.cpp b/binding-mri/font-binding.cpp index 8ad5d23..14f59c0 100644 --- a/binding-mri/font-binding.cpp +++ b/binding-mri/font-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index 7d60359..364e302 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/input-binding.cpp b/binding-mri/input-binding.cpp index 27feece..0f5fd8f 100644 --- a/binding-mri/input-binding.cpp +++ b/binding-mri/input-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/journal-binding.cpp b/binding-mri/journal-binding.cpp index 2e2a40f..0f84e1a 100644 --- a/binding-mri/journal-binding.cpp +++ b/binding-mri/journal-binding.cpp @@ -94,14 +94,14 @@ RB_METHOD(journalSet){ rb_get_args(argc, argv, "z", &name RB_ARG_END); // Record message SDL_LockMutex(mutex); - message_len = strlen(name); + message_len = SDL_strlen(name); strcpy((char*)message_buffer, name); if (message_len > 0) { // in the case where journal is being sent empty string // do not append the language suffix, because empty string // is the signifier to terminate the journal strcpy((char*)message_buffer + message_len, (char*)lang_buffer); - message_len += strlen((char*)lang_buffer); + message_len += SDL_strlen((char*)lang_buffer); } SDL_UnlockMutex(mutex); @@ -162,7 +162,7 @@ RB_METHOD(journalActive){ void journalBindingInit(){ mutex = SDL_CreateMutex(); - memset((char*)lang_buffer, 0, BUFFER_SIZE); + SDL_memset((char*)lang_buffer, 0, BUFFER_SIZE); lang_buffer[0] = '_'; #if defined __linux mkfifo(PIPE_PATH.c_str(), 0666); diff --git a/binding-mri/niko-binding.cpp b/binding-mri/niko-binding.cpp index f5c1b99..ec8e169 100644 --- a/binding-mri/niko-binding.cpp +++ b/binding-mri/niko-binding.cpp @@ -155,7 +155,7 @@ RB_METHOD(nikoStart){ wcscat(path, L"\\_______.exe"); wsprintfW(args, L"_______.exe %d %d", pos.x, pos.y); STARTUPINFOW si; - memset(&si, 0, sizeof(si)); + SDL_memset(&si, 0, sizeof(si)); si.cb = sizeof(si); PROCESS_INFORMATION pi; CreateProcessW(path, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); @@ -169,7 +169,7 @@ RB_METHOD(nikoStart){ sprintf(message, "%d,%d\n", x, y); SDL_LockMutex(mutex); - message_len = strlen(message); + message_len = SDL_strlen(message); strcpy((char*)message_buffer, message); SDL_UnlockMutex(mutex); diff --git a/binding-mri/oneshot-binding.cpp b/binding-mri/oneshot-binding.cpp index 5133899..acf5f6b 100644 --- a/binding-mri/oneshot-binding.cpp +++ b/binding-mri/oneshot-binding.cpp @@ -6,7 +6,9 @@ #include "eventthread.h" #include +#include #include +#include RB_METHOD(oneshotSetYesNo){ RB_UNUSED_PARAM; @@ -71,11 +73,11 @@ RB_METHOD(oneshotShake){ int absx, absy; SDL_GetWindowPosition(shState->rtData().window, &absx, &absy); int state; - srand(time(NULL)); + SDL_srand(time(NULL)); for (int i = 0; i < 60; ++i) { int max = 60 - i; - int x = rand() % (max * 2) - max; - int y = rand() % (max * 2) - max; + int x = SDL_rand(RAND_MAX) % (max * 2) - max; + int y = SDL_rand(RAND_MAX) % (max * 2) - max; SDL_SetWindowPosition(shState->rtData().window, absx + x, absy + y); rb_eval_string_protect("sleep 0.02", &state); } diff --git a/binding-mri/plane-binding.cpp b/binding-mri/plane-binding.cpp index adc909e..52257ba 100644 --- a/binding-mri/plane-binding.cpp +++ b/binding-mri/plane-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/sceneelement-binding.h b/binding-mri/sceneelement-binding.h index 3f7bd45..d7da722 100644 --- a/binding-mri/sceneelement-binding.h +++ b/binding-mri/sceneelement-binding.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/screen-binding.cpp b/binding-mri/screen-binding.cpp index a0bd630..92c2551 100644 --- a/binding-mri/screen-binding.cpp +++ b/binding-mri/screen-binding.cpp @@ -18,12 +18,12 @@ static void start(){ MultiByteToWideChar(CP_UTF8, 0, shState->config().gameFolder.c_str(), -1, gameFolder, MAX_PATH); GetModuleFileNameW(NULL, path, MAX_PATH); STARTUPINFOW si; - memset(&si, 0, sizeof(si)); + SDL_memset(&si, 0, sizeof(si)); si.cb = sizeof(si); PROCESS_INFORMATION pi; std::wstring argString = std::wstring(L"oneshot.exe \"--gameFolder=") + gameFolder + L"\" --screenMode=true"; WCHAR *args = new WCHAR[argString.size() + 1]; - memcpy(args, argString.c_str(), (argString.size() + 1) * sizeof(WCHAR)); + SDL_memcpy(args, argString.c_str(), (argString.size() + 1) * sizeof(WCHAR)); CreateProcessW(path, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); delete [] args; #else @@ -66,7 +66,7 @@ RB_METHOD(screenSet){ rb_get_args(argc, argv, "z", &imageName RB_ARG_END); if (!ipc.isOpen()) start(); - ipc.write(imageName, strlen(imageName) + 1); + ipc.write(imageName, SDL_strlen(imageName) + 1); return Qnil; } diff --git a/binding-mri/serializable-binding.h b/binding-mri/serializable-binding.h index 0631624..7f877bb 100644 --- a/binding-mri/serializable-binding.h +++ b/binding-mri/serializable-binding.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/sprite-binding.cpp b/binding-mri/sprite-binding.cpp index 7c53441..c8e8eef 100644 --- a/binding-mri/sprite-binding.cpp +++ b/binding-mri/sprite-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/table-binding.cpp b/binding-mri/table-binding.cpp index 1560515..ebbb0d9 100644 --- a/binding-mri/table-binding.cpp +++ b/binding-mri/table-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/tilemap-binding.cpp b/binding-mri/tilemap-binding.cpp index 74b0d00..3b44cd4 100644 --- a/binding-mri/tilemap-binding.cpp +++ b/binding-mri/tilemap-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/time-binding.cpp b/binding-mri/time-binding.cpp index 9bdeb81..453e43e 100644 --- a/binding-mri/time-binding.cpp +++ b/binding-mri/time-binding.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include static VALUE get_month(VALUE self) { time_t now = time(NULL); @@ -24,7 +24,7 @@ static VALUE ctime_at(int argc, VALUE *argv, VALUE self){ if (TYPE(v_sec) == T_FLOAT || rb_obj_is_kind_of(v_sec, rb_cFloat)) { dsec = NUM2DBL(v_sec); - sec = (long long) floor(dsec); + sec = (long long) SDL_floor(dsec); double frac = dsec - (double)sec; nsec = (long) llround(frac * 1e9); if (nsec >= 1000000000L) { sec += 1; nsec -= 1000000000L; } diff --git a/binding-mri/viewport-binding.cpp b/binding-mri/viewport-binding.cpp index d694d85..4d2aa84 100644 --- a/binding-mri/viewport-binding.cpp +++ b/binding-mri/viewport-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/viewportelement-binding.h b/binding-mri/viewportelement-binding.h index 6fe145d..40b4947 100644 --- a/binding-mri/viewportelement-binding.h +++ b/binding-mri/viewportelement-binding.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/binding-mri/wallpaper-binding.cpp b/binding-mri/wallpaper-binding.cpp index b0fc54b..37ecc91 100644 --- a/binding-mri/wallpaper-binding.cpp +++ b/binding-mri/wallpaper-binding.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "etc.h" #include "sharedstate.h" #include "binding-util.h" @@ -71,7 +72,7 @@ return; } if (desktop == "lxde"){ - const char* homeC = std::getenv("HOME"); + const char* homeC = SDL_getenv("HOME"); if (!homeC) return; std::string home(homeC); std::string path = home + "/.config/pcmanfm/LXDE/desktop-items-0.conf"; @@ -146,7 +147,7 @@ } } else if (desktop == "kde") { std::ifstream configFile; - configFile.open(std::string(getenv("HOME")) + "/.config/plasma-org.kde.plasma.desktop-appletsrc", std::ios::in); + configFile.open(std::string(SDL_getenv("HOME")) + "/.config/plasma-org.kde.plasma.desktop-appletsrc", std::ios::in); if (configFile.is_open()) { std::string line; std::vector sections; @@ -211,7 +212,7 @@ desktop = "kde_error"; } } else { - fallbackPath = std::string(getenv("HOME")) + "/Desktop/ONESHOT_hint.png"; + fallbackPath = std::string(SDL_getenv("HOME")) + "/Desktop/ONESHOT_hint.png"; } } #endif diff --git a/binding-mri/window-binding.cpp b/binding-mri/window-binding.cpp index a8cf07e..e29c40f 100644 --- a/binding-mri/window-binding.cpp +++ b/binding-mri/window-binding.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/journal/w32/journal/src/journal.c b/journal/w32/journal/src/journal.c index 79163ef..6451484 100644 --- a/journal/w32/journal/src/journal.c +++ b/journal/w32/journal/src/journal.c @@ -34,7 +34,7 @@ static void loadImage(const char *name) { } // handle default as a special case, since we'll keep that image internally - if (strcmp(name, "default") == 0) { + if (SDL_strcmp(name, "default") == 0) { image_handle = LoadBitmapA(GetModuleHandleW(NULL), "default"); } else { @@ -46,7 +46,7 @@ static void loadImage(const char *name) { char* langCode = 0; char* emptyString = "\0"; strcpy(imageName, name); - langCode = strchr(imageName, '_'); + langCode = SDL_strchr(imageName, '_'); if (langCode > 0) { // replace the code with 0 to null terminate the image name where this is // then use the rest of the string as the language code @@ -169,8 +169,8 @@ void init_check_save(WCHAR* save_path) { fread(langbuf, 1, 16, savefile); fclose(savefile); - openbrace = strchr(langbuf, '['); - closebrace = strchr(langbuf, ']'); + openbrace = SDL_strchr(langbuf, '['); + closebrace = SDL_strchr(langbuf, ']'); if (openbrace && closebrace && openbrace < closebrace) { //we very probably have a language code here. //so, lets do some hacky string manipulation to @@ -189,7 +189,7 @@ void init_check_save(WCHAR* save_path) { // so we need a gamepath, which should be saved in the registry boolean readGamePath() { // clear data path - memset(&DataPath[0], 0, sizeof(DataPath)); + SDL_memset(&DataPath[0], 0, sizeof(DataPath)); DWORD dataPathSize = sizeof(DataPath); HKEY key; diff --git a/src/al-util.h b/src/al-util.h index 50cec6b..8d8ffb2 100644 --- a/src/al-util.h +++ b/src/al-util.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/aldatasource.h b/src/aldatasource.h index 597bb2f..d396764 100644 --- a/src/aldatasource.h +++ b/src/aldatasource.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/alstream.cpp b/src/alstream.cpp index 51008f6..c7f82e3 100644 --- a/src/alstream.cpp +++ b/src/alstream.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -200,7 +200,7 @@ struct ALStreamOpenHandler : FileSystem::OpenHandler{ SDL_SeekIO(srcOps, 0, SDL_IO_SEEK_SET); try{ - if (!strcmp(sig, "OggS")){ + if (!SDL_strcmp(sig, "OggS")){ source = createVorbisSource(*srcOps, looped); return true; } diff --git a/src/alstream.h b/src/alstream.h index 696118a..9b28e08 100644 --- a/src/alstream.h +++ b/src/alstream.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/audio.cpp b/src/audio.cpp index c2a6437..3d1e0ca 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/audio.h b/src/audio.h index 6d4f4d2..22790e8 100644 --- a/src/audio.h +++ b/src/audio.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/audiostream.cpp b/src/audiostream.cpp index 7c946fe..f3da554 100644 --- a/src/audiostream.cpp +++ b/src/audiostream.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/audiostream.h b/src/audiostream.h index f95c23a..1904cf8 100644 --- a/src/audiostream.h +++ b/src/audiostream.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/binding.h b/src/binding.h index 1c09ed5..de8dd92 100644 --- a/src/binding.h +++ b/src/binding.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/bitmap.cpp b/src/bitmap.cpp index b1184dc..614e657 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -960,9 +960,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align){ SDL_Surface *txtSurf; if (shState->rtData().config.solidFonts) - txtSurf = TTF_RenderText_Solid(font, str, strlen(str), c); + txtSurf = TTF_RenderText_Solid(font, str, SDL_strlen(str), c); else - txtSurf = TTF_RenderText_Blended(font, str, strlen(str), c); + txtSurf = TTF_RenderText_Blended(font, str, SDL_strlen(str), c); p->ensureFormat(txtSurf, SDL_PIXELFORMAT_ABGR8888); @@ -980,9 +980,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align){ /* set the next font render to render the outline */ TTF_SetFontOutline(font, OUTLINE_SIZE); if (shState->rtData().config.solidFonts) - outline = TTF_RenderText_Solid(font, str, strlen(str), co); + outline = TTF_RenderText_Solid(font, str, SDL_strlen(str), co); else - outline = TTF_RenderText_Blended(font, str, strlen(str), co); + outline = TTF_RenderText_Blended(font, str, SDL_strlen(str), co); p->ensureFormat(outline, SDL_PIXELFORMAT_ABGR8888); SDL_Rect outRect = {OUTLINE_SIZE, OUTLINE_SIZE, txtSurf->w, txtSurf->h}; @@ -1182,7 +1182,7 @@ IntRect Bitmap::textSize(const char *str){ str = fixed.c_str(); // i don't know if its right migration, i didn't find any other way - TTF_Text* text = TTF_CreateText(NULL, font, str, strlen(str)); + TTF_Text* text = TTF_CreateText(NULL, font, str, SDL_strlen(str)); int w, h; TTF_GetTextSize(text, &w, &h); diff --git a/src/bitmap.h b/src/bitmap.h index 02f2dff..c2495f1 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/boost-hash.h b/src/boost-hash.h index 244ad9d..d057fc7 100644 --- a/src/boost-hash.h +++ b/src/boost-hash.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/config.cpp b/src/config.cpp index a9e04a3..a0db3ea 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -97,7 +97,7 @@ void Config::read(int argc, char *argv[]){ PO_DESC(pancakes, bool, false) // Not gonna take your shit boost -#define GUARD_ALL( exp ) try { exp } catch(...) {} +#define GUARD_ALL( SDL_exp ) try { SDL_exp } catch(...) {} editor.debug = false; editor.battleTest = false; diff --git a/src/config.h b/src/config.h index df7d244..5a0a131 100644 --- a/src/config.h +++ b/src/config.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/debugwriter.h b/src/debugwriter.h index 1825e6d..42b8055 100644 --- a/src/debugwriter.h +++ b/src/debugwriter.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -27,7 +27,7 @@ #include #ifdef __ANDROID__ - #include + #include #elif __EMSCRIPTEN__ #include #endif diff --git a/src/disposable.h b/src/disposable.h index 3874095..22d9029 100644 --- a/src/disposable.h +++ b/src/disposable.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/etc-internal.h b/src/etc-internal.h index af56ee3..cb22ed0 100644 --- a/src/etc-internal.h +++ b/src/etc-internal.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/etc.cpp b/src/etc.cpp index 127457b..f30a998 100644 --- a/src/etc.cpp +++ b/src/etc.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/etc.h b/src/etc.h index 4efaffc..c6b87df 100644 --- a/src/etc.h +++ b/src/etc.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/eventthread.cpp b/src/eventthread.cpp index da1ec12..544c40e 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -61,7 +61,7 @@ struct ALCFunctions{ } static alc; static void initALCFunctions(ALCdevice *alcDev){ - if (!strstr(alcGetString(alcDev, ALC_EXTENSIONS), "ALC_SOFT_pause_device")) + if (!SDL_strstr(alcGetString(alcDev, ALC_EXTENSIONS), "ALC_SOFT_pause_device")) return; Debug() << "ALC_SOFT_pause_device present"; @@ -605,7 +605,7 @@ void EventThread::showMessageBox(const char *body, int flags){ SDL_Event event; event.user.code = flags; - event.user.data1 = strdup(body); + event.user.data1 = SDL_strdup(body); event.type = usrIdStart + REQUEST_MESSAGEBOX; SDL_PushEvent(&event); diff --git a/src/eventthread.h b/src/eventthread.h index 33cc36e..a804d91 100644 --- a/src/eventthread.h +++ b/src/eventthread.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/exception.h b/src/exception.h index 5ed6a8f..8dc979e 100644 --- a/src/exception.h +++ b/src/exception.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -22,9 +22,8 @@ #ifndef EXCEPTION_H #define EXCEPTION_H +#include #include -#include -#include struct Exception{ enum Type{ @@ -51,14 +50,12 @@ struct Exception{ Type type; std::string msg; - Exception(Type type, const char *format, ...) - : type(type) - { + Exception(Type type, const char *format, ...) : type(type){ va_list ap; va_start(ap, format); msg.resize(512); - vsnprintf(&msg[0], msg.size(), format, ap); + SDL_vsnprintf(&msg[0], msg.size(), format, ap); va_end(ap); } diff --git a/src/filesystem.cpp b/src/filesystem.cpp index a3a8fd2..e656fe1 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -255,7 +255,7 @@ static void initReadOps(PHYSFS_File *handle, SDL_IOStream* &ops){ static void strTolower(std::string &str){ for (size_t i = 0; i < str.size(); ++i) - str[i] = tolower(str[i]); + str[i] = SDL_tolower(str[i]); } // const Uint32 SDL_RWOPS_PHYSFS = SDL_RWOPS_UNKNOWN+10; @@ -416,7 +416,7 @@ static PHYSFS_EnumerateCallbackResult fontSetEnumCB (void *data, const char *dir size_t i; for (i = 0; i < sizeof(lowExt)-1 && ext[i]; ++i) - lowExt[i] = tolower(ext[i]); + lowExt[i] = SDL_tolower(ext[i]); lowExt[i] = '\0'; if (SDL_strcmp(lowExt, "ttf") && SDL_strcmp(lowExt, "otf") && SDL_strcmp(lowExt, "ttc")) @@ -536,7 +536,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){ if (p->havePathCache) for (size_t i = 0; i < len; ++i) - buffer[i] = tolower(buffer[i]); + buffer[i] = SDL_tolower(buffer[i]); /* Find the deliminator separating directory and file name */ for (delim = buffer + len; delim > buffer; --delim) diff --git a/src/filesystem.h b/src/filesystem.h index 66f461e..6619902 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/flashable.h b/src/flashable.h index 78a95a8..4d17c08 100644 --- a/src/flashable.h +++ b/src/flashable.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/font.cpp b/src/font.cpp index 8cc1f4b..0de1bee 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/font.h b/src/font.h index b0ad63c..8fd1438 100644 --- a/src/font.h +++ b/src/font.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/gl-debug.cpp b/src/gl-debug.cpp index aa1dfe3..8cdd284 100644 --- a/src/gl-debug.cpp +++ b/src/gl-debug.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/gl-debug.h b/src/gl-debug.h index 04d2e9a..f8aeffc 100644 --- a/src/gl-debug.h +++ b/src/gl-debug.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/gl-fun.cpp b/src/gl-fun.cpp index bbee0b6..e28ab0a 100644 --- a/src/gl-fun.cpp +++ b/src/gl-fun.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -80,7 +80,7 @@ void initGLFunctions(){ bool gles = false; - if (!strncmp(ver, glesPrefix, glesPrefixN)){ + if (!SDL_strncmp(ver, glesPrefix, glesPrefixN)){ gles = true; gl.glsles = true; diff --git a/src/gl-fun.h b/src/gl-fun.h index a13a9fc..c548985 100644 --- a/src/gl-fun.h +++ b/src/gl-fun.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/gl-meta.cpp b/src/gl-meta.cpp index fc6ea6b..7198eac 100644 --- a/src/gl-meta.cpp +++ b/src/gl-meta.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/gl-meta.h b/src/gl-meta.h index 6f9e264..9070b04 100644 --- a/src/gl-meta.h +++ b/src/gl-meta.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/gl-util.h b/src/gl-util.h index 112799c..685b181 100644 --- a/src/gl-util.h +++ b/src/gl-util.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/global-ibo.h b/src/global-ibo.h index b2d4a46..e1c0046 100644 --- a/src/global-ibo.h +++ b/src/global-ibo.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/glstate.cpp b/src/glstate.cpp index a206b08..56a84f7 100644 --- a/src/glstate.cpp +++ b/src/glstate.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/glstate.h b/src/glstate.h index 43f5894..6a95826 100644 --- a/src/glstate.h +++ b/src/glstate.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/graphics.cpp b/src/graphics.cpp index b4bb164..e0d1e14 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/graphics.h b/src/graphics.h index 2e18885..1d2842c 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/i18n.cpp b/src/i18n.cpp index 1315f3c..276c5aa 100644 --- a/src/i18n.cpp +++ b/src/i18n.cpp @@ -70,7 +70,7 @@ void loadLanguageMetadata() { // char line[256]; char line[1024]; - languageMetadata = (LanguageFontAndSize**) calloc(MAX_LANGUAGES, sizeof(LanguageFontAndSize*)); + languageMetadata = (LanguageFontAndSize**) SDL_calloc(MAX_LANGUAGES, sizeof(LanguageFontAndSize*)); FILE* fontsFile = fopen("Languages/internal/language_fonts.ini", "r"); if (fontsFile) { @@ -125,12 +125,12 @@ void loadLanguageMetadata() { char* indexOfFontSize = indexOfEquals + 1; // remove new line from end of font size - char* indexOfNewLine = strchr(indexOfFontSize, '\n'); + char* indexOfNewLine = SDL_strchr(indexOfFontSize, '\n'); if (indexOfNewLine) { indexOfNewLine[0] = 0; } - int fontSize = atoi(indexOfFontSize); + int fontSize = SDL_atoi(indexOfFontSize); for (int i = 0; i < MAX_LANGUAGES; i++) { // search for corresponding langCode in metadata array to populate font size in the appropriate metadata @@ -201,7 +201,7 @@ void loadLocale(const char* locale) { int lineLen = SDL_strlen(lineWithoutMsgid); - strdict[nStr] = (char*)malloc(lineLen + 1); + strdict[nStr] = (char*)SDL_malloc(lineLen + 1); SDL_strlcpy(strdict[nStr], lineWithoutMsgid, sizeof(lineWithoutMsgid)); nStr++; diff --git a/src/input.cpp b/src/input.cpp index 0a01349..8778a7f 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/input.h b/src/input.h index ad3a675..031922a 100644 --- a/src/input.h +++ b/src/input.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/intrulist.h b/src/intrulist.h index 09b59f8..bf3c29b 100644 --- a/src/intrulist.h +++ b/src/intrulist.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/keybindings.cpp b/src/keybindings.cpp index a220f1f..02d5287 100644 --- a/src/keybindings.cpp +++ b/src/keybindings.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/keybindings.h b/src/keybindings.h index 9225a5f..0d1681f 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/main.cpp b/src/main.cpp index 22d17ac..45fe320 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -204,7 +204,7 @@ static void setGamePathInRegistry() { WarnMsg("Unable to open registry."); } else { - DWORD dataSize = (strlen(dataDir) + 1) * sizeof(char); + DWORD dataSize = (SDL_strlen(dataDir) + 1) * sizeof(char); if (RegSetValueEx(key, TEXT("GameDirectory"), 0, REG_SZ, (LPBYTE)dataDir, dataSize) != ERROR_SUCCESS){ WarnMsg("Unable to set GameDirectory registry value"); } diff --git a/src/meow.cpp b/src/meow.cpp index a5ce310..484831b 100644 --- a/src/meow.cpp +++ b/src/meow.cpp @@ -55,7 +55,7 @@ void crash(Exception::Type t, const char *fmt, ...){ char *buf = (char*)SDL_malloc((size_t)len + 1); SDL_vsnprintf(buf, (size_t)len + 1, fmt, args); va_end(args); - SDL_snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash log? You can share the crash log with the developers and help resolve the issue.", buf); + SDL_snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash SDL_log? You can share the crash SDL_log with the developers and help resolve the issue.", buf); SDL_MessageBoxData messageboxdata = { .flags = SDL_MESSAGEBOX_ERROR, .window = NULL, @@ -111,8 +111,8 @@ void crash(Exception::Type t, const char *fmt, ...){ }catch(const std::exception& e){ o << "Detected OS: " << e.what() << std::endl; } - if(!getenv("XDG_CURRENT_DESKTOP") == NULL){ - o << "Desktop enviroment(XDG_CURRENT_DESKTOP): " << getenv("XDG_CURRENT_DESKTOP") << std::endl; + if(!SDL_getenv("XDG_CURRENT_DESKTOP") == NULL){ + o << "Desktop enviroment(XDG_CURRENT_DESKTOP): " << SDL_getenv("XDG_CURRENT_DESKTOP") << std::endl; } #ifdef __ANDROID__ o << "Android API version: " << android_get_device_api_level() << std::endl; @@ -130,7 +130,7 @@ void crash(Exception::Type t, const char *fmt, ...){ o << "Emscripten start address of the stack: " << emscripten_stack_get_base() << std::endl; o << "Emscripten end address of the stack: " << emscripten_stack_get_end() << std::endl; o << "Emscripten current stack pointer: " << emscripten_stack_get_current() << std::endl; - o << "Emscripten number of free bytes left on stack: " << emscripten_stack_get_free() << std::endl; + o << "Emscripten number of SDL_free bytes left on stack: " << emscripten_stack_get_free() << std::endl; #elif __PSP__ o << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl; #endif diff --git a/src/modloader.cpp b/src/modloader.cpp index c7fda45..fd3889c 100644 --- a/src/modloader.cpp +++ b/src/modloader.cpp @@ -92,7 +92,7 @@ std::string sha256_file(const std::string &fn) { out.reserve(SHA256_DIGEST_LENGTH * 2); char hex[3] = {0}; for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) { - snprintf(hex, sizeof hex, "%02x", hash[i]); + SDL_snprintf(hex, sizeof hex, "%02x", hash[i]); out += hex; } return out; diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 1ad6df7..238c3c6 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -239,8 +239,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData) p->journal = "_______.exe"; #else // Get language code - const char *lc_all = getenv("LC_ALL"); - const char *lang = getenv("LANG"); + const char *lc_all = SDL_getenv("LC_ALL"); + const char *lang = SDL_getenv("LANG"); const char *code = (lc_all ? lc_all : lang); if (code) { @@ -277,7 +277,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData) // Get documents path #ifdef __APPLE__ - std::string path = std::string(getenv("HOME")) + "/Documents"; + std::string path = std::string(SDL_getenv("HOME")) + "/Documents"; p->docsPath = path.c_str(); p->gamePath = path.c_str(); p->journal = "_______.app"; @@ -293,7 +293,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData) Debug() << "[oneshot] Docs path :" << p->docsPath; #ifdef unix_like - char const *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP"); + char const *xdg_current_desktop = SDL_getenv("XDG_CURRENT_DESKTOP"); gtk_init(0, 0); if (xdg_current_desktop == NULL) @@ -303,7 +303,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : threadData(threadData) else { std::string desktop(xdg_current_desktop); - std::transform(desktop.begin(), desktop.end(), desktop.begin(), ::tolower); + std::transform(desktop.begin(), desktop.end(), desktop.begin(), ::SDL_tolower); if (desktop.find("cinnamon") != std::string::npos) { desktopEnv = "cinnamon"; diff --git a/src/pipe.h b/src/pipe.h index 1d679e1..c52e007 100644 --- a/src/pipe.h +++ b/src/pipe.h @@ -95,7 +95,7 @@ public: { #ifdef _WIN32 OVERLAPPED overlapped; - memset(&overlapped, 0, sizeof(overlapped)); + SDL_memset(&overlapped, 0, sizeof(overlapped)); if (!ReadFile(handle, buf, 1, NULL, &overlapped)){ if (GetLastError() == ERROR_IO_PENDING) CancelIo(handle); diff --git a/src/plane.cpp b/src/plane.cpp index d21769e..047cf09 100644 --- a/src/plane.cpp +++ b/src/plane.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -39,7 +39,7 @@ #include "signals/signal.h" static float fwrap(float value, float range){ - float res = fmod(value, range); + float res = SDL_fmod(value, range); return res < 0 ? res + range : res; } @@ -133,8 +133,8 @@ struct PlanePrivate{ int vph = sceneGeo.rect.h; /* Amount the scaled bitmap is tiled (repeated) */ - size_t tilesX = ceil((vpw - sw + wox) / sw) + 1; - size_t tilesY = ceil((vph - sh + woy) / sh) + 1; + size_t tilesX = SDL_ceil((vpw - sw + wox) / sw) + 1; + size_t tilesY = SDL_ceil((vph - sh + woy) / sh) + 1; FloatRect tex = srcRect->toFloatRect(); diff --git a/src/plane.h b/src/plane.h index 4b1f951..1e63dc4 100644 --- a/src/plane.h +++ b/src/plane.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/quad.h b/src/quad.h index 79208ba..689223d 100644 --- a/src/quad.h +++ b/src/quad.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/quadarray.h b/src/quadarray.h index 628fc73..c05eb37 100644 --- a/src/quadarray.h +++ b/src/quadarray.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/rgssad.cpp b/src/rgssad.cpp index f708373..247512e 100644 --- a/src/rgssad.cpp +++ b/src/rgssad.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -22,8 +22,7 @@ #include "rgssad.h" #include "boost-hash.h" -#include -#include +#include struct RGSS_entryData{ int64_t offset; @@ -143,7 +142,7 @@ static PHYSFS_sint64 RGSS_ioRead(PHYSFS_Io *self, void *buffer, PHYSFS_uint64 le /* Shift them back to normal */ dword >>= 8 * (offs % 4); - memcpy(bBufferP, &dword, preAlign); + SDL_memcpy(bBufferP, &dword, preAlign); bBufferP += preAlign; @@ -173,7 +172,7 @@ static PHYSFS_sint64 RGSS_ioRead(PHYSFS_Io *self, void *buffer, PHYSFS_uint64 le /* Bytes are already aligned with magic */ dword ^= entry->currentMagic; - memcpy(bBufferP, &dword, postAlign); + SDL_memcpy(bBufferP, &dword, postAlign); } entry->currentOffset += toRead; @@ -291,7 +290,7 @@ static bool verifyHeader(PHYSFS_Io *io, char version){ if (!IO_READ(io, header, sizeof(header))) return false; - if (strcmp(header, RGSS_HEADER)) + if (SDL_strcmp(header, RGSS_HEADER)) return false; if (header[7] != version) diff --git a/src/rgssad.h b/src/rgssad.h index 96f9695..08bd95e 100644 --- a/src/rgssad.h +++ b/src/rgssad.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/scene.cpp b/src/scene.cpp index a1b61aa..3d83327 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/scene.h b/src/scene.h index 2530c61..dc890d2 100644 --- a/src/scene.h +++ b/src/scene.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -93,7 +93,7 @@ protected: /* A bit about OpenGL state: * * If we're not inside the draw cycle (ie. the 'draw()' - * handle), you're free to change any GL state through + * handle), you're SDL_free to change any GL state through * gl-util, except for those in GLState which you should * push/pop as needed. * @@ -101,7 +101,7 @@ protected: * things in GLState. For scissored rendering, use push with * setIntersect(), and then pop afterwards. * Blendmode you can push/pop as you like. Do NOT touch viewport. - * Texture/Shader bindings you're free to modify without + * Texture/Shader bindings you're SDL_free to modify without * cleanup (and therefore you should expect dirty state). * Do NOT touch the FBO::Draw binding. If you have to do work * immediately before drawing that touches this (such as flushing diff --git a/src/screen.cpp b/src/screen.cpp index 6b2f983..974761c 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -56,7 +56,7 @@ int screenMain(Config &conf){ // Change shape if (readMessage(ipc, messageBuf, sizeof(messageBuf))) { - if (strcmp(messageBuf, "END") == 0) + if (SDL_strcmp(messageBuf, "END") == 0) break; std::string imgname = conf.gameFolder + "/Journal/" + messageBuf + ".png"; SDL_DestroySurface(shape); diff --git a/src/sdl-util.h b/src/sdl-util.h index e53ddff..08d61f5 100644 --- a/src/sdl-util.h +++ b/src/sdl-util.h @@ -101,7 +101,7 @@ private: char *start = base; if (eback() == base){ - memmove(base, egptr() - pbSize, pbSize); + SDL_memmove(base, egptr() - pbSize, pbSize); start += pbSize; } //size_t SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size); diff --git a/src/sdlsoundsource.cpp b/src/sdlsoundsource.cpp index 0e67e23..5cf5c4f 100644 --- a/src/sdlsoundsource.cpp +++ b/src/sdlsoundsource.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/serial-util.h b/src/serial-util.h index 00e9f2c..87e6537 100644 --- a/src/serial-util.h +++ b/src/serial-util.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -34,7 +34,7 @@ static inline int32_t readInt32(const char **dataP){ int32_t result; - memcpy(&result, *dataP, 4); + SDL_memcpy(&result, *dataP, 4); *dataP += 4; return result; @@ -43,19 +43,19 @@ static inline int32_t readInt32(const char **dataP){ static inline double readDouble(const char **dataP){ double result; - memcpy(&result, *dataP, 8); + SDL_memcpy(&result, *dataP, 8); *dataP += 8; return result; } static inline void writeInt32(char **dataP, int32_t value){ - memcpy(*dataP, &value, 4); + SDL_memcpy(*dataP, &value, 4); *dataP += 4; } static inline void writeDouble(char **dataP, double value){ - memcpy(*dataP, &value, 8); + SDL_memcpy(*dataP, &value, 8); *dataP += 8; } diff --git a/src/serializable.h b/src/serializable.h index 7ec4f10..d63fbe0 100644 --- a/src/serializable.h +++ b/src/serializable.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/shader.cpp b/src/shader.cpp index 4c352e6..7c34b66 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -72,20 +72,20 @@ static void printShaderLog(GLuint shader){ GLint logLength; gl.GetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength); - std::string log(logLength, '\0'); - gl.GetShaderInfoLog(shader, log.size(), 0, &log[0]); + std::string SDL_log(logLength, '\0'); + gl.GetShaderInfoLog(shader, SDL_log.size(), 0, &SDL_log[0]); - Debug() << "Shader log:\n" << log; + Debug() << "Shader SDL_log:\n" << SDL_log; } static void printProgramLog(GLuint program){ GLint logLength; gl.GetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength); - std::string log(logLength, '\0'); - gl.GetProgramInfoLog(program, log.size(), 0, &log[0]); + std::string SDL_log(logLength, '\0'); + gl.GetProgramInfoLog(program, SDL_log.size(), 0, &SDL_log[0]); - Debug() << "Program log:\n" << log; + Debug() << "Program SDL_log:\n" << SDL_log; } Shader::Shader(){ diff --git a/src/shader.h b/src/shader.h index 666d703..4b40b96 100644 --- a/src/shader.h +++ b/src/shader.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp index 7c96227..538723f 100644 --- a/src/sharedstate.cpp +++ b/src/sharedstate.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/sharedstate.h b/src/sharedstate.h index 9a46670..f4f2605 100644 --- a/src/sharedstate.h +++ b/src/sharedstate.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/soundemitter.cpp b/src/soundemitter.cpp index 811a2e0..382dc93 100644 --- a/src/soundemitter.cpp +++ b/src/soundemitter.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -119,7 +119,7 @@ void SoundEmitter::play(const std::string &filename, int volume, int pitch) { if (!buffer) return; - /* Try to find first free source */ + /* Try to find first SDL_free source */ size_t i; for (i = 0; i < srcCount; ++i) if (AL::Source::getState(alSrcs[srcPrio[i]]) != AL_PLAYING) diff --git a/src/soundemitter.h b/src/soundemitter.h index b11da6c..738629d 100644 --- a/src/soundemitter.h +++ b/src/soundemitter.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/sprite.cpp b/src/sprite.cpp index ea02b89..dfd353f 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/sprite.h b/src/sprite.h index 12cab0a..08d9918 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/table.cpp b/src/table.cpp index 5d1d9c0..54b680a 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/table.h b/src/table.h index c94303c..9dd975b 100644 --- a/src/table.h +++ b/src/table.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/texpool.cpp b/src/texpool.cpp index a6e481f..94ca0ea 100644 --- a/src/texpool.cpp +++ b/src/texpool.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/texpool.h b/src/texpool.h index 001aa44..edb23e7 100644 --- a/src/texpool.h +++ b/src/texpool.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/tileatlas.cpp b/src/tileatlas.cpp index ff73043..db8931c 100644 --- a/src/tileatlas.cpp +++ b/src/tileatlas.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/tileatlas.h b/src/tileatlas.h index 5a7f097..a351c91 100644 --- a/src/tileatlas.h +++ b/src/tileatlas.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/tilemap-common.h b/src/tilemap-common.h index b4a5a5b..4a35074 100644 --- a/src/tilemap-common.h +++ b/src/tilemap-common.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/tilemap.cpp b/src/tilemap.cpp index 2618bb6..d44676d 100644 --- a/src/tilemap.cpp +++ b/src/tilemap.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/tilemap.h b/src/tilemap.h index 1c565de..bc829f2 100644 --- a/src/tilemap.h +++ b/src/tilemap.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/tilequad.cpp b/src/tilequad.cpp index c9d2429..d5816d0 100644 --- a/src/tilequad.cpp +++ b/src/tilequad.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/tilequad.h b/src/tilequad.h index b35b7d2..d95bbae 100644 --- a/src/tilequad.h +++ b/src/tilequad.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/transform.h b/src/transform.h index 9d55a80..ee6ed29 100644 --- a/src/transform.h +++ b/src/transform.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -115,12 +115,12 @@ public: private: void updateMatrix(){ if (rotation >= 360 || rotation < -360) - rotation = (float) fmod(rotation, 360); + rotation = (float) SDL_fmod(rotation, 360); if (rotation < 0) rotation += 360; float angle = rotation * 3.141592654f / 180.0f; - float cosine = (float) cos(angle); + float cosine = (float) SDL_cos(angle); float sine = (float) sin(angle); float sxc = scale.x * cosine; float syc = scale.y * cosine; diff --git a/src/util.h b/src/util.h index 5c74c80..8da1845 100644 --- a/src/util.h +++ b/src/util.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/vertex.cpp b/src/vertex.cpp index d816fc9..4ee8e00 100644 --- a/src/vertex.cpp +++ b/src/vertex.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/vertex.h b/src/vertex.h index e08b04b..73560ff 100644 --- a/src/vertex.h +++ b/src/vertex.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/viewport.cpp b/src/viewport.cpp index d2fcce8..0ab4119 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/viewport.h b/src/viewport.h index 4365574..557dcd6 100644 --- a/src/viewport.h +++ b/src/viewport.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/vorbissource.cpp b/src/vorbissource.cpp index 1b2b1f9..956ee6f 100644 --- a/src/vorbissource.cpp +++ b/src/vorbissource.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2014 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. @@ -107,7 +107,7 @@ struct VorbisSource : ALDataSource{ /* Try to extract loop info */ for (int i = 0; i < vf.vc->comments; ++i){ char *comment = vf.vc->user_comments[i]; - char *sep = strstr(comment, "="); + char *sep = SDL_strstr(comment, "="); /* No '=' found */ if (!sep) @@ -119,11 +119,11 @@ struct VorbisSource : ALDataSource{ *sep = '\0'; - if (!strcmp(comment, "LOOPSTART")) - loop.start = strtol(sep+1, 0, 10); + if (!SDL_strcmp(comment, "LOOPSTART")) + loop.start = SDL_strtol(sep+1, 0, 10); - if (!strcmp(comment, "LOOPLENGTH")) - loop.length = strtol(sep+1, 0, 10); + if (!SDL_strcmp(comment, "LOOPLENGTH")) + loop.length = SDL_strtol(sep+1, 0, 10); *sep = '='; } diff --git a/src/window.cpp b/src/window.cpp index f58d3f2..240ec7d 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/window.h b/src/window.h index cedf7b9..8b1bdff 100644 --- a/src/window.h +++ b/src/window.h @@ -5,7 +5,7 @@ ** ** Copyright (C) 2013 Jonas Kulla ** -** mkxp is free software: you can redistribute it and/or modify +** mkxp is SDL_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. diff --git a/src/xdg-user-dir-lookup.c b/src/xdg-user-dir-lookup.c index 88b7b2d..572d60a 100644 --- a/src/xdg-user-dir-lookup.c +++ b/src/xdg-user-dir-lookup.c @@ -4,7 +4,7 @@ Copyright (c) 2007 Red Hat, Inc. - Permission is hereby granted, free of charge, to any person + Permission is hereby granted, SDL_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, @@ -43,7 +43,7 @@ * type the value returned is @fallback. * * The return value is newly allocated and must be freed with - * free(). The return value is never NULL if @fallback != NULL, unless + * SDL_free(). The return value is never NULL if @fallback != NULL, unless * out of memory. **/ char * xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback) { @@ -178,7 +178,7 @@ error2: * to ~/Desktop. * * The return value is newly allocated and must be freed with - * free(). + * SDL_free(). **/ char *xdg_user_dir_lookup (const char *type){ char *dir, *home_dir, *user_dir; diff --git a/steamshim/steamshim_child.c b/steamshim/steamshim_child.c index 89432f1..cbe52d1 100644 --- a/steamshim/steamshim_child.c +++ b/steamshim/steamshim_child.c @@ -96,8 +96,8 @@ static void closePipe(PipeType fd){ } /* closePipe */ static char *getEnvVar(const char *key, char *buf, const size_t buflen){ - const char *envr = getenv(key); - if (!envr || (strlen(envr) >= buflen)) + const char *envr = SDL_getenv(key); + if (!envr || (SDL_strlen(envr) >= buflen)) return NULL; strcpy(buf, envr); return buf; @@ -145,11 +145,11 @@ static int initPipes(void){ if (!getEnvVar("STEAMSHIM_READHANDLE", buf, sizeof (buf))) return 0; - GPipeRead = (PipeType) strtoull(buf, 0, 10); + GPipeRead = (PipeType) SDL_strtoull(buf, 0, 10); if (!getEnvVar("STEAMSHIM_WRITEHANDLE", buf, sizeof (buf))) return 0; - GPipeWrite = (PipeType) strtoull(buf, 0, 10); + GPipeWrite = (PipeType) SDL_strtoull(buf, 0, 10); return ((GPipeRead != NULLPIPE) && (GPipeWrite != NULLPIPE)); } /* initPipes */ @@ -204,7 +204,7 @@ static const STEAMSHIM_Event *processEvent(const uint8 *buf, size_t buflen){ const STEAMSHIM_EventType type = (STEAMSHIM_EventType) *(buf++); buflen--; - memset(&event, '\0', sizeof (event)); + SDL_memset(&event, '\0', sizeof (event)); event.type = type; event.okay = 1; @@ -316,7 +316,7 @@ const STEAMSHIM_Event *STEAMSHIM_pump(void){ const STEAMSHIM_Event *retval = processEvent(buf+1, evlen); br -= evlen + 1; if (br > 0) - memmove(buf, buf+evlen+1, br); + SDL_memmove(buf, buf+evlen+1, br); return retval; } /* if */ @@ -349,7 +349,7 @@ void STEAMSHIM_setAchievement(const char *name, const int enable){ *(ptr++) = (uint8) SHIMCMD_SETACHIEVEMENT; *(ptr++) = enable ? 1 : 0; strcpy((char *) ptr, name); - ptr += strlen(name) + 1; + ptr += SDL_strlen(name) + 1; buf[0] = (uint8) ((ptr-1) - buf); writePipe(GPipeWrite, buf, buf[0] + 1); } /* STEAMSHIM_setAchievement */ @@ -361,7 +361,7 @@ void STEAMSHIM_getAchievement(const char *name){ dbgpipe("Child sending SHIMCMD_GETACHIEVEMENT('%s').\n", name); *(ptr++) = (uint8) SHIMCMD_GETACHIEVEMENT; strcpy((char *) ptr, name); - ptr += strlen(name) + 1; + ptr += SDL_strlen(name) + 1; buf[0] = (uint8) ((ptr-1) - buf); writePipe(GPipeWrite, buf, buf[0] + 1); } /* STEAMSHIM_getAchievement */ @@ -379,11 +379,11 @@ static void writeStatThing(const ShimCmd cmd, const char *name, const void *val, *(ptr++) = (uint8) cmd; if (vallen) { - memcpy(ptr, val, vallen); + SDL_memcpy(ptr, val, vallen); ptr += vallen; } /* if */ strcpy((char *) ptr, name); - ptr += strlen(name) + 1; + ptr += SDL_strlen(name) + 1; buf[0] = (uint8) ((ptr-1) - buf); writePipe(GPipeWrite, buf, buf[0] + 1); } /* writeStatThing */ diff --git a/steamshim_parent/steamshim_parent.cpp b/steamshim_parent/steamshim_parent.cpp index d32d747..506909e 100644 --- a/steamshim_parent/steamshim_parent.cpp +++ b/steamshim_parent/steamshim_parent.cpp @@ -130,15 +130,15 @@ static LPWSTR genCommandLine(){ // Create the new string // (`".\.exe" ` == +9 - LPWSTR newcmdline = (LPWSTR)malloc(sizeof(TEXT(GAME_LAUNCH_NAME)) - + sizeof(WCHAR) * (wcslen(cmdline) - iFirstArg + 9)); + LPWSTR newcmdline = (LPWSTR)SDL_malloc(sizeof(TEXT(GAME_LAUNCH_NAME)) + + sizeof(WCHAR) * (SDL_wcslen(cmdline) - iFirstArg + 9)); wsprintf(newcmdline, TEXT("\".\\" GAME_LAUNCH_NAME ".exe\" %s"), cmdline + iFirstArg); return newcmdline; } static bool launchChild(ProcessType *pid){ STARTUPINFOW si; - memset(&si, 0, sizeof(si)); + SDL_memset(&si, 0, sizeof(si)); return CreateProcessW(TEXT(".\\" GAME_LAUNCH_NAME ".exe"), genCommandLine(), NULL, NULL, TRUE, 0, NULL, NULL, &si, pid); @@ -221,7 +221,7 @@ static bool launchChild(ProcessType *pid){ return true; // we'll let the pipe fail if this didn't work. // we're the child. - GArgv[0] = strdup("./" GAME_LAUNCH_NAME); + GArgv[0] = SDL_strdup("./" GAME_LAUNCH_NAME); dbgpipe("Starting %s\n", GArgv[0]); execvp(GArgv[0], GArgv); // still here? It failed! Terminate, closing child's ends of the pipes. @@ -320,7 +320,7 @@ static bool write3ByteCmd(PipeType fd, const uint8 b1, const uint8 b2, const uin static bool writeString(PipeType fd, ShimEvent event, const char *str){ uint8 buf[256]; - buf[0] = strlen(str) + 2; + buf[0] = SDL_strlen(str) + 2; buf[1] = (uint8) event; strcpy((char *) buf + 2, str); return writePipe(fd, buf, buf[0] + 1); @@ -349,7 +349,7 @@ static bool writeAchievementSet(PipeType fd, const char *name, const bool enable *(ptr++) = enable ? 1 : 0; *(ptr++) = okay ? 1 : 0; strcpy((char *) ptr, name); - ptr += strlen(name) + 1; + ptr += SDL_strlen(name) + 1; buf[0] = (uint8) ((ptr-1) - buf); return writePipe(fd, buf, buf[0] + 1); } // writeAchievementSet @@ -360,10 +360,10 @@ static bool writeAchievementGet(PipeType fd, const char *name, const int status, dbgpipe("Parent sending SHIMEVENT_GETACHIEVEMENT('%s', status %d, time " LLUFMT ").\n", name, status, (unsigned long long) time); *(ptr++) = (uint8) SHIMEVENT_GETACHIEVEMENT; *(ptr++) = (uint8) status; - memcpy(ptr, &time, sizeof (time)); + SDL_memcpy(ptr, &time, sizeof (time)); ptr += sizeof (time); strcpy((char *) ptr, name); - ptr += strlen(name) + 1; + ptr += SDL_strlen(name) + 1; buf[0] = (uint8) ((ptr-1) - buf); return writePipe(fd, buf, buf[0] + 1); } // writeAchievementGet @@ -378,10 +378,10 @@ static bool writeStatThing(PipeType fd, const ShimEvent ev, const char *name, co uint8 *ptr = buf+1; *(ptr++) = (uint8) ev; *(ptr++) = okay ? 1 : 0; - memcpy(ptr, val, vallen); + SDL_memcpy(ptr, val, vallen); ptr += vallen; strcpy((char *) ptr, name); - ptr += strlen(name) + 1; + ptr += SDL_strlen(name) + 1; buf[0] = (uint8) ((ptr-1) - buf); return writePipe(fd, buf, buf[0] + 1); } // writeStatThing @@ -581,7 +581,7 @@ static void processCommands(PipeType pipeParentRead, PipeType pipeParentWrite){ br -= cmdlen + 1; if (br > 0) - memmove(buf, buf+cmdlen+1, br); + SDL_memmove(buf, buf+cmdlen+1, br); } // if else // get more data. { @@ -598,11 +598,11 @@ static void processCommands(PipeType pipeParentRead, PipeType pipeParentWrite){ static bool setEnvironmentVars(PipeType pipeChildRead, PipeType pipeChildWrite){ char buf[64]; - snprintf(buf, sizeof (buf), LLUFMT, (unsigned long long) pipeChildRead); + SDL_snprintf(buf, sizeof (buf), LLUFMT, (unsigned long long) pipeChildRead); if (!setEnvVar("STEAMSHIM_READHANDLE", buf)) return false; - snprintf(buf, sizeof (buf), LLUFMT, (unsigned long long) pipeChildWrite); + SDL_snprintf(buf, sizeof (buf), LLUFMT, (unsigned long long) pipeChildWrite); if (!setEnvVar("STEAMSHIM_WRITEHANDLE", buf)) return false;