Browse Source

libobs: Fix bug with process piping

The size parameter is the size of the elements, not the size of the
data.  The size parameter should be 1, and the elements should be the
number of bytes.

The reason why I'm making this change is because the fread/fwrite would
fail when the parameters were swapped.
jp9000 10 năm trước cách đây
mục cha
commit
43956388b2
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      libobs/util/pipe-posix.c

+ 2 - 2
libobs/util/pipe-posix.c

@@ -63,7 +63,7 @@ size_t os_process_pipe_read(os_process_pipe_t *pp, uint8_t *data, size_t len)
 		return 0;
 	}
 
-	return fread(data, len, 1, pp->file);
+	return fread(data, 1, len, pp->file);
 }
 
 size_t os_process_pipe_write(os_process_pipe_t *pp, const uint8_t *data,
@@ -76,5 +76,5 @@ size_t os_process_pipe_write(os_process_pipe_t *pp, const uint8_t *data,
 		return 0;
 	}
 
-	return fwrite(data, len, 1, pp->file);
+	return fwrite(data, 1, len, pp->file);
 }