Files
Main_MiSTer/str_util.cpp
Sam Hardeman 2b279d1488 video: HDR display/output support (BT2020 / DCI P3) (#718)
* Merge branch 'hdr' of https://github.com/wickerwaka/Main_MiSTer into feature-hdr

Merged in wickerwaka's old HDR branch and integrated the BT2020 and DCI P3 color space conversion matrices. Changed "hdr" option to be a selection of matrix instead of saturation option.

* Add HDR example to MiSTer ini
2022-12-22 02:43:15 +08:00

34 lines
664 B
C++

#include "str_util.h"
#include <string.h>
int str_tokenize(char *s, const char *delim, char **tokens, int max_tokens)
{
char *save_ptr = nullptr;
int count = 0;
char *token = strtok_r(s, delim, &save_ptr);
while (token && count < max_tokens)
{
tokens[count] = token;
count++;
token = strtok_r(nullptr, delim, &save_ptr);
}
return count;
}
char *strncpyz(char *dest, size_t dest_size, const char *src, size_t num)
{
size_t n = num >= dest_size ? dest_size - 1 : num;
strncpy(dest, src, n);
dest[n] = '\0';
return dest;
}
char *strcpyz(char *dest, size_t dest_size, const char *src)
{
return strncpyz(dest, dest_size, src, dest_size - 1);
}