mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-07 02:56:44 +00:00
Cosmetic changes to whitespace
Make it easier to edit in Vim
This commit is contained in:
parent
5e164607aa
commit
ae5ae2d394
@ -289,11 +289,11 @@ int cli_write(struct cli_context *context, const unsigned char *buf, size_t len)
|
||||
int cli_puts(struct cli_context *context, const char *str)
|
||||
{
|
||||
#ifdef HAVE_JNI_H
|
||||
if (context && context->jni_env)
|
||||
return cli_write(context, (const unsigned char *) str, strlen(str));
|
||||
else
|
||||
if (context && context->jni_env)
|
||||
return cli_write(context, (const unsigned char *) str, strlen(str));
|
||||
else
|
||||
#endif
|
||||
return fputs(str, stdout);
|
||||
return fputs(str, stdout);
|
||||
}
|
||||
|
||||
/* Write a formatted string to output. If in a JNI call, then this appends the string to the
|
||||
@ -329,7 +329,8 @@ int cli_printf(struct cli_context *context, const char *fmt, ...)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void cli_columns(struct cli_context *context, int columns, const char *names[]){
|
||||
void cli_columns(struct cli_context *context, int columns, const char *names[])
|
||||
{
|
||||
#ifdef HAVE_JNI_H
|
||||
if (context && context->jni_env) {
|
||||
(*context->jni_env)->CallVoidMethod(context->jni_env, context->jniResults, startResultSet, columns);
|
||||
@ -352,7 +353,7 @@ void cli_columns(struct cli_context *context, int columns, const char *names[]){
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
cli_printf(context, "%d",columns);
|
||||
cli_printf(context, "%d", columns);
|
||||
cli_delim(context, "\n");
|
||||
int i;
|
||||
for (i=0;i<columns;i++){
|
||||
@ -364,7 +365,8 @@ void cli_columns(struct cli_context *context, int columns, const char *names[]){
|
||||
}
|
||||
}
|
||||
|
||||
void cli_field_name(struct cli_context *context, const char *name, const char *delim){
|
||||
void cli_field_name(struct cli_context *context, const char *name, const char *delim)
|
||||
{
|
||||
#ifdef HAVE_JNI_H
|
||||
if (context && context->jni_env) {
|
||||
jstring str = (jstring)(*context->jni_env)->NewStringUTF(context->jni_env, name);
|
||||
@ -1276,7 +1278,7 @@ int app_rhizome_hash_file(const struct cli_parsed *parsed, struct cli_context *c
|
||||
const char *filepath;
|
||||
cli_arg(parsed, "filepath", &filepath, NULL, "");
|
||||
char hexhash[RHIZOME_FILEHASH_STRLEN + 1];
|
||||
if (rhizome_hash_file(NULL,filepath, hexhash))
|
||||
if (rhizome_hash_file(NULL, filepath, hexhash))
|
||||
return -1;
|
||||
cli_put_string(context, hexhash, "\n");
|
||||
return 0;
|
||||
|
@ -349,7 +349,7 @@ int rhizome_read_manifest_file(rhizome_manifest *m, const char *filename, int bu
|
||||
return rhizome_manifest_parse(m);
|
||||
}
|
||||
|
||||
int rhizome_hash_file(rhizome_manifest *m,const char *filename,char *hash_out)
|
||||
int rhizome_hash_file(rhizome_manifest *m, const char *filename, char *hash_out)
|
||||
{
|
||||
/* Gnarf! NaCl's crypto_hash() function needs the whole file passed in in one
|
||||
go. Trouble is, we need to run Serval DNA on filesystems that lack mmap(),
|
||||
|
@ -5,14 +5,11 @@
|
||||
|
||||
#define RHIZOME_BUFFER_MAXIMUM_SIZE (1024*1024)
|
||||
|
||||
int rhizome_exists(const char *fileHash){
|
||||
int rhizome_exists(const char *fileHash)
|
||||
{
|
||||
int64_t gotfile = 0;
|
||||
|
||||
if (sqlite_exec_int64(&gotfile,
|
||||
"SELECT COUNT(*) FROM FILES WHERE ID='%s' and datavalid=1;",
|
||||
fileHash) != 1){
|
||||
if (sqlite_exec_int64(&gotfile, "SELECT COUNT(*) FROM FILES WHERE ID='%s' and datavalid=1;", fileHash) != 1)
|
||||
return 0;
|
||||
}
|
||||
return gotfile;
|
||||
}
|
||||
|
||||
@ -418,7 +415,8 @@ end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rhizome_fail_write(struct rhizome_write *write){
|
||||
int rhizome_fail_write(struct rhizome_write *write)
|
||||
{
|
||||
if (write->blob_fd>=0){
|
||||
if (config.debug.externalblobs)
|
||||
DEBUGF("Closing and removing fd %d", write->blob_fd);
|
||||
@ -435,7 +433,8 @@ int rhizome_fail_write(struct rhizome_write *write){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rhizome_finish_write(struct rhizome_write *write){
|
||||
int rhizome_finish_write(struct rhizome_write *write)
|
||||
{
|
||||
if (write->blob_rowid==-1 && write->blob_fd == -1)
|
||||
return WHY("Can't finish a write that has already been closed");
|
||||
if (write->buffer_list){
|
||||
@ -461,7 +460,7 @@ int rhizome_finish_write(struct rhizome_write *write){
|
||||
if (write_release_lock(write))
|
||||
goto failure;
|
||||
|
||||
char hash_out[SHA512_DIGEST_STRING_LENGTH+1];
|
||||
char hash_out[SHA512_DIGEST_STRING_LENGTH + 1];
|
||||
SHA512_End(&write->sha512_context, hash_out);
|
||||
|
||||
sqlite_retry_state retry = SQLITE_RETRY_STATE_DEFAULT;
|
||||
@ -472,7 +471,7 @@ int rhizome_finish_write(struct rhizome_write *write){
|
||||
WHYF("Expected hash=%s, got %s", write->id, hash_out);
|
||||
goto failure;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
strlcpy(write->id, hash_out, SHA512_DIGEST_STRING_LENGTH);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user