mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
win-capture: Improve reading from get-graphics-offsets
Increase the buffer size to read the response in one call if possible, and cause an error condition with log message if the offsets string is empty.
This commit is contained in:
@@ -161,7 +161,7 @@ bool load_graphics_offsets(bool is32bit, const char *config_path)
|
||||
struct dstr str = {0};
|
||||
os_process_pipe_t *pp;
|
||||
bool success = false;
|
||||
char data[128];
|
||||
char data[2048];
|
||||
|
||||
#ifndef _WIN64
|
||||
if (!is32bit && !is_64_bit_windows()) {
|
||||
@@ -181,13 +181,19 @@ bool load_graphics_offsets(bool is32bit, const char *config_path)
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
size_t len = os_process_pipe_read(pp, (uint8_t*)data, 128);
|
||||
size_t len = os_process_pipe_read(pp, (uint8_t*)data, sizeof(data));
|
||||
if (!len)
|
||||
break;
|
||||
|
||||
dstr_ncat(&str, data, len);
|
||||
}
|
||||
|
||||
if (dstr_is_empty(&str)) {
|
||||
blog(LOG_INFO, "load_graphics_offsets: Failed to read "
|
||||
"from '%s'", offset_exe.array);
|
||||
goto error;
|
||||
}
|
||||
|
||||
dstr_copy(&config_ini, config_path);
|
||||
dstr_cat(&config_ini, is32bit ? "32.ini" : "64.ini");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user