diff --git a/libobs-opengl/gl-x11.c b/libobs-opengl/gl-x11.c index 4abd119fd..042f87d5f 100644 --- a/libobs-opengl/gl-x11.c +++ b/libobs-opengl/gl-x11.c @@ -236,6 +236,7 @@ void device_leavecontext(device_t device) void gl_update(device_t device) { /* I don't know of anything we can do here. */ + UNUSED_PARAMETER(device); } void device_load_swapchain(device_t device, swapchain_t swap) diff --git a/libobs/media-io/audio-io.c b/libobs/media-io/audio-io.c index a571a6c1c..e4fc992c4 100644 --- a/libobs/media-io/audio-io.c +++ b/libobs/media-io/audio-io.c @@ -630,8 +630,8 @@ void audio_line_output(audio_line_t line, const struct audio_data *data) } else { blog(LOG_DEBUG, "Bad timestamp for audio line '%s', " - "data->timestamp: %llu, " - "line->base_timestamp: %llu. This can " + "data->timestamp: "PRIu64", " + "line->base_timestamp: "PRIu64". This can " "sometimes happen when there's a pause in " "the threads.", line->name, data->timestamp, line->base_timestamp); diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 3abc3df39..33bd6d59f 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -15,6 +15,8 @@ along with this program. If not, see . ******************************************************************************/ +#include + #include "media-io/format-conversion.h" #include "util/platform.h" #include "callback/calldata.h" @@ -389,7 +391,7 @@ static inline void reset_audio_timing(obs_source_t source, uint64_t timetamp) static inline void handle_ts_jump(obs_source_t source, uint64_t ts, uint64_t diff) { - blog(LOG_DEBUG, "Timestamp for source '%s' jumped by '%lld', " + blog(LOG_DEBUG, "Timestamp for source '%s' jumped by '"PRIu64"', " "resetting audio timing", source->name, diff); /* if has video, ignore audio data until reset */ diff --git a/libobs/util/c99defs.h b/libobs/util/c99defs.h index 1c763da07..4a5015b8d 100644 --- a/libobs/util/c99defs.h +++ b/libobs/util/c99defs.h @@ -26,7 +26,7 @@ #ifdef _MSC_VER #define FORCE_INLINE __forceinline #else -#define FORCE_INLINE __attribute__((always_inline)) +#define FORCE_INLINE inline __attribute__((always_inline)) #endif #ifdef _MSC_VER diff --git a/libobs/util/dstr.c b/libobs/util/dstr.c index 8e2aee331..f05668e5b 100644 --- a/libobs/util/dstr.c +++ b/libobs/util/dstr.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "c99defs.h" #include "dstr.h" #include "bmem.h" diff --git a/libobs/util/platform.c b/libobs/util/platform.c index 981995242..24754e452 100644 --- a/libobs/util/platform.c +++ b/libobs/util/platform.c @@ -82,17 +82,21 @@ size_t os_fread_mbs(FILE *file, char **pstr) fseeko(file, 0, SEEK_END); size = (size_t)ftello(file); + *pstr = NULL; if (size > 0) { char *mbstr = bmalloc(size+1); fseeko(file, 0, SEEK_SET); - fread(mbstr, 1, size, file); + size = fread(mbstr, 1, size, file); + if (size == 0) { + bfree(mbstr); + return 0; + } + mbstr[size] = 0; len = os_mbs_to_utf8(mbstr, size, pstr); bfree(mbstr); - } else { - *pstr = NULL; } return len; @@ -101,6 +105,7 @@ size_t os_fread_mbs(FILE *file, char **pstr) size_t os_fread_utf8(FILE *file, char **pstr) { size_t size = 0; + size_t size_read; size_t len = 0; fseeko(file, 0, SEEK_END); @@ -113,13 +118,22 @@ size_t os_fread_utf8(FILE *file, char **pstr) /* remove the ghastly BOM if present */ fseeko(file, 0, SEEK_SET); - fread(bom, 1, 3, file); + size_read = fread(bom, 1, 3, file); + if (size_read != 3) + return 0; + offset = (astrcmp_n(bom, "\xEF\xBB\xBF", 3) == 0) ? 3 : 0; size -= offset; utf8str = bmalloc(size+1); fseeko(file, offset, SEEK_SET); - fread(utf8str, 1, size, file); + + size = fread(utf8str, 1, size, file); + if (size == 0) { + bfree(utf8str); + return 0; + } + utf8str[size] = 0; *pstr = utf8str; diff --git a/obs/obs-app.cpp b/obs/obs-app.cpp index b5eb21f06..2f7dabeab 100644 --- a/obs/obs-app.cpp +++ b/obs/obs-app.cpp @@ -15,6 +15,7 @@ along with this program. If not, see . ******************************************************************************/ +#include #include #include #include @@ -292,6 +293,6 @@ int main(int argc, char *argv[]) blog(LOG_ERROR, "%s", error); } - blog(LOG_INFO, "Number of memory leaks: %llu", bnum_allocs()); + blog(LOG_INFO, "Number of memory leaks: "PRIu64, bnum_allocs()); return ret; } diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-output.c b/plugins/obs-ffmpeg/obs-ffmpeg-output.c index 8ad83a7b4..650dc4308 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-output.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-output.c @@ -20,6 +20,7 @@ #include #include +#include struct ffmpeg_data { AVStream *video;