mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] fix compile warning
This commit is contained in:
@@ -158,7 +158,8 @@ int Render::ConnectTo(const std::string &remote_id, const char *password,
|
||||
if (!props->connection_established_) {
|
||||
props->remember_password_ = remember_password;
|
||||
if (strcmp(password, "") != 0) {
|
||||
memcpy(props->remote_password_, password, sizeof(password));
|
||||
strncpy(props->remote_password_, password,
|
||||
sizeof(props->remote_password_));
|
||||
}
|
||||
ret = JoinConnection(props->peer_, remote_id.c_str(), password);
|
||||
if (0 == ret) {
|
||||
|
||||
@@ -711,7 +711,7 @@ typedef unsigned char validate_uint32[sizeof(stbi__uint32) == 4 ? 1 : -1];
|
||||
#ifdef STBI_HAS_LROTL
|
||||
#define stbi_lrot(x, y) _lrotl(x, y)
|
||||
#else
|
||||
#define stbi_lrot(x, y) (((x) << (y)) | ((x) >> (-(y)&31)))
|
||||
#define stbi_lrot(x, y) (((x) << (y)) | ((x) >> (-(y) & 31)))
|
||||
#endif
|
||||
|
||||
#if defined(STBI_MALLOC) && defined(STBI_FREE) && \
|
||||
@@ -1784,7 +1784,7 @@ static stbi__uint32 stbi__get32le(stbi__context *s) {
|
||||
#endif
|
||||
|
||||
#define STBI__BYTECAST(x) \
|
||||
((stbi_uc)((x)&255)) // truncate int to byte without warnings
|
||||
((stbi_uc)((x) & 255)) // truncate int to byte without warnings
|
||||
|
||||
#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && \
|
||||
defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && \
|
||||
@@ -1831,7 +1831,7 @@ static unsigned char *stbi__convert_format(unsigned char *data, int img_n,
|
||||
unsigned char *src = data + j * x * img_n;
|
||||
unsigned char *dest = good + j * x * req_comp;
|
||||
|
||||
#define STBI__COMBO(a, b) ((a)*8 + (b))
|
||||
#define STBI__COMBO(a, b) ((a) * 8 + (b))
|
||||
#define STBI__CASE(a, b) \
|
||||
case STBI__COMBO(a, b): \
|
||||
for (i = x - 1; i >= 0; --i, src += a, dest += b)
|
||||
@@ -1931,7 +1931,7 @@ static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n,
|
||||
stbi__uint16 *src = data + j * x * img_n;
|
||||
stbi__uint16 *dest = good + j * x * req_comp;
|
||||
|
||||
#define STBI__COMBO(a, b) ((a)*8 + (b))
|
||||
#define STBI__COMBO(a, b) ((a) * 8 + (b))
|
||||
#define STBI__CASE(a, b) \
|
||||
case STBI__COMBO(a, b): \
|
||||
for (i = x - 1; i >= 0; --i, src += a, dest += b)
|
||||
@@ -2590,8 +2590,8 @@ stbi_inline static stbi_uc stbi__clamp(int x) {
|
||||
return (stbi_uc)x;
|
||||
}
|
||||
|
||||
#define stbi__f2f(x) ((int)(((x)*4096 + 0.5)))
|
||||
#define stbi__fsh(x) ((x)*4096)
|
||||
#define stbi__f2f(x) ((int)(((x) * 4096 + 0.5)))
|
||||
#define stbi__fsh(x) ((x) * 4096)
|
||||
|
||||
// derived from jidctint -- DCT_ISLOW
|
||||
#define STBI__IDCT_1D(s0, s1, s2, s3, s4, s5, s6, s7) \
|
||||
@@ -3694,7 +3694,7 @@ static int stbi__decode_jpeg_image(stbi__jpeg *j) {
|
||||
if (!stbi__decode_jpeg_header(j, STBI__SCAN_load)) return 0;
|
||||
m = stbi__get_marker(j);
|
||||
while (!stbi__EOI(m)) {
|
||||
if (stbi__SOS(m)) {
|
||||
if (stbi__SOS(m) == true) {
|
||||
if (!stbi__process_scan_header(j)) return 0;
|
||||
if (!stbi__parse_entropy_coded_data(j)) return 0;
|
||||
if (j->marker == STBI__MARKER_none) {
|
||||
@@ -3704,7 +3704,7 @@ static int stbi__decode_jpeg_image(stbi__jpeg *j) {
|
||||
}
|
||||
m = stbi__get_marker(j);
|
||||
if (STBI__RESTART(m)) m = stbi__get_marker(j);
|
||||
} else if (stbi__DNL(m)) {
|
||||
} else if (stbi__DNL(m) == true) {
|
||||
int Ld = stbi__get16be(j->s);
|
||||
stbi__uint32 NL = stbi__get16be(j->s);
|
||||
if (Ld != 4) return stbi__err("bad DNL len", "Corrupt JPEG");
|
||||
@@ -3929,7 +3929,7 @@ static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near,
|
||||
|
||||
// this is a reduced-precision calculation of YCbCr-to-RGB introduced
|
||||
// to make sure the code produces the same results in both SIMD and scalar
|
||||
#define stbi__float2fixed(x) (((int)((x)*4096.0f + 0.5f)) << 8)
|
||||
#define stbi__float2fixed(x) (((int)((x) * 4096.0f + 0.5f)) << 8)
|
||||
static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y,
|
||||
const stbi_uc *pcb, const stbi_uc *pcr,
|
||||
int count, int step) {
|
||||
@@ -7579,8 +7579,7 @@ static char *stbi__hdr_gettoken(stbi__context *z, char *buffer) {
|
||||
buffer[len++] = c;
|
||||
if (len == STBI__HDR_BUFLEN - 1) {
|
||||
// flush to end of line
|
||||
while (!stbi__at_eof(z) && stbi__get8(z) != '\n')
|
||||
;
|
||||
while (!stbi__at_eof(z) && stbi__get8(z) != '\n');
|
||||
break;
|
||||
}
|
||||
c = (char)stbi__get8(z);
|
||||
|
||||
@@ -270,7 +270,7 @@ STBIWDEF void stbi_flip_vertically_on_write(int flip_boolean);
|
||||
#define STBIW_ASSERT(x) assert(x)
|
||||
#endif
|
||||
|
||||
#define STBIW_UCHAR(x) (unsigned char)((x)&0xff)
|
||||
#define STBIW_UCHAR(x) (unsigned char)((x) & 0xff)
|
||||
|
||||
#ifdef STB_IMAGE_WRITE_STATIC
|
||||
static int stbi_write_png_compression_level = 8;
|
||||
@@ -816,8 +816,8 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp,
|
||||
sprintf_s(buffer, sizeof(buffer),
|
||||
"EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
||||
#else
|
||||
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n",
|
||||
y, x);
|
||||
len = snprintf(buffer, sizeof(buffer),
|
||||
"EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
||||
#endif
|
||||
s->func(s->context, buffer, len);
|
||||
|
||||
@@ -857,7 +857,7 @@ STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp,
|
||||
#ifndef STBIW_ZLIB_COMPRESS
|
||||
// stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount()
|
||||
// == vector<>::size()
|
||||
#define stbiw__sbraw(a) ((int *)(void *)(a)-2)
|
||||
#define stbiw__sbraw(a) ((int *)(void *)(a) - 2)
|
||||
#define stbiw__sbm(a) stbiw__sbraw(a)[0]
|
||||
#define stbiw__sbn(a) stbiw__sbraw(a)[1]
|
||||
|
||||
@@ -931,9 +931,9 @@ static unsigned int stbiw__zhash(unsigned char *data) {
|
||||
#define stbiw__zlib_huffa(b, c) stbiw__zlib_add(stbiw__zlib_bitrev(b, c), c)
|
||||
// default huffman tables
|
||||
#define stbiw__zlib_huff1(n) stbiw__zlib_huffa(0x30 + (n), 8)
|
||||
#define stbiw__zlib_huff2(n) stbiw__zlib_huffa(0x190 + (n)-144, 9)
|
||||
#define stbiw__zlib_huff3(n) stbiw__zlib_huffa(0 + (n)-256, 7)
|
||||
#define stbiw__zlib_huff4(n) stbiw__zlib_huffa(0xc0 + (n)-280, 8)
|
||||
#define stbiw__zlib_huff2(n) stbiw__zlib_huffa(0x190 + (n) - 144, 9)
|
||||
#define stbiw__zlib_huff3(n) stbiw__zlib_huffa(0 + (n) - 256, 7)
|
||||
#define stbiw__zlib_huff4(n) stbiw__zlib_huffa(0xc0 + (n) - 280, 8)
|
||||
#define stbiw__zlib_huff(n) \
|
||||
((n) <= 143 ? stbiw__zlib_huff1(n) \
|
||||
: (n) <= 255 ? stbiw__zlib_huff2(n) \
|
||||
@@ -951,7 +951,7 @@ STBIWDEF unsigned char *stbi_zlib_compress(unsigned char *data, int data_len,
|
||||
#ifdef STBIW_ZLIB_COMPRESS
|
||||
// user provided a zlib compress implementation, use that
|
||||
return STBIW_ZLIB_COMPRESS(data, data_len, out_len, quality);
|
||||
#else // use builtin
|
||||
#else // use builtin
|
||||
static unsigned short lengthc[] = {
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27,
|
||||
31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 259};
|
||||
@@ -1024,12 +1024,10 @@ STBIWDEF unsigned char *stbi_zlib_compress(unsigned char *data, int data_len,
|
||||
if (bestloc) {
|
||||
int d = (int)(data + i - bestloc); // distance back
|
||||
STBIW_ASSERT(d <= 32767 && best <= 258);
|
||||
for (j = 0; best > lengthc[j + 1] - 1; ++j)
|
||||
;
|
||||
for (j = 0; best > lengthc[j + 1] - 1; ++j);
|
||||
stbiw__zlib_huff(j + 257);
|
||||
if (lengtheb[j]) stbiw__zlib_add(best - lengthc[j], lengtheb[j]);
|
||||
for (j = 0; d > distc[j + 1] - 1; ++j)
|
||||
;
|
||||
for (j = 0; d > distc[j + 1] - 1; ++j);
|
||||
stbiw__zlib_add(stbiw__zlib_bitrev(j, 5), 5);
|
||||
if (disteb[j]) stbiw__zlib_add(d - distc[j], disteb[j]);
|
||||
i += best;
|
||||
|
||||
Reference in New Issue
Block a user