Skip to content

Commit

Permalink
src: manual formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers committed Aug 3, 2024
1 parent 432f0c4 commit a2b352b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
20 changes: 11 additions & 9 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ void DatabaseSync::CreateSession(const FunctionCallbackInfo<Value>& args) {

BaseObjectPtr<Session> session =
Session::Create(env, BaseObjectWeakPtr<DatabaseSync>(db), pSession);

args.GetReturnValue().Set(session->object());
}

Expand All @@ -316,8 +315,9 @@ void DatabaseSync::ApplyChangeset(const FunctionCallbackInfo<Value>& args) {
DatabaseSync* db;
ASSIGN_OR_RETURN_UNWRAP(&db, args.This());
Environment* env = Environment::GetCurrent(args);
THROW_AND_RETURN_ON_BAD_STATE(
env, db->connection_ == nullptr, "database is not open");
THROW_AND_RETURN_ON_BAD_STATE(env,
db->connection_ == nullptr,
"database is not open");

if (!args[0]->IsUint8Array()) {
node::THROW_ERR_INVALID_ARG_TYPE(
Expand Down Expand Up @@ -380,19 +380,21 @@ void DatabaseSync::ApplyChangeset(const FunctionCallbackInfo<Value>& args) {
filterCallback = [env, filterFunc](std::string item) -> bool {
Local<Value> argv[] = {
String::NewFromUtf8(env->isolate(),
item.c_str(),
v8::NewStringType::kNormal).ToLocalChecked()
item.c_str(),
v8::NewStringType::kNormal).ToLocalChecked()
};
Local<Value> result = filterFunc->Call(
env->context(),
Null(env->isolate()), 1, argv).ToLocalChecked();
Local<Value> result = filterFunc->Call(env->context(),
Null(env->isolate()),
1,
argv).ToLocalChecked();
return result->BooleanValue(env->isolate());
};
}
}

ArrayBufferViewContents<uint8_t> buf(args[0]);
int r = sqlite3changeset_apply(db->connection_,
int r = sqlite3changeset_apply(
db->connection_,
buf.length(),
const_cast<void *>(static_cast<const void *>(buf.data())),
xFilter,
Expand Down
5 changes: 2 additions & 3 deletions src/node_sqlite.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#ifndef SRC_NODE_SQLITE_H_
#define SRC_NODE_SQLITE_H_

// TODO(louwers): move to gyp config
#define SQLITE_ENABLE_SESSION

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#define SQLITE_ENABLE_SESSION

#include "base_object.h"
#include "node_mem.h"
#include "sqlite3.h"
Expand Down

0 comments on commit a2b352b

Please sign in to comment.