1
0
mirror of https://github.com/fumiama/simple-kanban.git synced 2026-06-08 18:10:24 +08:00

细节修正

This commit is contained in:
fumiama
2021-05-19 13:16:38 +08:00
parent 2b09777a17
commit 226d690c20
4 changed files with 20 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0.0)
project(simple-kanban)
cmake_minimum_required(VERSION 2.6)
project(simple-kanban C)
include(TestBigEndian)
test_big_endian(isBigEndian)
@@ -19,3 +19,5 @@ add_executable(cfgwriter cfgwriter.c)
target_link_libraries(simple-kanban spb pthread)
target_link_libraries(simple-kanban-client pthread)
target_link_libraries(cfgwriter spb)
INSTALL(TARGETS simple-kanban RUNTIME DESTINATION bin)

View File

@@ -10,7 +10,7 @@ int main() {
scanf("%s", cfg.pwd);
printf("Enter a set password: ");
scanf("%s", cfg.sps);
uint64_t* types_len = align_struct(sizeof(CONFIG), 2, &cfg.pwd, &cfg.sps);
uint32_t* types_len = align_struct(sizeof(CONFIG), 2, &cfg.pwd, &cfg.sps);
FILE* fp = fopen("cfg.sp", "wb");
if(fp) {
set_pb(fp, types_len, sizeof(CONFIG), &cfg);

View File

@@ -27,7 +27,7 @@ int recv_bin = 0;
void getMessage(void *p) {
int c = 0;
while((c = recv(sockfd, bufr, BUFSIZ, 0)) > 0) {
printf("Recv %d bytes: ", c);
printf("Recv %u bytes: ", c);
if(recv_bin) {
FILE* fp = fopen("dump.bin", "w+");
fwrite(bufr, c, 1, fp);
@@ -90,7 +90,7 @@ int main(int argc,char *argv[]) { //usage: ./client host port
else puts("Send file error.");
#endif
fclose(fp);
printf("Send count:%lld\n", len);
printf("Send count:%u\n", len);
} else puts("Open file error!");
} else {
send(sockfd, buf, strlen(buf), 0);

View File

@@ -1,19 +1,19 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/signal.h>
#include <sys/file.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <pthread.h>
#include <signal.h>
#include <simple_protobuf.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <simple_protobuf.h>
#include <unistd.h>
#include "config.h"
#if !__APPLE__
@@ -160,7 +160,7 @@ int send_all(char* file_path, THREADTIMER *timer) {
re = sendfile(timer->accept_fd, fileno(fp), &len, file_size) >= 0;
if(!re) perror("Sendfile");
#endif
printf("Send %lld bytes.\n", len);
printf("Send %uF bytes.\n", len);
close_file(fp);
timer->is_open = 0;
}
@@ -378,7 +378,7 @@ void handle_accept(void *p) {
while(*(timer_pointer_of(p)->thread) && (timer_pointer_of(p)->numbytes = recv(accept_fd, buff, BUFSIZ, 0)) > 0) {
touch_timer(p);
buff[timer_pointer_of(p)->numbytes] = 0;
printf("Get %zd bytes: %s\n", timer_pointer_of(p)->numbytes, buff);
printf("Get %u bytes: %s\n", timer_pointer_of(p)->numbytes, buff);
puts("Check buffer");
//处理部分粘连
take_word(p, cfg->pwd);
@@ -390,7 +390,7 @@ void handle_accept(void *p) {
take_word(p, "dat");
if(timer_pointer_of(p)->numbytes > 0) chkbuf(p);
}
printf("Break: recv %zd bytes\n", timer_pointer_of(p)->numbytes);
printf("Break: recv %u bytes\n", timer_pointer_of(p)->numbytes);
} else puts("Error allocating buffer");
*(timer_pointer_of(p)->thread) = 0;
kill_thread(timer_pointer_of(p));