Conform to ANSI C

This commit is contained in:
thematdev 2023-07-03 20:52:50 +03:00
parent 842a5153a4
commit 7e7bfb2476
Signed by: thematdev
GPG Key ID: D12878639B090D90
3 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,8 @@ OBJ_FILES := $(patsubst $(SD)/%.c,$(BD)/%.o,$(SRC_FILES))
INCLUDE_DIRS = -Ilibs/qments/include -Ilibs/cgic INCLUDE_DIRS = -Ilibs/qments/include -Ilibs/cgic
LIB_TARGETS = $(patsubst $(LIBS_DIR)/%,$(BD)/lib%.a,$(LIBS)) LIB_TARGETS = $(patsubst $(LIBS_DIR)/%,$(BD)/lib%.a,$(LIBS))
CFLAGS ?= -O2 -ansi -pedantic
$(BD)/libcgic.a: $(BD)/libcgic.a:
$(MAKE) -C $(LIBS_DIR)/cgic $(MAKE) -C $(LIBS_DIR)/cgic
cp $(LIBS_DIR)/cgic/libcgic.a $(BD) cp $(LIBS_DIR)/cgic/libcgic.a $(BD)

View File

@ -166,6 +166,7 @@ handle_submitted_comment()
char displayname[MAX_NAME], text[MAX_COMMENT_SIZE], *sanitized_text; char displayname[MAX_NAME], text[MAX_COMMENT_SIZE], *sanitized_text;
int rid, retval; int rid, retval;
cgiFormResultType err; cgiFormResultType err;
CommentHeader header;
Driver driver = DRIVER; Driver driver = DRIVER;
UnixFsDriverData driver_data = DRIVER_DATA; UnixFsDriverData driver_data = DRIVER_DATA;
@ -199,7 +200,6 @@ handle_submitted_comment()
sanitized_text = mk_specialchars(text); sanitized_text = mk_specialchars(text);
CommentHeader header;
time(&header.creation_time); time(&header.creation_time);
header.reply_id = rid; header.reply_id = rid;
header.text_length = strlen(sanitized_text); header.text_length = strlen(sanitized_text);

View File

@ -32,7 +32,8 @@ sb_length(const StringBuffer *buffer)
void void
sb_to_c_str(const StringBuffer *buffer, char *str) sb_to_c_str(const StringBuffer *buffer, char *str)
{ {
for (size_t i = 0; i < buffer->size; ++i) { size_t i;
for (i = 0; i < buffer->size; ++i) {
str[i] = buffer->buf[i]; str[i] = buffer->buf[i];
} }
str[buffer->size] = '\0'; str[buffer->size] = '\0';