Browse Source

(API Change) Unsquish libobs/util

Changed:                      To:
-----------------------------------------------------------
dstr_isempty                  dstr_is_empty
cf_lexer_gettokens            cf_lexer_get_tokens
cf_preprocessor_gettokens     cf_preprocessor_get_tokens
jp9000 11 years ago
parent
commit
9d300685ca

+ 1 - 1
libobs-d3d11/d3d11-shaderprocessor.cpp

@@ -197,7 +197,7 @@ void ShaderProcessor::BuildSamplers(vector<ShaderSampler> &samplers)
 void ShaderProcessor::BuildString(string &outputString)
 {
 	stringstream output;
-	cf_token *token = cf_preprocessor_gettokens(&parser.cfp.pp);
+	cf_token *token = cf_preprocessor_get_tokens(&parser.cfp.pp);
 	while (token->type != CFTOKEN_NONE) {
 		/* cheaply just replace specific tokens */
 		if (strref_cmp(&token->str, "POSITION") == 0)

+ 1 - 1
libobs-opengl/gl-shaderparser.c

@@ -515,7 +515,7 @@ static void gl_write_main_storage_assign(struct gl_shader_parser *glsp,
 
 		dstr_free(&src_copy);
 	} else {
-		if (!dstr_isempty(&dst_copy))
+		if (!dstr_is_empty(&dst_copy))
 			dstr_cat_dstr(&glsp->gl_string, &dst_copy);
 		dstr_cat(&glsp->gl_string, " = ");
 		if (src)

+ 2 - 2
libobs/graphics/effect-parser.c

@@ -1165,7 +1165,7 @@ static void ep_write_main_params(struct effect_parser *ep,
 		struct ep_func *func)
 {
 	size_t i;
-	bool empty_params = dstr_isempty(param_str);
+	bool empty_params = dstr_is_empty(param_str);
 
 	for (i = 0; i < func->param_vars.num; i++) {
 		struct ep_var *var = func->param_vars.array+i;
@@ -1188,7 +1188,7 @@ static void ep_write_main_params(struct effect_parser *ep,
 				dstr_cat(shader, var->mapping);
 			}
 
-			if (!dstr_isempty(param_str))
+			if (!dstr_is_empty(param_str))
 				dstr_cat(param_str, ", ");
 			dstr_cat(param_str, var->name);
 		}

+ 2 - 2
libobs/obs-module.c

@@ -134,7 +134,7 @@ char *obs_find_module_file(obs_module_t module, const char *file)
 		return NULL;
 
 	dstr_copy(&output, module->data_path);
-	if (!dstr_isempty(&output) && dstr_end(&output) != '/')
+	if (!dstr_is_empty(&output) && dstr_end(&output) != '/')
 		dstr_cat_ch(&output, '/');
 	dstr_cat(&output, file);
 
@@ -292,7 +292,7 @@ static void find_modules_in_path(struct obs_module_path *omp,
 		search_directories = true;
 	}
 
-	if (!dstr_isempty(&search_path) && dstr_end(&search_path) != '/')
+	if (!dstr_is_empty(&search_path) && dstr_end(&search_path) != '/')
 		dstr_cat_ch(&search_path, '/');
 
 	dstr_cat_ch(&search_path, '*');

+ 3 - 3
libobs/util/cf-lexer.c

@@ -621,7 +621,7 @@ static void cf_include_file(struct cf_preprocessor *pp,
 		struct cf_lexer *dep = pp->dependencies.array+i;
 
 		if (strcmp(dep->file, str_file.array) == 0) {
-			tokens = cf_lexer_gettokens(dep);
+			tokens = cf_lexer_get_tokens(dep);
 			cf_preprocess_tokens(pp, false, &tokens);
 			goto exit;
 		}
@@ -639,7 +639,7 @@ static void cf_include_file(struct cf_preprocessor *pp,
 
 	cf_lexer_init(&new_lex);
 	cf_lexer_lex(&new_lex, file_data, str_file.array);
-	tokens = cf_lexer_gettokens(&new_lex);
+	tokens = cf_lexer_get_tokens(&new_lex);
 	cf_preprocess_tokens(pp, false, &tokens);
 	bfree(file_data);
 
@@ -1267,7 +1267,7 @@ void cf_preprocessor_free(struct cf_preprocessor *pp)
 bool cf_preprocess(struct cf_preprocessor *pp, struct cf_lexer *lex,
 		struct error_data *ed)
 {
-	struct cf_token *token = cf_lexer_gettokens(lex);
+	struct cf_token *token = cf_lexer_get_tokens(lex);
 	if (!token)
 		return false;
 

+ 2 - 2
libobs/util/cf-lexer.h

@@ -93,7 +93,7 @@ struct cf_lexer {
 EXPORT void cf_lexer_init(struct cf_lexer *lex);
 EXPORT void cf_lexer_free(struct cf_lexer *lex);
 
-static inline struct cf_token *cf_lexer_gettokens(struct cf_lexer *lex)
+static inline struct cf_token *cf_lexer_get_tokens(struct cf_lexer *lex)
 {
 	return lex->tokens.array;
 }
@@ -195,7 +195,7 @@ EXPORT void cf_preprocessor_add_def(struct cf_preprocessor *pp,
 EXPORT void cf_preprocessor_remove_def(struct cf_preprocessor *pp,
 		const char *def_name);
 
-static inline struct cf_token *cf_preprocessor_gettokens(
+static inline struct cf_token *cf_preprocessor_get_tokens(
 		struct cf_preprocessor *pp)
 {
 	return pp->tokens.array;

+ 1 - 1
libobs/util/cf-parser.h

@@ -72,7 +72,7 @@ static inline bool cf_parser_parse(struct cf_parser *parser,
 	if (!cf_preprocess(&parser->pp, &parser->lex, &parser->error_list))
 		return false;
 
-	parser->cur_token = cf_preprocessor_gettokens(&parser->pp);
+	parser->cur_token = cf_preprocessor_get_tokens(&parser->pp);
 	return true;
 }
 

+ 1 - 1
libobs/util/dstr.c

@@ -528,7 +528,7 @@ void dstr_replace(struct dstr *str, const char *find,
 	size_t find_len, replace_len;
 	char *temp;
 
-	if (dstr_isempty(str))
+	if (dstr_is_empty(str))
 		return;
 
 	if (!replace)

+ 3 - 3
libobs/util/dstr.h

@@ -80,7 +80,7 @@ EXPORT void dstr_ncopy_dstr(struct dstr *dst, const struct dstr *src,
 static inline void dstr_resize(struct dstr *dst, const size_t num);
 static inline void dstr_reserve(struct dstr *dst, const size_t num);
 
-static inline bool dstr_isempty(const struct dstr *str);
+static inline bool dstr_is_empty(const struct dstr *str);
 
 static inline void dstr_cat(struct dstr *dst, const char *array);
 EXPORT void dstr_cat_dstr(struct dstr *dst, const struct dstr *str);
@@ -249,7 +249,7 @@ static inline void dstr_resize(struct dstr *dst, const size_t num)
 	dst->len = num;
 }
 
-static inline bool dstr_isempty(const struct dstr *str)
+static inline bool dstr_is_empty(const struct dstr *str)
 {
 	if (!str->array || !str->len)
 		return true;
@@ -310,7 +310,7 @@ static inline int dstr_ncmpi(const struct dstr *str1, const char *str2,
 
 static inline char dstr_end(const struct dstr *str)
 {
-	if (dstr_isempty(str))
+	if (dstr_is_empty(str))
 		return 0;
 
 	return str->array[str->len - 1];

+ 2 - 1
libobs/util/text-lookup.c

@@ -70,7 +70,8 @@ static struct text_node *text_node_bychar(struct text_node *node, char ch)
 	struct text_node *subnode = node->first_subnode;
 
 	while (subnode) {
-		if (!dstr_isempty(&subnode->str) && subnode->str.array[0] == ch)
+		if (!dstr_is_empty(&subnode->str) &&
+		    subnode->str.array[0] == ch)
 			return subnode;
 
 		subnode = subnode->next;

+ 3 - 3
plugins/obs-outputs/rtmp-stream.c

@@ -166,7 +166,7 @@ static inline void set_rtmp_str(AVal *val, const char *str)
 
 static inline void set_rtmp_dstr(AVal *val, struct dstr *str)
 {
-	bool valid  = !dstr_isempty(str);
+	bool valid  = !dstr_is_empty(str);
 	val->av_val = valid ? str->array    : NULL;
 	val->av_len = valid ? (int)str->len : 0;
 }
@@ -359,12 +359,12 @@ static int init_send(struct rtmp_stream *stream)
 
 static int try_connect(struct rtmp_stream *stream)
 {
-	if (dstr_isempty(&stream->path)) {
+	if (dstr_is_empty(&stream->path)) {
 		warn("URL is empty");
 		return OBS_OUTPUT_BAD_PATH;
 	}
 
-	if (dstr_isempty(&stream->key)) {
+	if (dstr_is_empty(&stream->key)) {
 		warn("Stream key is empty");
 		return OBS_OUTPUT_BAD_PATH;
 	}

+ 1 - 1
plugins/win-dshow/win-dshow.cpp

@@ -206,7 +206,7 @@ static bool DecodeDeviceId(DeviceId &out, const char *device_id)
 	BPtr<wchar_t> wname = dstr_to_wcs(name);
 	out.name = wname;
 
-	if (!dstr_isempty(path)) {
+	if (!dstr_is_empty(path)) {
 		BPtr<wchar_t> wpath = dstr_to_wcs(path);
 		out.path = wpath;
 	}