diff --git a/framework/muxer/ffmpegMuxer/FfmpegMuxer.cpp b/framework/muxer/ffmpegMuxer/FfmpegMuxer.cpp index 6218aacca..1d446a3f8 100644 --- a/framework/muxer/ffmpegMuxer/FfmpegMuxer.cpp +++ b/framework/muxer/ffmpegMuxer/FfmpegMuxer.cpp @@ -241,11 +241,13 @@ int FfmpegMuxer::close() if (mDestFormatContext->metadata) { av_dict_free(&mDestFormatContext->metadata); + mDestFormatContext->metadata = nullptr; } avio_flush(mDestFormatContext->pb); av_opt_free(mDestFormatContext->pb); av_free(mDestFormatContext->pb); + mDestFormatContext->pb = nullptr; avformat_free_context(mDestFormatContext); mDestFormatContext = nullptr; diff --git a/framework/utils/af_string.cpp b/framework/utils/af_string.cpp index 1c46857d1..f85c0543e 100644 --- a/framework/utils/af_string.cpp +++ b/framework/utils/af_string.cpp @@ -135,6 +135,12 @@ void c_make_absolute_url(char *buf, int size, const char *base, const char *rel) af_strlcpy(buf, rel, size); return; } +#ifdef WIN32 + if (strnlen_s(rel, 3) >= 3 && isalpha(rel[0]) && rel[1] == ':' && rel[2] == '/') { + af_strlcpy(buf, rel, size); + return; + } +#endif if (base != buf) { af_strlcpy(buf, base, size); diff --git a/framework/utils/file/FileCntl.cpp b/framework/utils/file/FileCntl.cpp index 71a3a5067..e3f06180d 100644 --- a/framework/utils/file/FileCntl.cpp +++ b/framework/utils/file/FileCntl.cpp @@ -25,6 +25,9 @@ FileCntl::~FileCntl() void FileCntl::openFile() { +#ifdef WIN32 + _set_fmode(_O_BINARY); +#endif // WIN32 mFd = open(mFilePath.c_str(), O_RDWR | O_CREAT, 0666); } @@ -41,8 +44,10 @@ int FileCntl::writeFile(uint8_t *buf, int size) void FileCntl::closeFile() { - close(mFd); - mFd = -1; + if (mFd >= 0) { + close(mFd); + mFd = -1; + } } diff --git a/framework/utils/file/FileUtils.cpp b/framework/utils/file/FileUtils.cpp index 63cb897b9..b498a62eb 100644 --- a/framework/utils/file/FileUtils.cpp +++ b/framework/utils/file/FileUtils.cpp @@ -6,6 +6,7 @@ #ifdef _WIN32 #include #include + #include #else #include #endif @@ -160,11 +161,7 @@ namespace Cicada { // make this one if parent has been made #ifdef _WIN32 // http://msdn.microsoft.com/en-us/library/2fkk4dzw.aspx - //int rc = mkdir(pathname); - int rc = -1; -// BOOL rc = CreateDirectory("pathname", NULL); -// return rc ? FILE_TRUE : -1; - return -1; + int rc = _mkdir(pathname); #else //S_IRWXU|S_IRWXG|S_IRWXO = 511 int rc = mkdir(pathname, 511);