@@ -174,18 +174,18 @@ static ssize_t tokenize_select(Lexer *l, Token *tokens, size_t capacity)
174174 } else if (strncmp (token .p , "AT" , token .length ) == 0 ) {
175175 tokens [i ].type = TOKEN_AT ;
176176 token = lexer_next (l );
177- if (sscanf (token .p , "%lli" , & (int64_t ){0 }) == 1 )
177+ if (sscanf (token .p , "%" PRId64 , & (int64_t ){0 }) == 1 )
178178 strncpy (tokens [i ].value , token .p , token .length );
179179 } else if (strncmp (token .p , "RANGE" , token .length ) == 0 ) {
180180 tokens [i ].type = TOKEN_RANGE ;
181181 token = lexer_next (l );
182- if (sscanf (token .p , "%lli" , & (int64_t ){0 }) == 1 )
182+ if (sscanf (token .p , "%" PRId64 , & (int64_t ){0 }) == 1 )
183183 strncpy (tokens [i ].value , token .p , token .length );
184184 // TOOD error here, missing the start timestamp
185185 } else if (strncmp (token .p , "TO" , token .length ) == 0 ) {
186186 tokens [i ].type = TOKEN_TO ;
187187 token = lexer_next (l );
188- if (sscanf (token .p , "%lli" , & (int64_t ){0 }) == 1 )
188+ if (sscanf (token .p , "%" PRId64 , & (int64_t ){0 }) == 1 )
189189 strncpy (tokens [i ].value , token .p , token .length );
190190 // TOOD error here, missing the start timestamp
191191 } else if (strncmp (token .p , "WHERE" , token .length ) == 0 ) {
@@ -199,7 +199,7 @@ static ssize_t tokenize_select(Lexer *l, Token *tokens, size_t capacity)
199199 } else if (strncmp (token .p , "BY" , token .length ) == 0 ) {
200200 tokens [i ].type = TOKEN_BY ;
201201 token = lexer_next (l );
202- if (sscanf (token .p , "%llu" , & (uint64_t ){0 }) == 1 )
202+ if (sscanf (token .p , "%" PRIu64 , & (uint64_t ){0 }) == 1 )
203203 strncpy (tokens [i ].value , token .p , token .length );
204204 // TOOD error here, missing the start timestamp
205205 } else {
@@ -217,7 +217,7 @@ static ssize_t tokenize_select(Lexer *l, Token *tokens, size_t capacity)
217217 tokens [i ].type = TOKEN_OPERATOR_NE ;
218218 }
219219 token = lexer_next (l );
220- if (sscanf (token .p , "%llu" , & (uint64_t ){0 }) == 1 )
220+ if (sscanf (token .p , "%" PRIu64 , & (uint64_t ){0 }) == 1 )
221221 strncpy (tokens [i ].value , token .p , token .length );
222222 }
223223 }
@@ -428,7 +428,7 @@ static void print_insert(const Statement_Insert *insert)
428428 printf ("INSERT\n\t%s\nINTO\n\t%s\n" , insert -> ts_name , insert -> db_name );
429429 printf ("VALUES\n\t" );
430430 for (size_t i = 0 ; i < insert -> record_len ; ++ i ) {
431- printf ("(%llu , %.2f) " , insert -> records [i ].timestamp ,
431+ printf ("(%" PRId64 " , %.2f) " , insert -> records [i ].timestamp ,
432432 insert -> records [i ].value );
433433 }
434434 printf ("\n" );
@@ -438,16 +438,17 @@ static void print_select(const Statement_Select *select)
438438{
439439 printf ("SELECT\n\t%s\nFROM\n\t%s\n" , select -> ts_name , select -> db_name );
440440 if (select -> mask & SM_SINGLE )
441- printf ("AT\n\t%lli \n" , select -> start_time );
441+ printf ("AT\n\t%" PRId64 " \n" , select -> start_time );
442442 else if (select -> mask & SM_RANGE )
443- printf ("RANGE\n\t%lli TO %lli\n" , select -> start_time , select -> end_time );
443+ printf ("RANGE\n\t%" PRId64 " TO %" PRId64 "\n" , select -> start_time ,
444+ select -> end_time );
444445 if (select -> mask & SM_WHERE )
445446 printf ("WHERE\n\t%s %i %.2lf\n" , select -> where .key ,
446447 select -> where .operator , select -> where .value );
447448 if (select -> mask & SM_AGGREGATE )
448449 printf ("AGGREAGATE\n\t%i\n" , select -> af );
449450 if (select -> mask & SM_BY )
450- printf ("BY\n\t%llu \n" , select -> interval );
451+ printf ("BY\n\t%" PRIu64 " \n" , select -> interval );
451452}
452453
453454void print_statement (const Statement * statement )
0 commit comments