Format miscellaneous files
Formatted client, avro and rabbitmq consumer files with Astyle.
This commit is contained in:
@ -204,20 +204,20 @@ const char* maxavro_get_error_string(MAXAVRO_FILE *file)
|
||||
{
|
||||
switch (file->last_error)
|
||||
{
|
||||
case MAXAVRO_ERR_IO:
|
||||
return "MAXAVRO_ERR_IO";
|
||||
case MAXAVRO_ERR_IO:
|
||||
return "MAXAVRO_ERR_IO";
|
||||
|
||||
case MAXAVRO_ERR_MEMORY:
|
||||
return "MAXAVRO_ERR_MEMORY";
|
||||
case MAXAVRO_ERR_MEMORY:
|
||||
return "MAXAVRO_ERR_MEMORY";
|
||||
|
||||
case MAXAVRO_ERR_VALUE_OVERFLOW:
|
||||
return "MAXAVRO_ERR_VALUE_OVERFLOW";
|
||||
case MAXAVRO_ERR_VALUE_OVERFLOW:
|
||||
return "MAXAVRO_ERR_VALUE_OVERFLOW";
|
||||
|
||||
case MAXAVRO_ERR_NONE:
|
||||
return "MAXAVRO_ERR_NONE";
|
||||
case MAXAVRO_ERR_NONE:
|
||||
return "MAXAVRO_ERR_NONE";
|
||||
|
||||
default:
|
||||
return "UNKNOWN ERROR";
|
||||
default:
|
||||
return "UNKNOWN ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *fie
|
||||
json_t* value = NULL;
|
||||
switch (field->type)
|
||||
{
|
||||
case MAXAVRO_TYPE_BOOL:
|
||||
case MAXAVRO_TYPE_BOOL:
|
||||
{
|
||||
int i = 0;
|
||||
if (fread(&i, 1, 1, file->file) == 1)
|
||||
@ -45,8 +45,8 @@ static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *fie
|
||||
}
|
||||
break;
|
||||
|
||||
case MAXAVRO_TYPE_INT:
|
||||
case MAXAVRO_TYPE_LONG:
|
||||
case MAXAVRO_TYPE_INT:
|
||||
case MAXAVRO_TYPE_LONG:
|
||||
{
|
||||
uint64_t val = 0;
|
||||
maxavro_read_integer(file, &val);
|
||||
@ -55,7 +55,7 @@ static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *fie
|
||||
}
|
||||
break;
|
||||
|
||||
case MAXAVRO_TYPE_ENUM:
|
||||
case MAXAVRO_TYPE_ENUM:
|
||||
{
|
||||
uint64_t val = 0;
|
||||
maxavro_read_integer(file, &val);
|
||||
@ -73,8 +73,8 @@ static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *fie
|
||||
}
|
||||
break;
|
||||
|
||||
case MAXAVRO_TYPE_FLOAT:
|
||||
case MAXAVRO_TYPE_DOUBLE:
|
||||
case MAXAVRO_TYPE_FLOAT:
|
||||
case MAXAVRO_TYPE_DOUBLE:
|
||||
{
|
||||
double d = 0;
|
||||
maxavro_read_double(file, &d);
|
||||
@ -82,8 +82,8 @@ static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *fie
|
||||
}
|
||||
break;
|
||||
|
||||
case MAXAVRO_TYPE_BYTES:
|
||||
case MAXAVRO_TYPE_STRING:
|
||||
case MAXAVRO_TYPE_BYTES:
|
||||
case MAXAVRO_TYPE_STRING:
|
||||
{
|
||||
char *str = maxavro_read_string(file);
|
||||
if (str)
|
||||
@ -94,9 +94,9 @@ static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *fie
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
MXS_ERROR("Unimplemented type: %d", field->type);
|
||||
break;
|
||||
default:
|
||||
MXS_ERROR("Unimplemented type: %d", field->type);
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@ -105,33 +105,33 @@ static void skip_value(MAXAVRO_FILE *file, enum maxavro_value_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MAXAVRO_TYPE_INT:
|
||||
case MAXAVRO_TYPE_LONG:
|
||||
case MAXAVRO_TYPE_ENUM:
|
||||
case MAXAVRO_TYPE_INT:
|
||||
case MAXAVRO_TYPE_LONG:
|
||||
case MAXAVRO_TYPE_ENUM:
|
||||
{
|
||||
uint64_t val = 0;
|
||||
maxavro_read_integer(file, &val);
|
||||
}
|
||||
break;
|
||||
|
||||
case MAXAVRO_TYPE_FLOAT:
|
||||
case MAXAVRO_TYPE_DOUBLE:
|
||||
case MAXAVRO_TYPE_FLOAT:
|
||||
case MAXAVRO_TYPE_DOUBLE:
|
||||
{
|
||||
double d = 0;
|
||||
maxavro_read_double(file, &d);
|
||||
}
|
||||
break;
|
||||
|
||||
case MAXAVRO_TYPE_BYTES:
|
||||
case MAXAVRO_TYPE_STRING:
|
||||
case MAXAVRO_TYPE_BYTES:
|
||||
case MAXAVRO_TYPE_STRING:
|
||||
{
|
||||
maxavro_skip_string(file);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
MXS_ERROR("Unimplemented type: %d - %s", type, type_to_string(type));
|
||||
break;
|
||||
default:
|
||||
MXS_ERROR("Unimplemented type: %d - %s", type, type_to_string(type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,18 +137,18 @@ int main(int argc, char** argv)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'd':
|
||||
dump = true;
|
||||
break;
|
||||
case 'f':
|
||||
seekto = strtol(optarg, NULL, 10);
|
||||
break;
|
||||
case 'c':
|
||||
num_rows = strtol(optarg, NULL, 10);
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'd':
|
||||
dump = true;
|
||||
break;
|
||||
case 'f':
|
||||
seekto = strtol(optarg, NULL, 10);
|
||||
break;
|
||||
case 'c':
|
||||
num_rows = strtol(optarg, NULL, 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,51 +147,51 @@ main(int argc, char **argv)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'h':
|
||||
use_inet_socket = true;
|
||||
hostname = strdup(optarg);
|
||||
break;
|
||||
case 'h':
|
||||
use_inet_socket = true;
|
||||
hostname = strdup(optarg);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
use_inet_socket = true;
|
||||
// If password was not given, ask for it later
|
||||
if (optarg != NULL)
|
||||
{
|
||||
passwd = strdup(optarg);
|
||||
memset(optarg, '\0', strlen(optarg));
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
use_inet_socket = true;
|
||||
// If password was not given, ask for it later
|
||||
if (optarg != NULL)
|
||||
{
|
||||
passwd = strdup(optarg);
|
||||
memset(optarg, '\0', strlen(optarg));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
use_inet_socket = true;
|
||||
port = strdup(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
use_inet_socket = true;
|
||||
port = strdup(optarg);
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
use_inet_socket = true;
|
||||
user = strdup(optarg);
|
||||
break;
|
||||
case 'u':
|
||||
use_inet_socket = true;
|
||||
user = strdup(optarg);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
use_unix_socket = true;
|
||||
socket_path = strdup(optarg);
|
||||
break;
|
||||
case 'S':
|
||||
use_unix_socket = true;
|
||||
socket_path = strdup(optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
PrintVersion(*argv);
|
||||
exit(EXIT_SUCCESS);
|
||||
case 'v':
|
||||
PrintVersion(*argv);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
case 'e':
|
||||
use_emacs = 1;
|
||||
break;
|
||||
case 'e':
|
||||
use_emacs = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
use_emacs = 0;
|
||||
break;
|
||||
case 'i':
|
||||
use_emacs = 0;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
DoUsage(argv[0]);
|
||||
exit(optopt ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
case '?':
|
||||
DoUsage(argv[0]);
|
||||
exit(optopt ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,13 +421,13 @@ int main(int argc, char** argv)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case 'c':
|
||||
cnfnlen = strlen(optarg);
|
||||
cnfpath = strdup(optarg);
|
||||
break;
|
||||
default:
|
||||
case 'c':
|
||||
cnfnlen = strlen(optarg);
|
||||
cnfpath = strdup(optarg);
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user