Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 generate/templates/manual/include/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Wrapper : public Nan::ObjectWrap {
static void InitializeComponent (Local<v8::Object> target);

void *GetValue();
static Local<v8::Value> New(void *raw);
static Local<v8::Value> New(const void *raw);

private:
Wrapper(void *raw);
Expand Down
4 changes: 2 additions & 2 deletions 4 generate/templates/manual/src/convenient_patch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ NAN_METHOD(ConvenientPatch::OldFile) {
git_diff_file *old_file = (git_diff_file *)malloc(sizeof(git_diff_file));
*old_file = Nan::ObjectWrap::Unwrap<ConvenientPatch>(info.This())->GetOldFile();

to = GitDiffFile::New((void *)old_file, true);
to = GitDiffFile::New(old_file, true);

return info.GetReturnValue().Set(to);
}
Expand All @@ -315,7 +315,7 @@ NAN_METHOD(ConvenientPatch::NewFile) {
git_diff_file *new_file = (git_diff_file *)malloc(sizeof(git_diff_file));
*new_file = Nan::ObjectWrap::Unwrap<ConvenientPatch>(info.This())->GetNewFile();
if (new_file != NULL) {
to = GitDiffFile::New((void *)new_file, true);
to = GitDiffFile::New(new_file, true);
} else {
to = Nan::Null();
}
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/manual/src/wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ NAN_METHOD(Wrapper::JSNewFunction) {
info.GetReturnValue().Set(info.This());
}

Local<v8::Value> Wrapper::New(void *raw) {
Local<v8::Value> Wrapper::New(const void *raw) {
Nan::EscapableHandleScope scope;

Local<v8::Value> argv[1] = { Nan::New<External>((void *)raw) };
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/partials/callback_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_async(uv_as
{% if arg.isEnum %}
Nan::New((int)baton->{{ arg.name }}),
{% elsif arg.isLibgitType %}
{{ arg.cppClassName }}::New((void *)baton->{{ arg.name }}, false),
{{ arg.cppClassName }}::New(baton->{{ arg.name }}, false),
{% elsif arg.cType == "size_t" %}
// HACK: NAN should really have an overload for Nan::New to support size_t
Nan::New((unsigned int)baton->{{ arg.name }}),
Expand Down
4 changes: 2 additions & 2 deletions 4 generate/templates/partials/convert_to_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
if ({{= parsedName =}} != NULL) {
// {{= cppClassName }} {{= parsedName }}
{% if cppClassName == 'Wrapper' %}
to = {{ cppClassName }}::New((void *){{= parsedName =}});
to = {{ cppClassName }}::New({{= parsedName =}});
{% else %}
to = {{ cppClassName }}::New((void *){{= parsedName =}}, false);
to = {{ cppClassName }}::New({{= parsedName =}}, false);
{% endif %}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/partials/field_accessors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
{% if arg.isEnum %}
Nan::New((int)baton->{{ arg.name }}),
{% elsif arg.isLibgitType %}
{{ arg.cppClassName }}::New((void *)baton->{{ arg.name }}, false),
{{ arg.cppClassName }}::New(baton->{{ arg.name }}, false),
{% elsif arg.cType == "size_t" %}
// HACK: NAN should really have an overload for Nan::New to support size_t
Nan::New((unsigned int)baton->{{ arg.name }}),
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/templates/class_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ using namespace node;
info.GetReturnValue().Set(info.This());
}

Local<v8::Value> {{ cppClassName }}::New(void *raw, bool selfFreeing) {
Local<v8::Value> {{ cppClassName }}::New(const {{ cType }} *raw, bool selfFreeing) {
Nan::EscapableHandleScope scope;
Local<v8::Value> argv[2] = { Nan::New<External>((void *)raw), Nan::New(selfFreeing) };
return scope.Escape(Nan::NewInstance(Nan::New({{ cppClassName }}::constructor_template), 2, argv).ToLocalChecked());
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/templates/class_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class {{ cppClassName }} : public Nan::ObjectWrap {
{{ cType }} *GetValue();
void ClearValue();

static Local<v8::Value> New(void *raw, bool selfFreeing);
static Local<v8::Value> New(const {{ cType }} *raw, bool selfFreeing);
{%endif%}
bool selfFreeing;

Expand Down
4 changes: 2 additions & 2 deletions 4 generate/templates/templates/struct_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void {{ cppClassName }}::ConstructFields() {
{% if not field.isEnum %}
{% if field.hasConstructor |or field.isLibgitType %}
Local<Object> {{ field.name }}Temp = {{ field.cppClassName }}::New(
&this->raw->{{ field.name }},
{%if not field.cType|isPointer %}&{%endif%}this->raw->{{ field.name }},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes...

false
)->ToObject();
this->{{ field.name }}.Reset({{ field.name }}Temp);
Expand Down Expand Up @@ -131,7 +131,7 @@ NAN_METHOD({{ cppClassName }}::JSNewFunction) {
info.GetReturnValue().Set(info.This());
}

Local<v8::Value> {{ cppClassName }}::New(void* raw, bool selfFreeing) {
Local<v8::Value> {{ cppClassName }}::New(const {{ cType }} * raw, bool selfFreeing) {
Nan::EscapableHandleScope scope;

Local<v8::Value> argv[2] = { Nan::New<External>((void *)raw), Nan::New<Boolean>(selfFreeing) };
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/templates/struct_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class {{ cppClassName }} : public Nan::ObjectWrap {
{{ cType }} *GetValue();
void ClearValue();

static Local<v8::Value> New(void *raw, bool selfFreeing);
static Local<v8::Value> New(const {{ cType }} *raw, bool selfFreeing);

bool selfFreeing;

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.