mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-08-04 03:07:07 -04:00
Avoid more stdlib functions with FreeType
This commit is contained in:
parent
bbda33cd5a
commit
cbaf42c886
1
.github/actions/notify_failure/action.yml
vendored
1
.github/actions/notify_failure/action.yml
vendored
@ -25,5 +25,6 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Notify failure
|
- name: Notify failure
|
||||||
shell: sh
|
shell: sh
|
||||||
|
if: ${{ inputs.WEBHOOK_URL != '' }}
|
||||||
run: |
|
run: |
|
||||||
curl ${{ inputs.WEBHOOK_URL }} -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"${{ inputs.BOT_USERNAME }}\", \"avatar_url\": \"${{ inputs.BOT_AVATAR }}\", \"content\": \"${{ inputs.NOTIFY_MESSAGE }}\" }"
|
curl ${{ inputs.WEBHOOK_URL }} -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"${{ inputs.BOT_USERNAME }}\", \"avatar_url\": \"${{ inputs.BOT_AVATAR }}\", \"content\": \"${{ inputs.NOTIFY_MESSAGE }}\" }"
|
@ -152,13 +152,13 @@ CC_API void* Mem_Realloc(void* mem, cc_uint32 numElems, cc_uint32 elemsSize, con
|
|||||||
CC_API void Mem_Free(void* mem);
|
CC_API void Mem_Free(void* mem);
|
||||||
|
|
||||||
/* Sets the contents of a block of memory to the given value. */
|
/* Sets the contents of a block of memory to the given value. */
|
||||||
void* Mem_Set(void* dst, cc_uint8 value, cc_uint32 numBytes);
|
void* Mem_Set(void* dst, cc_uint8 value, unsigned numBytes);
|
||||||
/* Copies a block of memory to another block of memory. */
|
/* Copies a block of memory to another block of memory. */
|
||||||
/* NOTE: These blocks MUST NOT overlap. */
|
/* NOTE: These blocks MUST NOT overlap. */
|
||||||
void* Mem_Copy(void* dst, const void* src, cc_uint32 numBytes);
|
void* Mem_Copy(void* dst, const void* src, unsigned numBytes);
|
||||||
/* Moves a block of memory to another block of memory. */
|
/* Moves a block of memory to another block of memory. */
|
||||||
/* NOTE: These blocks can overlap. */
|
/* NOTE: These blocks can overlap. */
|
||||||
void* Mem_Move(void* dst, const void* src, cc_uint32 numBytes);
|
void* Mem_Move(void* dst, const void* src, unsigned numBytes);
|
||||||
/* Returns non-zero if the two given blocks of memory have equal contents. */
|
/* Returns non-zero if the two given blocks of memory have equal contents. */
|
||||||
int Mem_Equal(const void* a, const void* b, cc_uint32 numBytes);
|
int Mem_Equal(const void* a, const void* b, cc_uint32 numBytes);
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ cc_bool Platform_SingleProcess;
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*---------------------------------------------------------Memory----------------------------------------------------------*
|
*---------------------------------------------------------Memory----------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void* Mem_Set(void* dst, cc_uint8 value, cc_uint32 numBytes) { return memset( dst, value, numBytes); }
|
void* Mem_Set(void* dst, cc_uint8 value, unsigned numBytes) { return memset( dst, value, numBytes); }
|
||||||
void* Mem_Copy(void* dst, const void* src, cc_uint32 numBytes) { return memcpy( dst, src, numBytes); }
|
void* Mem_Copy(void* dst, const void* src, unsigned numBytes) { return memcpy( dst, src, numBytes); }
|
||||||
void* Mem_Move(void* dst, const void* src, cc_uint32 numBytes) { return memmove(dst, src, numBytes); }
|
void* Mem_Move(void* dst, const void* src, unsigned numBytes) { return memmove(dst, src, numBytes); }
|
||||||
|
|
||||||
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
|
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
|
||||||
cc_uint32 size = CalcMemSize(numElems, elemsSize);
|
cc_uint32 size = CalcMemSize(numElems, elemsSize);
|
||||||
|
@ -43,9 +43,9 @@ cc_bool Platform_SingleProcess;
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*---------------------------------------------------------Memory----------------------------------------------------------*
|
*---------------------------------------------------------Memory----------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void* Mem_Set(void* dst, cc_uint8 value, cc_uint32 numBytes) { return memset( dst, value, numBytes); }
|
void* Mem_Set(void* dst, cc_uint8 value, unsigned numBytes) { return memset( dst, value, numBytes); }
|
||||||
void* Mem_Copy(void* dst, const void* src, cc_uint32 numBytes) { return memcpy( dst, src, numBytes); }
|
void* Mem_Copy(void* dst, const void* src, unsigned numBytes) { return memcpy( dst, src, numBytes); }
|
||||||
void* Mem_Move(void* dst, const void* src, cc_uint32 numBytes) { return memmove(dst, src, numBytes); }
|
void* Mem_Move(void* dst, const void* src, unsigned numBytes) { return memmove(dst, src, numBytes); }
|
||||||
|
|
||||||
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
|
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
|
||||||
cc_uint32 size = CalcMemSize(numElems, elemsSize);
|
cc_uint32 size = CalcMemSize(numElems, elemsSize);
|
||||||
@ -749,7 +749,6 @@ const struct UpdaterInfo Updater_Info = { "", 1, { { "Direct3D11", "cc-arm32-d3d
|
|||||||
#else
|
#else
|
||||||
const struct UpdaterInfo Updater_Info = { "&eCompile latest source code to update", 0 };
|
const struct UpdaterInfo Updater_Info = { "&eCompile latest source code to update", 0 };
|
||||||
#endif
|
#endif
|
||||||
};
|
|
||||||
|
|
||||||
cc_bool Updater_Clean(void) {
|
cc_bool Updater_Clean(void) {
|
||||||
return DeleteFile(UPDATE_TMP) || GetLastError() == ERROR_FILE_NOT_FOUND;
|
return DeleteFile(UPDATE_TMP) || GetLastError() == ERROR_FILE_NOT_FOUND;
|
||||||
|
@ -288,6 +288,45 @@ size_t cc_strlen(const char* a) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* cc_strstr(const char* str, const char* substr) {
|
||||||
|
const char* a;
|
||||||
|
const char* b;
|
||||||
|
if (!substr[0]) return (char*)str;
|
||||||
|
|
||||||
|
for (; *str; str++)
|
||||||
|
{
|
||||||
|
/* Definitely not a match */
|
||||||
|
if (*str != substr[0]) continue;
|
||||||
|
|
||||||
|
/* It's a possible match */
|
||||||
|
if (cc_strcmp(str, substr) == 0) return (char*)str;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cc_memcmp(const void* ptrA, const void* ptrB, size_t num) {
|
||||||
|
const unsigned char* a = (const unsigned char*)ptrA;
|
||||||
|
const unsigned char* b = (const unsigned char*)ptrB;
|
||||||
|
|
||||||
|
for (; num > 0; num--, a++, b++)
|
||||||
|
{
|
||||||
|
if (*a != *b) return *a - *b;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* cc_memchr(const void* ptr, int ch, size_t num) {
|
||||||
|
const char* a = (const char*)ptr;
|
||||||
|
|
||||||
|
for (; num > 0; num--, a++)
|
||||||
|
{
|
||||||
|
if (*a == ch) return a;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static FT_Library ft_lib;
|
static FT_Library ft_lib;
|
||||||
static struct FT_MemoryRec_ ft_mem;
|
static struct FT_MemoryRec_ ft_mem;
|
||||||
static struct StringsBuffer font_list;
|
static struct StringsBuffer font_list;
|
||||||
|
@ -4,9 +4,9 @@ cc_bool Platform_SingleProcess = true;
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*---------------------------------------------------------Memory----------------------------------------------------------*
|
*---------------------------------------------------------Memory----------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void* Mem_Set(void* dst, cc_uint8 value, cc_uint32 numBytes) { return memset( dst, value, numBytes); }
|
void* Mem_Set(void* dst, cc_uint8 value, unsigned numBytes) { return memset( dst, value, numBytes); }
|
||||||
void* Mem_Copy(void* dst, const void* src, cc_uint32 numBytes) { return memcpy( dst, src, numBytes); }
|
void* Mem_Copy(void* dst, const void* src, unsigned numBytes) { return memcpy( dst, src, numBytes); }
|
||||||
void* Mem_Move(void* dst, const void* src, cc_uint32 numBytes) { return memmove(dst, src, numBytes); }
|
void* Mem_Move(void* dst, const void* src, unsigned numBytes) { return memmove(dst, src, numBytes); }
|
||||||
|
|
||||||
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
|
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
|
||||||
cc_uint32 size = CalcMemSize(numElems, elemsSize);
|
cc_uint32 size = CalcMemSize(numElems, elemsSize);
|
||||||
|
@ -78,18 +78,22 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
/* ClassiCube functions to avoid stdlib */
|
/* ClassiCube functions to avoid stdlib */
|
||||||
extern int cc_strncmp(const char* a, const char* b, size_t maxCount);
|
extern int cc_strncmp(const char* a, const char* b, size_t maxCount);
|
||||||
extern int cc_strcmp( const char* a, const char* b);
|
extern int cc_strcmp(const char* a, const char* b);
|
||||||
extern size_t cc_strlen(const char* a);
|
extern size_t cc_strlen(const char* a);
|
||||||
|
extern char* cc_strstr(const char* str, const char* substr);
|
||||||
|
|
||||||
#define ft_memchr memchr
|
extern int cc_memcmp(const void* ptrA, const void* ptrB, size_t num);
|
||||||
#define ft_memcmp memcmp
|
extern void* cc_memchr(const void* ptr, int ch, size_t num);
|
||||||
|
|
||||||
|
#define ft_memchr cc_memchr
|
||||||
|
#define ft_memcmp cc_memcmp
|
||||||
#define ft_memcpy memcpy
|
#define ft_memcpy memcpy
|
||||||
#define ft_memmove memmove
|
#define ft_memmove memmove
|
||||||
#define ft_memset memset
|
#define ft_memset memset
|
||||||
#define ft_strcmp cc_strcmp
|
#define ft_strcmp cc_strcmp
|
||||||
#define ft_strlen cc_strlen
|
#define ft_strlen cc_strlen
|
||||||
#define ft_strncmp cc_strncmp
|
#define ft_strncmp cc_strncmp
|
||||||
#define ft_strstr strstr
|
#define ft_strstr cc_strstr
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user