Fix: use correct format specifiers for int64 (#45)

* Fix: use correct format specifiers for int64
* Use iostream instead of stdio
This commit is contained in:
Tim Zimmermann 2017-06-14 22:46:43 +02:00 committed by Pedro Flemming
parent 0939a8d6cd
commit 8913f9213d
2 changed files with 10 additions and 10 deletions

View File

@ -25,7 +25,7 @@ int main(int argc, char* argv[]) {
printf("Parsed successfully!\n");
printf("Number of statements: %lu\n", result.size());
for (uint i = 0; i < result.size(); ++i) {
for (auto i = 0u; i < result.size(); ++i) {
// Print a statement summary.
hsql::printStatementInfo(result.getStatement(i));
}

View File

@ -1,6 +1,6 @@
#include "sqlhelper.h"
#include <stdio.h>
#include <iostream>
#include <string>
namespace hsql {
@ -11,22 +11,22 @@ namespace hsql {
return std::string(numIndent, '\t');
}
void inprint(int64_t val, uintmax_t numIndent) {
printf("%s%ld \n", indent(numIndent).c_str(), val);
std::cout << indent(numIndent).c_str() << val << " " << std::endl;
}
void inprint(float val, uintmax_t numIndent) {
printf("%s%f\n", indent(numIndent).c_str(), val);
std::cout << indent(numIndent).c_str() << val << std::endl;
}
void inprint(const char* val, uintmax_t numIndent) {
printf("%s%s\n", indent(numIndent).c_str(), val);
std::cout << indent(numIndent).c_str() << val << std::endl;
}
void inprint(const char* val, const char* val2, uintmax_t numIndent) {
printf("%s%s->%s\n", indent(numIndent).c_str(), val, val2);
std::cout << indent(numIndent).c_str() << val << "->" << val2 << std::endl;
}
void inprintC(char val, uintmax_t numIndent) {
printf("%s%c\n", indent(numIndent).c_str(), val);
std::cout << indent(numIndent).c_str() << val << std::endl;
}
void inprintU(uint64_t val, uintmax_t numIndent) {
printf("%s%lu\n", indent(numIndent).c_str(), val);
std::cout << indent(numIndent).c_str() << val << std::endl;
}
void printTableRefInfo(TableRef* table, uintmax_t numIndent) {
@ -109,7 +109,7 @@ namespace hsql {
printOperatorExpression(expr, numIndent);
break;
default:
fprintf(stderr, "Unrecognized expression type %d\n", expr->type);
std::cerr << "Unrecognized expression type " << expr->type << std::endl;
return;
}
if (expr->alias != nullptr) {