Skip to content

Commit 6ca5347

Browse files
committed
Resolved a number of compiler warnings regarding return values
Specifically the return values of git_index_find and git_odb_read_header.
1 parent 62da608 commit 6ca5347

File tree

16 files changed

+79
-68
lines changed

16 files changed

+79
-68
lines changed

src/branch.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Handle<Value> Branch::Create(const Arguments& args) {
9393
return ThrowException(Exception::Error(String::New("Number force is required.")));
9494
}
9595

96-
git_reference *out = 0;
96+
git_reference * out = 0;
9797
git_repository * from_repo;
9898
from_repo = ObjectWrap::Unwrap<GitRepo>(args[0]->ToObject())->GetValue();
9999
const char * from_branch_name;
@@ -220,7 +220,7 @@ Handle<Value> Branch::Move(const Arguments& args) {
220220
return ThrowException(Exception::Error(String::New("Number force is required.")));
221221
}
222222

223-
git_reference *out = 0;
223+
git_reference * out = 0;
224224
git_reference * from_branch;
225225
from_branch = ObjectWrap::Unwrap<GitReference>(args[0]->ToObject())->GetValue();
226226
const char * from_new_branch_name;
@@ -271,7 +271,7 @@ Handle<Value> Branch::Lookup(const Arguments& args) {
271271
return ThrowException(Exception::Error(String::New("BranchT branch_type is required.")));
272272
}
273273

274-
git_reference *out = 0;
274+
git_reference * out = 0;
275275
git_repository * from_repo;
276276
from_repo = ObjectWrap::Unwrap<GitRepo>(args[0]->ToObject())->GetValue();
277277
const char * from_branch_name;
@@ -314,7 +314,7 @@ Handle<Value> Branch::Name(const Arguments& args) {
314314
return ThrowException(Exception::Error(String::New("Reference ref is required.")));
315315
}
316316

317-
const char *out = 0;
317+
const char * out = 0;
318318
git_reference * from_ref;
319319
from_ref = ObjectWrap::Unwrap<GitReference>(args[0]->ToObject())->GetValue();
320320

@@ -345,7 +345,7 @@ Handle<Value> Branch::Upstream(const Arguments& args) {
345345
return ThrowException(Exception::Error(String::New("Reference branch is required.")));
346346
}
347347

348-
git_reference *out = 0;
348+
git_reference * out = 0;
349349
git_reference * from_branch;
350350
from_branch = ObjectWrap::Unwrap<GitReference>(args[0]->ToObject())->GetValue();
351351

src/commit.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Handle<Value> GitCommit::NthGenAncestor(const Arguments& args) {
287287
return ThrowException(Exception::Error(String::New("Number n is required.")));
288288
}
289289

290-
git_commit *ancestor = 0;
290+
git_commit * ancestor = 0;
291291
unsigned int from_n;
292292
from_n = (unsigned int) args[0]->ToUint32()->Value();
293293

src/diff_list.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ Handle<Value> GitDiffList::Patch(const Arguments& args) {
182182
return ThrowException(Exception::Error(String::New("Number idx is required.")));
183183
}
184184

185-
git_diff_patch *patch_out = 0;
186-
const git_diff_delta *delta_out = 0;
185+
git_diff_patch * patch_out = 0;
186+
const git_diff_delta * delta_out = 0;
187187
size_t from_idx;
188188
from_idx = (size_t) args[0]->ToUint32()->Value();
189189

src/index.cc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -676,34 +676,29 @@ Handle<Value> GitIndex::RemoveBypath(const Arguments& args) {
676676
}
677677

