@@ -27,18 +27,18 @@ typedef struct cmd_in_second_log {
2727
2828typedef struct cmd_in_second_buffer {
2929 logtype * ring ;
30- int32_t front ;
31- int32_t rear ;
32- int32_t capacity ;
30+ int front ;
31+ int rear ;
32+ int capacity ;
3333} buffertype ;
3434
3535typedef struct cmd_in_second_timer {
3636 struct timeval * ring ;
37- int32_t front ;
38- int32_t rear ;
39- int32_t capacity ;
40- int32_t last_elem_idx ;
41- int32_t circular_counter ;
37+ int front ;
38+ int rear ;
39+ int capacity ;
40+ int last_elem_idx ;
41+ int circular_counter ;
4242} timertype ;
4343
4444typedef struct cmd_in_second_flush_thread {
@@ -54,8 +54,8 @@ struct cmd_in_second {
5454 char cmd_str [50 ];
5555 struct cmd_in_second_buffer buffer ;
5656 timertype timer ;
57- int32_t bulk_limit ;
58- int32_t log_per_timer ;
57+ int bulk_limit ;
58+ int log_per_timer ;
5959 state cur_state ;
6060 flush_thread flusher ;
6161 pthread_mutex_t lock ;
@@ -123,7 +123,7 @@ static void wake_flusher_up(){
123123
124124static void * flush_buffer ()
125125{
126- const int32_t fd = open ("cmd_in_second.log" , O_CREAT | O_WRONLY | O_TRUNC , 0644 );
126+ const int fd = open ("cmd_in_second.log" , O_CREAT | O_WRONLY | O_TRUNC , 0644 );
127127
128128 while (1 ) {
129129 if (fd < 0 ) {
@@ -147,10 +147,10 @@ static void* flush_buffer()
147147 }
148148
149149 const size_t cmd_len = strlen (this .cmd_str );
150- const int32_t whitespaces = 3 ;
150+ const int whitespaces = 3 ;
151151
152152 size_t expected_write_length = 0 ;
153- int32_t circular_log_counter = 0 ;
153+ int circular_log_counter = 0 ;
154154
155155 while (!buffer_empty ()) {
156156
@@ -173,7 +173,7 @@ static void* flush_buffer()
173173 }
174174
175175 sprintf (time_str , "%04d-%02d-%02d %02d:%02d:%02d.%06d\n" , lt -> tm_year + 1900 , lt -> tm_mon + 1 , lt -> tm_mday ,
176- lt -> tm_hour , lt -> tm_min , lt -> tm_sec , (int32_t )front_time -> tv_usec );
176+ lt -> tm_hour , lt -> tm_min , lt -> tm_sec , (int )front_time -> tv_usec );
177177 expected_write_length += 27 ;
178178 }
179179
@@ -326,7 +326,7 @@ int cmd_in_second_start(const int operation, const char cmd_str[], const int bul
326326
327327 this .operation = operation ;
328328 this .bulk_limit = bulk_limit ;
329- snprintf (this .cmd_str , CMD_STR_LEN , cmd_str );
329+ snprintf (this .cmd_str , CMD_STR_LEN , "%s" , cmd_str );
330330
331331 this .buffer .capacity = bulk_limit + 1 ;
332332 this .buffer .ring = (logtype * )malloc (this .buffer .capacity * sizeof (logtype ));
0 commit comments