Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sqlite3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
node-sqlite3
Commits
6d40993d
Commit
6d40993d
authored
Apr 16, 2020
by
Mohamed Akram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing return
parent
99d7126b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
+12
-1
database.cc
src/database.cc
+6
-1
macros.h
src/macros.h
+6
-0
No files found.
src/database.cc
View file @
6d40993d
...
@@ -110,7 +110,12 @@ Database::Database(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Database>(
...
@@ -110,7 +110,12 @@ Database::Database(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Database>(
init
();
init
();
Napi
::
Env
env
=
info
.
Env
();
Napi
::
Env
env
=
info
.
Env
();
REQUIRE_ARGUMENT_STRING
(
0
,
filename
);
if
(
info
.
Length
()
<=
0
||
!
info
[
0
].
IsString
())
{
Napi
::
TypeError
::
New
(
env
,
"String expected"
).
ThrowAsJavaScriptException
();
return
;
}
std
::
string
filename
=
info
[
0
].
As
<
Napi
::
String
>
();
unsigned
int
pos
=
1
;
unsigned
int
pos
=
1
;
int
mode
;
int
mode
;
...
...
src/macros.h
View file @
6d40993d
...
@@ -26,12 +26,14 @@ inline bool OtherIsInt(Napi::Number source) {
...
@@ -26,12 +26,14 @@ inline bool OtherIsInt(Napi::Number source) {
#define REQUIRE_ARGUMENTS(n) \
#define REQUIRE_ARGUMENTS(n) \
if (info.Length() < (n)) { \
if (info.Length() < (n)) { \
Napi::TypeError::New(env, "Expected " #n "arguments").ThrowAsJavaScriptException(); \
Napi::TypeError::New(env, "Expected " #n "arguments").ThrowAsJavaScriptException(); \
return env.Null(); \
}
}
#define REQUIRE_ARGUMENT_EXTERNAL(i, var) \
#define REQUIRE_ARGUMENT_EXTERNAL(i, var) \
if (info.Length() <= (i) || !info[i].IsExternal()) { \
if (info.Length() <= (i) || !info[i].IsExternal()) { \
Napi::TypeError::New(env, "Argument " #i " invalid").ThrowAsJavaScriptException(); \
Napi::TypeError::New(env, "Argument " #i " invalid").ThrowAsJavaScriptException(); \
return env.Null(); \
} \
} \
Napi::External var = info[i].As<Napi::External>();
Napi::External var = info[i].As<Napi::External>();
...
@@ -39,6 +41,7 @@ inline bool OtherIsInt(Napi::Number source) {
...
@@ -39,6 +41,7 @@ inline bool OtherIsInt(Napi::Number source) {
#define REQUIRE_ARGUMENT_FUNCTION(i, var) \
#define REQUIRE_ARGUMENT_FUNCTION(i, var) \
if (info.Length() <= (i) || !info[i].IsFunction()) { \
if (info.Length() <= (i) || !info[i].IsFunction()) { \
Napi::TypeError::New(env, "Argument " #i " must be a function").ThrowAsJavaScriptException(); \
Napi::TypeError::New(env, "Argument " #i " must be a function").ThrowAsJavaScriptException(); \
return env.Null(); \
} \
} \
Napi::Function var = info[i].As<Napi::Function>();
Napi::Function var = info[i].As<Napi::Function>();
...
@@ -46,6 +49,7 @@ inline bool OtherIsInt(Napi::Number source) {
...
@@ -46,6 +49,7 @@ inline bool OtherIsInt(Napi::Number source) {
#define REQUIRE_ARGUMENT_STRING(i, var) \
#define REQUIRE_ARGUMENT_STRING(i, var) \
if (info.Length() <= (i) || !info[i].IsString()) { \
if (info.Length() <= (i) || !info[i].IsString()) { \
Napi::TypeError::New(env, "Argument " #i " must be a string").ThrowAsJavaScriptException(); \
Napi::TypeError::New(env, "Argument " #i " must be a string").ThrowAsJavaScriptException(); \
return env.Null(); \
} \
} \
std::string var = info[i].As<Napi::String>();
std::string var = info[i].As<Napi::String>();
...
@@ -61,6 +65,7 @@ inline bool OtherIsInt(Napi::Number source) {
...
@@ -61,6 +65,7 @@ inline bool OtherIsInt(Napi::Number source) {
if (info.Length() > i && !info[i].IsUndefined()) { \
if (info.Length() > i && !info[i].IsUndefined()) { \
if (!info[i].IsFunction()) { \
if (!info[i].IsFunction()) { \
Napi::TypeError::New(env, "Argument " #i " must be a function").ThrowAsJavaScriptException(); \
Napi::TypeError::New(env, "Argument " #i " must be a function").ThrowAsJavaScriptException(); \
return env.Null(); \
} \
} \
var = info[i].As<Napi::Function>(); \
var = info[i].As<Napi::Function>(); \
}
}
...
@@ -78,6 +83,7 @@ inline bool OtherIsInt(Napi::Number source) {
...
@@ -78,6 +83,7 @@ inline bool OtherIsInt(Napi::Number source) {
} \
} \
else { \
else { \
Napi::TypeError::New(env, "Argument " #i " must be an integer").ThrowAsJavaScriptException(); \
Napi::TypeError::New(env, "Argument " #i " must be an integer").ThrowAsJavaScriptException(); \
return env.Null(); \
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment