正在显示
3 个修改的文件
包含
24 行增加
和
2 行删除
| @@ -26,11 +26,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -26,11 +26,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 26 | // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 | 26 | // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 |
| 27 | #ifndef _WIN32 | 27 | #ifndef _WIN32 |
| 28 | #include <unistd.h> | 28 | #include <unistd.h> |
| 29 | +#include <sys/uio.h> | ||
| 29 | #endif | 30 | #endif |
| 30 | 31 | ||
| 31 | #include <fcntl.h> | 32 | #include <fcntl.h> |
| 32 | #include <sstream> | 33 | #include <sstream> |
| 33 | -#include <sys/uio.h> | ||
| 34 | using namespace std; | 34 | using namespace std; |
| 35 | 35 | ||
| 36 | #include <srs_kernel_log.hpp> | 36 | #include <srs_kernel_log.hpp> |
| @@ -307,8 +307,13 @@ int srs_do_create_dir_recursively(string dir) | @@ -307,8 +307,13 @@ int srs_do_create_dir_recursively(string dir) | ||
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | // create curren dir. | 309 | // create curren dir. |
| 310 | + // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 | ||
| 311 | +#ifndef _WIN32 | ||
| 310 | mode_t mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH; | 312 | mode_t mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH; |
| 311 | if (::mkdir(dir.c_str(), mode) < 0) { | 313 | if (::mkdir(dir.c_str(), mode) < 0) { |
| 314 | +#else | ||
| 315 | + if (::mkdir(dir.c_str()) < 0) { | ||
| 316 | +#endif | ||
| 312 | if (errno == EEXIST) { | 317 | if (errno == EEXIST) { |
| 313 | return ERROR_SYSTEM_DIR_EXISTS; | 318 | return ERROR_SYSTEM_DIR_EXISTS; |
| 314 | } | 319 | } |
| @@ -49,6 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -49,6 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 49 | typedef unsigned long long u_int64_t; | 49 | typedef unsigned long long u_int64_t; |
| 50 | typedef long long int64_t; | 50 | typedef long long int64_t; |
| 51 | typedef unsigned int u_int32_t; | 51 | typedef unsigned int u_int32_t; |
| 52 | + typedef u_int32_t uint32_t; | ||
| 52 | typedef int int32_t; | 53 | typedef int int32_t; |
| 53 | typedef unsigned char u_int8_t; | 54 | typedef unsigned char u_int8_t; |
| 54 | typedef char int8_t; | 55 | typedef char int8_t; |
| @@ -1025,20 +1026,31 @@ typedef void* srs_hijack_io_t; | @@ -1025,20 +1026,31 @@ typedef void* srs_hijack_io_t; | ||
| 1025 | *************************************************************/ | 1026 | *************************************************************/ |
| 1026 | // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 | 1027 | // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 |
| 1027 | #ifdef _WIN32 | 1028 | #ifdef _WIN32 |
| 1029 | + // for time. | ||
| 1028 | #define _CRT_SECURE_NO_WARNINGS | 1030 | #define _CRT_SECURE_NO_WARNINGS |
| 1029 | #include <time.h> | 1031 | #include <time.h> |
| 1030 | int gettimeofday(struct timeval* tv, struct timezone* tz); | 1032 | int gettimeofday(struct timeval* tv, struct timezone* tz); |
| 1031 | #define PRId64 "lld" | 1033 | #define PRId64 "lld" |
| 1032 | 1034 | ||
| 1035 | + // for inet helpers. | ||
| 1033 | typedef int socklen_t; | 1036 | typedef int socklen_t; |
| 1034 | const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); | 1037 | const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); |
| 1038 | + | ||
| 1039 | + // for mkdir(). | ||
| 1040 | + #include<direct.h> | ||
| 1041 | + | ||
| 1042 | + // for open(). | ||
| 1035 | typedef int mode_t; | 1043 | typedef int mode_t; |
| 1036 | #define S_IRUSR 0 | 1044 | #define S_IRUSR 0 |
| 1037 | #define S_IWUSR 0 | 1045 | #define S_IWUSR 0 |
| 1046 | + #define S_IXUSR 0 | ||
| 1038 | #define S_IRGRP 0 | 1047 | #define S_IRGRP 0 |
| 1039 | #define S_IWGRP 0 | 1048 | #define S_IWGRP 0 |
| 1049 | + #define S_IXGRP 0 | ||
| 1040 | #define S_IROTH 0 | 1050 | #define S_IROTH 0 |
| 1051 | + #define S_IXOTH 0 | ||
| 1041 | 1052 | ||
| 1053 | + // for file seek. | ||
| 1042 | #include <io.h> | 1054 | #include <io.h> |
| 1043 | #include <fcntl.h> | 1055 | #include <fcntl.h> |
| 1044 | #define open _open | 1056 | #define open _open |
| @@ -1047,14 +1059,19 @@ typedef void* srs_hijack_io_t; | @@ -1047,14 +1059,19 @@ typedef void* srs_hijack_io_t; | ||
| 1047 | #define write _write | 1059 | #define write _write |
| 1048 | #define read _read | 1060 | #define read _read |
| 1049 | 1061 | ||
| 1062 | + // for pid. | ||
| 1050 | typedef int pid_t; | 1063 | typedef int pid_t; |
| 1051 | pid_t getpid(void); | 1064 | pid_t getpid(void); |
| 1052 | - #define snprintf _snprintf | 1065 | + |
| 1066 | + // for socket. | ||
| 1053 | ssize_t writev(int fd, const struct iovec *iov, int iovcnt); | 1067 | ssize_t writev(int fd, const struct iovec *iov, int iovcnt); |
| 1054 | typedef int64_t useconds_t; | 1068 | typedef int64_t useconds_t; |
| 1055 | int usleep(useconds_t usec); | 1069 | int usleep(useconds_t usec); |
| 1056 | int socket_setup(); | 1070 | int socket_setup(); |
| 1057 | int socket_cleanup(); | 1071 | int socket_cleanup(); |
| 1072 | + | ||
| 1073 | + // others. | ||
| 1074 | + #define snprintf _snprintf | ||
| 1058 | #endif | 1075 | #endif |
| 1059 | 1076 | ||
| 1060 | #ifdef __cplusplus | 1077 | #ifdef __cplusplus |
-
请 注册 或 登录 后发表评论