[fix] fix compile warning

This commit is contained in:
dijunkun
2025-04-11 16:09:11 +08:00
parent 824d9243cc
commit 62d14587cd
4 changed files with 23 additions and 25 deletions

View File

@@ -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) {

View File

@@ -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");
@@ -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);

View File

@@ -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);
@@ -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;