678678
/**
679-
* @param {Number} at_pos
680679
* @param {String} path
681-
* @return {Number} result
680+
* @return {Number} at_pos
682681
*/
683682
Handle<Value> GitIndex::Find(const Arguments& args) {
684683
HandleScope scope;
685-
if (args.Length() == 0 || !args[0]->IsUint32()) {
686-
return ThrowException(Exception::Error(String::New("Number at_pos is required.")));
687-
}
688-
if (args.Length() == 1 || !args[1]->IsString()) {
684+
if (args.Length() == 0 || !args[0]->IsString()) {
689685
return ThrowException(Exception::Error(String::New("String path is required.")));
690686
}
691687

692-
size_t * from_at_pos;
693-
from_at_pos = (size_t *) args[0]->ToUint32()->Value();
694-
const char * from_path;
695-
String::Utf8Value path(args[1]->ToString());
688+
size_t at_pos = 0;
689+
const char * from_path;
690+
String::Utf8Value path(args[0]->ToString());
696691
from_path = strdup(*path);
697692

698693
int result = git_index_find(
699-
from_at_pos
694+
&at_pos
700695
, ObjectWrap::Unwrap<GitIndex>(args.This())->GetValue()
701696
, from_path
702697
);
703698
free((void *)from_path);
704699

705700
Handle<Value> to;
706-
to = Int32::New(result);
701+
to = Uint32::New(at_pos);
707702
return scope.Close(to);
708703
}
709704

src/odb.cc

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ git_odb *GitOdb::GetValue() {
8080
Handle<Value> GitOdb::Create(const Arguments& args) {
8181
HandleScope scope;
8282

83-
git_odb *out = 0;
83+
git_odb * out = 0;
8484

8585
int result = git_odb_new(
8686
&out
@@ -112,7 +112,7 @@ Handle<Value> GitOdb::Open(const Arguments& args) {
112112
return ThrowException(Exception::Error(String::New("String objects_dir is required.")));
113113
}
114114

115-
git_odb *out = 0;
115+
git_odb * out = 0;
116116
const char * from_objects_dir;
117117
String::Utf8Value objects_dir(args[0]->ToString());
118118
from_objects_dir = strdup(*objects_dir);
@@ -268,7 +268,7 @@ Handle<Value> GitOdb::ReadPrefix(const Arguments& args) {
268268
return ThrowException(Exception::Error(String::New("Number len is required.")));
269269
}
270270

271-
git_odb_object *out = 0;
271+
git_odb_object * out = 0;
272272
git_odb * from_db;
273273
from_db = ObjectWrap::Unwrap<GitOdb>(args[0]->ToObject())->GetValue();
274274
const git_oid * from_short_id;
@@ -300,38 +300,30 @@ Handle<Value> GitOdb::ReadPrefix(const Arguments& args) {
300300
}
301301

302302
/**
303-
* @param {Number} len_out
304-
* @param {Number} type_out
305303
* @param {Odb} db
306304
* @param {Oid} id
305+
* @return {Number} len_out
306+
* @return {Number} type_out
307307
*/
308308
Handle<Value> GitOdb::ReadHeader(const Arguments& args) {
309309
HandleScope scope;
310-
if (args.Length() == 0 || !args[0]->IsUint32()) {
311-
return ThrowException(Exception::Error(String::New("Number len_out is required.")));
312-
}
313-
if (args.Length() == 1 || !args[1]->IsInt32()) {
314-
return ThrowException(Exception::Error(String::New("Number type_out is required.")));
315-
}
316-
if (args.Length() == 2 || !args[2]->IsObject()) {
310+
if (args.Length() == 0 || !args[0]->IsObject()) {
317311
return ThrowException(Exception::Error(String::New("Odb db is required.")));
318312
}
319-
if (args.Length() == 3 || !args[3]->IsObject()) {
313+
if (args.Length() == 1 || !args[1]->IsObject()) {
320314
return ThrowException(Exception::Error(String::New("Oid id is required.")));
321315
}
322316

323-
size_t * from_len_out;
324-
from_len_out = (size_t *) args[0]->ToUint32()->Value();
325-
git_otype * from_type_out;
326-
from_type_out = (git_otype *) args[1]->ToInt32()->Value();
327-
git_odb * from_db;
328-
from_db = ObjectWrap::Unwrap<GitOdb>(args[2]->ToObject())->GetValue();
317+
size_t len_out = 0;
318+
git_otype type_out = GIT_OBJ_ANY;
319+
git_odb * from_db;
320+
from_db = ObjectWrap::Unwrap<GitOdb>(args[0]->ToObject())->GetValue();
329321
const git_oid * from_id;
330-
from_id = ObjectWrap::Unwrap<GitOid>(args[3]->ToObject())->GetValue();
322+
from_id = ObjectWrap::Unwrap<GitOid>(args[1]->ToObject())->GetValue();
331323

332324
int result = git_odb_read_header(
333-
from_len_out
334-
, from_type_out
325+
&len_out
326+
, &type_out
335327
, from_db
336328
, from_id
337329
);
@@ -343,7 +335,15 @@ Handle<Value> GitOdb::ReadHeader(const Arguments& args) {
343335
}
344336
}
345337

346-
return Undefined();
338+
Handle<Object> toReturn = Object::New();
339+
Handle<Value> to;
340+
to = Uint32::New(len_out);
341+
toReturn->Set(String::NewSymbol("len_out"), to);
342+
343+
to = Int32::New(type_out);
344+
toReturn->Set(String::NewSymbol("type_out"), to);
345+
346+
return scope.Close(toReturn);
347347
}
348348

349349
/**
@@ -517,7 +517,7 @@ Handle<Value> GitOdb::Hash(const Arguments& args) {
517517
return ThrowException(Exception::Error(String::New("Number type is required.")));
518518
}
519519

520-
git_oid *out = (git_oid *)malloc(sizeof(git_oid ));
520+
git_oid *out = (git_oid *)malloc(sizeof(git_oid));
521521
const void * from_data;
522522
from_data = Buffer::Data(args[0]->ToObject());
523523
size_t from_len;
@@ -563,7 +563,7 @@ Handle<Value> GitOdb::Hashfile(const Arguments& args) {
563563
return ThrowException(Exception::Error(String::New("Number type is required.")));
564564
}
565565

566-
git_oid *out = (git_oid *)malloc(sizeof(git_oid ));
566+
git_oid *out = (git_oid *)malloc(sizeof(git_oid));
567567
const char * from_path;
568568
String::Utf8Value path(args[0]->ToString());
569569
from_path = strdup(*path);

src/oid.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Handle<Value> GitOid::FromString(const Arguments& args) {
7272
return ThrowException(Exception::Error(String::New("String str is required.")));
7373
}
7474

75-
git_oid *out = (git_oid *)malloc(sizeof(git_oid ));
75+
git_oid *out = (git_oid *)malloc(sizeof(git_oid));
7676
const char * from_str;
7777
String::Utf8Value str(args[0]->ToString());
7878
from_str = strdup(*str);

src/patch.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ Handle<Value> GitPatch::Hunk(const Arguments& args) {
161161
return ThrowException(Exception::Error(String::New("Number hunk_idx is required.")));
162162
}
163163

164-
const git_diff_range *range = 0;
165-
const char *header = 0;
164+
const git_diff_range * range = 0;
165+
const char * header = 0;
166166
size_t header_len = 0;
167167
size_t lines_in_hunk = 0;
168168
size_t from_hunk_idx;
@@ -250,7 +250,7 @@ Handle<Value> GitPatch::Line(const Arguments& args) {
250250
}
251251

252252
char line_origin = 0;
253-
const char *content = 0;
253+
const char * content = 0;
254254
size_t content_len = 0;
255255
int old_lineno = 0;
256256
int new_lineno = 0;
@@ -303,7 +303,7 @@ Handle<Value> GitPatch::Line(const Arguments& args) {
303303
Handle<Value> GitPatch::ToString(const Arguments& args) {
304304
HandleScope scope;
305305

306-
char *string = 0;
306+
char * string = 0;
307307

308308
int result = git_diff_patch_to_str(
309309
&string

src/reference.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ Handle<Value> GitReference::SetSymbolicTarget(const Arguments& args) {
322322
return ThrowException(Exception::Error(String::New("String target is required.")));
323323
}
324324

325-
git_reference *out = 0;
325+
git_reference * out = 0;
326326
const char * from_target;
327327
String::Utf8Value target(args[0]->ToString());
328328
from_target = strdup(*target);
@@ -360,7 +360,7 @@ Handle<Value> GitReference::setTarget(const Arguments& args) {
360360
return ThrowException(Exception::Error(String::New("Oid id is required.")));
361361
}
362362

363-
git_reference *out = 0;
363+
git_reference * out = 0;
364364
const git_oid * from_id;
365365
from_id = ObjectWrap::Unwrap<GitOid>(args[0]->ToObject())->GetValue();
366366

@@ -594,7 +594,7 @@ Handle<Value> GitReference::Peel(const Arguments& args) {
594594
return ThrowException(Exception::Error(String::New("Number type is required.")));
595595
}
596596

597-
git_object *out = 0;
597+
git_object * out = 0;
598598
git_otype from_type;
599599
from_type = (git_otype) args[0]->ToInt32()->Value();
600600

src/repo.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ Handle<Value> GitRepo::Workdir(const Arguments& args) {
313313
Handle<Value> GitRepo::Odb(const Arguments& args) {
314314
HandleScope scope;
315315

316-
git_odb *out = 0;
316+
git_odb * out = 0;
317317

318318
int result = git_repository_odb(
319319
&out
@@ -934,7 +934,7 @@ Handle<Value> GitRepo::CreateSymbolicReference(const Arguments& args) {
934934
return ThrowException(Exception::Error(String::New("Number force is required.")));
935935
}
936936

937-
git_reference *out = 0;
937+
git_reference * out = 0;
938938
const char * from_name;
939939
String::Utf8Value name(args[0]->ToString());
940940
from_name = strdup(*name);
@@ -988,7 +988,7 @@ Handle<Value> GitRepo::CreateReference(const Arguments& args) {
988988
return ThrowException(Exception::Error(String::New("Number force is required.")));
989989
}
990990

991-
git_reference *out = 0;
991+
git_reference * out = 0;
992992
const char * from_name;
993993
String::Utf8Value name(args[0]->ToString());
994994
from_name = strdup(*name);
@@ -1124,7 +1124,7 @@ void GitRepo::AddRemoteAfterWork(uv_work_t *req) {
11241124
Handle<Value> GitRepo::CreateRevWalk(const Arguments& args) {
11251125
HandleScope scope;
11261126

1127-
git_revwalk *out = 0;
1127+
git_revwalk * out = 0;
11281128

11291129
int result = git_revwalk_new(
11301130
&out
@@ -1157,7 +1157,7 @@ Handle<Value> GitRepo::GetSubmodule(const Arguments& args) {
11571157
return ThrowException(Exception::Error(String::New("String name is required.")));
11581158
}
11591159

1160-
git_submodule *submodule = 0;
1160+
git_submodule * submodule = 0;
11611161
const char * from_name;
11621162
String::Utf8Value name(args[0]->ToString());
11631163
from_name = strdup(*name);
@@ -1203,7 +1203,7 @@ Handle<Value> GitRepo::AddSubmodule(const Arguments& args) {
12031203
return ThrowException(Exception::Error(String::New("Number use_gitlink is required.")));
12041204
}
12051205

1206-
git_submodule *submodule = 0;
1206+
git_submodule * submodule = 0;
12071207
const char * from_url;
12081208
String::Utf8Value url(args[0]->ToString());
12091209
from_url = strdup(*url);
@@ -2235,7 +2235,7 @@ Handle<Value> GitRepo::GetRemote(const Arguments& args) {
22352235
return ThrowException(Exception::Error(String::New("String name is required.")));
22362236
}
22372237

2238-
git_remote *out = 0;
2238+
git_remote * out = 0;
22392239
const char * from_name;
22402240
String::Utf8Value name(args[0]->ToString());
22412241
from_name = strdup(*name);

src/signature.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Handle<Value> GitSignature::Create(const Arguments& args) {
8888
return ThrowException(Exception::Error(String::New("Number offset is required.")));
8989
}
9090

91-
git_signature *out = 0;
91+
git_signature * out = 0;
9292
const char * from_name;
9393
String::Utf8Value name(args[0]->ToString());
9494
from_name = strdup(*name);
@@ -140,7 +140,7 @@ Handle<Value> GitSignature::Now(const Arguments& args) {
140140
return ThrowException(Exception::Error(String::New("String email is required.")));
141141
}
142142

143-
git_signature *out = 0;
143+
git_signature * out = 0;
144144
const char * from_name;
145145
String::Utf8Value name(args[0]->ToString());
146146
from_name = strdup(*name);

0 commit comments

Comments
 (0)