@@ -80,7 +80,7 @@ git_odb *GitOdb::GetValue() {
8080Handle<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 */
308308Handle<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);
0 commit comments