mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-18 09:45:45 +01:00
Compare commits
2 Commits
114a7d4ea5
...
5c57a77ad4
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c57a77ad4 | |||
| bdf4d7b22b |
@@ -7,7 +7,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "../util/compat/endian.h"
|
||||
#include "../util/types.h"
|
||||
#include "../util/intdef.h"
|
||||
|
||||
int nbt_primsize(u8 tag) {
|
||||
switch (tag) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "../util/atrb.h"
|
||||
#include "../util/compat/endian.h"
|
||||
#include "../util/types.h"
|
||||
#include "../util/intdef.h"
|
||||
|
||||
/* NBT (named binary tag) is a tree data structure. Tags have a numeric type ID, name and a payload.
|
||||
* NBT files are a compressed `compound` tag. GZip is the compression used in most cases,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../error.h"
|
||||
#include "../util/types.h"
|
||||
#include "../util/intdef.h"
|
||||
#include "shader.h"
|
||||
|
||||
#define VERTC 3
|
||||
|
||||
@@ -57,13 +57,3 @@
|
||||
#define NONNULL(...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define atrb_deprecated DEPRECATED
|
||||
#define atrb_used USED
|
||||
#define atrb_unused UNUSED
|
||||
#define atrb_pure PURE
|
||||
#define atrb_const CONST
|
||||
#define atrb_noreturn NORET
|
||||
#define atrb_malloc MALLOC
|
||||
#define atrb_format FORMAT
|
||||
#define atrb_nonnull NONNULL
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
#include "../error.h"
|
||||
#include "atrb.h"
|
||||
#include "types.h"
|
||||
#include "intdef.h"
|
||||
|
||||
int conf_procbuf(char const *restrict buf, char *restrict kout, char *restrict vout, size_t len) {
|
||||
int conf_procbuf(const char *restrict buf, char *restrict kout, char *restrict vout, size_t len) {
|
||||
bool feq = false; // whether we've found the equal sign
|
||||
|
||||
// data traversal
|
||||
@@ -53,7 +53,7 @@ int conf_procbuf(char const *restrict buf, char *restrict kout, char *restrict v
|
||||
return (pos == kout) ? CONF_ENODAT : (!feq ? CONF_ESYNTAX : 0);
|
||||
}
|
||||
|
||||
struct conf_entry const *conf_matchopt(struct conf_entry const *opts, size_t optc, char const *restrict key) {
|
||||
struct conf_entry const *conf_matchopt(struct conf_entry const *opts, size_t optc, const char *restrict key) {
|
||||
// find a match for the current key
|
||||
size_t i = 0;
|
||||
for (; i < optc; i++) {
|
||||
@@ -63,7 +63,7 @@ struct conf_entry const *conf_matchopt(struct conf_entry const *opts, size_t opt
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int conf_procval(struct conf_entry const *opt, char const *restrict val) {
|
||||
int conf_procval(struct conf_entry const *opt, const char *restrict val) {
|
||||
// parse the data
|
||||
errno = 0;
|
||||
char *end;
|
||||
@@ -127,7 +127,8 @@ int conf_procval(struct conf_entry const *opt, char const *restrict val) {
|
||||
}
|
||||
|
||||
/* utility function for conf_getpat to concatenate 3 strings, where we already know the size */
|
||||
atrb_nonnull(1, 3) static char *conf_getpat_concat(char const *restrict s1, char const *restrict s2, char const *restrict s3, size_t s1len, size_t s2len, size_t s3len) {
|
||||
NONNULL(1, 3)
|
||||
static char *conf_getpat_concat(const char *restrict s1, const char *restrict s2, const char *restrict s3, size_t s1len, size_t s2len, size_t s3len) {
|
||||
assert(s2 || (!s2 && !s2len)); // ensuring the programmer passes both s2 and s2len as 0, if they intend to
|
||||
char *buf, *ptr;
|
||||
|
||||
@@ -146,7 +147,7 @@ atrb_nonnull(1, 3) static char *conf_getpat_concat(char const *restrict s1, char
|
||||
}
|
||||
|
||||
/* appends str to the config directory string we acquire from environment variables. */
|
||||
char *conf_getpat(char const *restrict str) {
|
||||
char *conf_getpat(const char *restrict str) {
|
||||
char *buf = NULL;
|
||||
size_t len;
|
||||
size_t str_len = strlen(str);
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "atrb.h"
|
||||
#include "intdef.h"
|
||||
|
||||
/* error codes */
|
||||
enum conf_err {
|
||||
@@ -43,7 +43,7 @@ struct conf_fstr {
|
||||
struct conf_entry {
|
||||
const char *key; // the key of this entry
|
||||
void *out; // the pointer to which the data is written value is read if the given option is incorrect or missing
|
||||
uint8_t type; // the primitive type which we are querying for
|
||||
u8 type; // the primitive type which we are querying for
|
||||
};
|
||||
|
||||
/* processes an incoming buffer.
|
||||
@@ -67,4 +67,4 @@ int conf_procval(struct conf_entry const *opts, const char *restrict val);
|
||||
* - windows: reads %APPDATA%, if empty %USERPROFILE%\AppData\Roaming is used, if both are empty NULL is returned.
|
||||
* - osx: reads $HOME, uses $HOME/Library/Application Support, if $HOME is empty NULL is returned.
|
||||
* !! A malloc'd null-terminated string is returned !! */
|
||||
atrb_malloc atrb_nonnull(1) char *conf_getpat(const char *);
|
||||
MALLOC NONNULL((1)) char *conf_getpat(const char *);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
intdef.h
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include "intdef.h"
|
||||
|
||||
#if defined(__has_attribute) && __has_attribute(vector_size)
|
||||
typedef float fvec2 __attribute__((vector_size(sizeof(float) * 2))); // SMID vector for 2 `float`
|
||||
|
||||
Reference in New Issue
Block a user