mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 23:49:44 +08:00
Squash truncation warning
This commit is contained in:
parent
e7b1905e49
commit
41c1e0f08d
4
Makefile
4
Makefile
@ -41,7 +41,7 @@ mg_prefix: mongoose.c mongoose.h
|
|||||||
$(CLANG) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T' | grep -v 'mg_' ; test $$? = 1
|
$(CLANG) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T' | grep -v 'mg_' ; test $$? = 1
|
||||||
|
|
||||||
# C++ build
|
# C++ build
|
||||||
test++: CLANG = g++ -Wno-deprecated -Wno-missing-field-initializers -Wno-error=format-truncation -Wno-unknown-warning-option
|
test++: CLANG = g++ -Wno-deprecated -Wno-missing-field-initializers
|
||||||
test++: unamalgamated
|
test++: unamalgamated
|
||||||
|
|
||||||
# Make sure we can build from an unamalgamated sources
|
# Make sure we can build from an unamalgamated sources
|
||||||
@ -92,7 +92,7 @@ linux: Makefile mongoose.c mongoose.h test/unit_test.c
|
|||||||
$(GCC) $(CC) mongoose.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -o unit_test_gcc
|
$(GCC) $(CC) mongoose.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -o unit_test_gcc
|
||||||
$(GCC) ./unit_test_gcc
|
$(GCC) ./unit_test_gcc
|
||||||
|
|
||||||
linux++: CC = g++ -Wno-missing-field-initializers -Wno-error=format-truncation
|
linux++: CC = g++ -Wno-missing-field-initializers
|
||||||
linux++: linux
|
linux++: linux
|
||||||
|
|
||||||
mongoose.c: $(SRCS) Makefile
|
mongoose.c: $(SRCS) Makefile
|
||||||
|
@ -3260,7 +3260,8 @@ static char *mg_ssi(const char *path, const char *root, int depth) {
|
|||||||
if (intag && ch == '>' && buf[len - 1] == '-' && buf[len - 2] == '-') {
|
if (intag && ch == '>' && buf[len - 1] == '-' && buf[len - 2] == '-') {
|
||||||
buf[len++] = ch & 0xff;
|
buf[len++] = ch & 0xff;
|
||||||
if (sscanf(buf, "<!--#include file=\"%[^\"]", arg)) {
|
if (sscanf(buf, "<!--#include file=\"%[^\"]", arg)) {
|
||||||
char tmp[MG_PATH_MAX], *p = (char *) path + strlen(path), *data;
|
char tmp[MG_PATH_MAX + BUFSIZ + 10],
|
||||||
|
*p = (char *) path + strlen(path), *data;
|
||||||
while (p > path && p[-1] != MG_DIRSEP && p[-1] != '/') p--;
|
while (p > path && p[-1] != MG_DIRSEP && p[-1] != '/') p--;
|
||||||
snprintf(tmp, sizeof(tmp), "%.*s%s", (int) (p - path), path, arg);
|
snprintf(tmp, sizeof(tmp), "%.*s%s", (int) (p - path), path, arg);
|
||||||
if (depth < MG_MAX_SSI_DEPTH &&
|
if (depth < MG_MAX_SSI_DEPTH &&
|
||||||
@ -3271,7 +3272,7 @@ static char *mg_ssi(const char *path, const char *root, int depth) {
|
|||||||
LOG(LL_ERROR, ("%s: file=%s error or too deep", path, arg));
|
LOG(LL_ERROR, ("%s: file=%s error or too deep", path, arg));
|
||||||
}
|
}
|
||||||
} else if (sscanf(buf, "<!--#include virtual=\"%[^\"]", arg)) {
|
} else if (sscanf(buf, "<!--#include virtual=\"%[^\"]", arg)) {
|
||||||
char tmp[MG_PATH_MAX], *data;
|
char tmp[MG_PATH_MAX + BUFSIZ + 10], *data;
|
||||||
snprintf(tmp, sizeof(tmp), "%s%s", root, arg);
|
snprintf(tmp, sizeof(tmp), "%s%s", root, arg);
|
||||||
if (depth < MG_MAX_SSI_DEPTH &&
|
if (depth < MG_MAX_SSI_DEPTH &&
|
||||||
(data = mg_ssi(tmp, root, depth + 1)) != NULL) {
|
(data = mg_ssi(tmp, root, depth + 1)) != NULL) {
|
||||||
|
@ -18,7 +18,8 @@ static char *mg_ssi(const char *path, const char *root, int depth) {
|
|||||||
if (intag && ch == '>' && buf[len - 1] == '-' && buf[len - 2] == '-') {
|
if (intag && ch == '>' && buf[len - 1] == '-' && buf[len - 2] == '-') {
|
||||||
buf[len++] = ch & 0xff;
|
buf[len++] = ch & 0xff;
|
||||||
if (sscanf(buf, "<!--#include file=\"%[^\"]", arg)) {
|
if (sscanf(buf, "<!--#include file=\"%[^\"]", arg)) {
|
||||||
char tmp[MG_PATH_MAX], *p = (char *) path + strlen(path), *data;
|
char tmp[MG_PATH_MAX + BUFSIZ + 10],
|
||||||
|
*p = (char *) path + strlen(path), *data;
|
||||||
while (p > path && p[-1] != MG_DIRSEP && p[-1] != '/') p--;
|
while (p > path && p[-1] != MG_DIRSEP && p[-1] != '/') p--;
|
||||||
snprintf(tmp, sizeof(tmp), "%.*s%s", (int) (p - path), path, arg);
|
snprintf(tmp, sizeof(tmp), "%.*s%s", (int) (p - path), path, arg);
|
||||||
if (depth < MG_MAX_SSI_DEPTH &&
|
if (depth < MG_MAX_SSI_DEPTH &&
|
||||||
@ -29,7 +30,7 @@ static char *mg_ssi(const char *path, const char *root, int depth) {
|
|||||||
LOG(LL_ERROR, ("%s: file=%s error or too deep", path, arg));
|
LOG(LL_ERROR, ("%s: file=%s error or too deep", path, arg));
|
||||||
}
|
}
|
||||||
} else if (sscanf(buf, "<!--#include virtual=\"%[^\"]", arg)) {
|
} else if (sscanf(buf, "<!--#include virtual=\"%[^\"]", arg)) {
|
||||||
char tmp[MG_PATH_MAX], *data;
|
char tmp[MG_PATH_MAX + BUFSIZ + 10], *data;
|
||||||
snprintf(tmp, sizeof(tmp), "%s%s", root, arg);
|
snprintf(tmp, sizeof(tmp), "%s%s", root, arg);
|
||||||
if (depth < MG_MAX_SSI_DEPTH &&
|
if (depth < MG_MAX_SSI_DEPTH &&
|
||||||
(data = mg_ssi(tmp, root, depth + 1)) != NULL) {
|
(data = mg_ssi(tmp, root, depth + 1)) != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user