mirror of
https://github.com/tezc/sc.git
synced 2025-01-28 07:03:06 +08:00
fix big endian, windows
This commit is contained in:
parent
66158d401f
commit
f753bbe6d6
@ -297,12 +297,12 @@ uint32_t sc_buf_set_data(struct sc_buf *buf, uint32_t offset, const void *src,
|
||||
}
|
||||
void sc_buf_set_32(struct sc_buf *buf, uint32_t val)
|
||||
{
|
||||
sc_buf_set_data(buf, buf->wpos, &val, 4);
|
||||
sc_buf_set_32_at(buf, buf->wpos, val);
|
||||
}
|
||||
|
||||
void sc_buf_set_64(struct sc_buf *buf, uint64_t val)
|
||||
{
|
||||
sc_buf_set_data(buf, buf->wpos, &val, 8);
|
||||
sc_buf_set_64_at(buf, buf->wpos, val);
|
||||
}
|
||||
|
||||
void sc_buf_set_8_at(struct sc_buf *buf, uint32_t pos, uint8_t val)
|
||||
|
@ -156,12 +156,14 @@ int sc_signal_snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||
#if defined(_WIN32)
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Ws2tcpip.h>
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#include <windows.h>
|
||||
|
||||
#pragma warning(disable : 4996)
|
||||
#include <Ws2tcpip.h>
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#include <windows.h>
|
||||
|
||||
#pragma warning(disable : 4996)
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
|
||||
static void sc_signal_log(int fd, char *buf, size_t len, char *fmt, ...)
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void test1()
|
||||
{
|
||||
@ -40,7 +39,7 @@ void test1()
|
||||
assert(sc_signal_snprintf(tmp, sizeof(tmp), "%llx", 3) == -1);
|
||||
assert(sc_signal_snprintf(tmp, sizeof(tmp), "%lx", 3) == -1);
|
||||
|
||||
sc_signal_log(STDOUT_FILENO, tmp, sizeof(tmp), "%s", "test");
|
||||
sc_signal_log(1, tmp, sizeof(tmp), "%s", "test");
|
||||
}
|
||||
|
||||
void test2()
|
||||
|
Loading…
x
Reference in New Issue
Block a user