@@ -241,31 +241,32 @@ PHP_FUNCTION(git_odb_foreach)
241
241
if (php_git2_cb_init (& cb , & fci , & fcc , payload TSRMLS_CC )) {
242
242
RETURN_FALSE ;
243
243
}
244
+ // TODO(chobie): implment callback */
244
245
//result = git_odb_foreach(PHP_GIT2_V(_db, odb), <CHANGEME>, cb);
245
246
php_git2_cb_free (cb );
246
247
RETURN_LONG (result );
247
248
}
248
249
/* }}} */
249
250
250
- /* {{{ proto resource git_odb_write(resource $odb, $data, long $len, $type)
251
+ /* {{{ proto resource git_odb_write(resource $odb, $data, $type)
251
252
*/
252
253
PHP_FUNCTION (git_odb_write )
253
254
{
254
255
php_git2_t * result = NULL , * _odb = NULL ;
255
256
git_oid out = {0 };
256
- zval * odb = NULL , * type = NULL ;
257
+ zval * odb = NULL ;
257
258
zval * data = NULL ;
258
- long len = 0 ;
259
- int error = 0 ;
259
+ long type = 0 ;
260
+ int error = 0 , data_len = 0 ;
260
261
char buf [41 ] = {0 };
261
262
262
263
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
263
- "r<void>l<git_otype> " , & odb , & data , & len , & type ) == FAILURE ) {
264
+ "rsl " , & odb , & data , & data_len , & type ) == FAILURE ) {
264
265
return ;
265
266
}
266
267
267
268
ZEND_FETCH_RESOURCE (_odb , php_git2_t * , & odb , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
268
- error = git_odb_write (& out , PHP_GIT2_V (_odb , odb ), data , len , type );
269
+ error = git_odb_write (& out , PHP_GIT2_V (_odb , odb ), data , data_len , type );
269
270
if (php_git2_check_error (error , "git_odb_write" TSRMLS_CC )) {
270
271
RETURN_FALSE ;
271
272
}
@@ -280,12 +281,12 @@ PHP_FUNCTION(git_odb_open_wstream)
280
281
{
281
282
php_git2_t * result = NULL , * _db = NULL ;
282
283
git_odb_stream * out = NULL ;
283
- zval * db = NULL , * type = NULL ;
284
- long size = 0 ;
284
+ zval * db = NULL ;
285
+ long size = 0 , type = 0 ;
285
286
int error = 0 ;
286
287
287
288
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
288
- "rl<git_otype> " , & db , & size , & type ) == FAILURE ) {
289
+ "rll " , & db , & size , & type ) == FAILURE ) {
289
290
return ;
290
291
}
291
292
@@ -301,23 +302,22 @@ PHP_FUNCTION(git_odb_open_wstream)
301
302
}
302
303
/* }}} */
303
304
304
- /* {{{ proto long git_odb_stream_write(resource $stream, string $buffer, long $len )
305
+ /* {{{ proto long git_odb_stream_write(resource $stream, string $buffer)
305
306
*/
306
307
PHP_FUNCTION (git_odb_stream_write )
307
308
{
308
309
int result = 0 , buffer_len = 0 , error = 0 ;
309
310
zval * stream = NULL ;
310
311
php_git2_t * _stream = NULL ;
311
312
char * buffer = NULL ;
312
- long len = 0 ;
313
313
314
314
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
315
- "rsl " , & stream , & buffer , & buffer_len , & len ) == FAILURE ) {
315
+ "rs " , & stream , & buffer , & buffer_len ) == FAILURE ) {
316
316
return ;
317
317
}
318
318
319
319
ZEND_FETCH_RESOURCE (_stream , php_git2_t * , & stream , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
320
- result = git_odb_stream_write (PHP_GIT2_V (_stream , odb_stream ), buffer , len );
320
+ result = git_odb_stream_write (PHP_GIT2_V (_stream , odb_stream ), buffer , buffer_len );
321
321
RETURN_LONG (result );
322
322
}
323
323
/* }}} */
@@ -452,23 +452,22 @@ PHP_FUNCTION(git_odb_write_pack)
452
452
}
453
453
/* }}} */
454
454
455
- /* {{{ proto resource git_odb_hash( $data, long $len, $type)
455
+ /* {{{ proto resource git_odb_hash(string $data, long $type)
456
456
*/
457
457
PHP_FUNCTION (git_odb_hash )
458
458
{
459
459
php_git2_t * result = NULL ;
460
460
git_oid out = {0 };
461
461
zval * data = NULL ;
462
- long len = 0 ;
463
- zval * type = NULL ;
464
- int error = 0 ;
462
+ int error = 0 , data_len = 0 ;
463
+ long type = 0 ;
465
464
char buf [41 ] = {0 };
466
465
467
466
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
468
- "<void>l<git_otype> " , & data , & len , & type ) == FAILURE ) {
467
+ "sl " , & data , & data_len , & type ) == FAILURE ) {
469
468
return ;
470
469
}
471
- error = git_odb_hash (& out , data , len , type );
470
+ error = git_odb_hash (& out , data , data_len , type );
472
471
if (php_git2_check_error (error , "git_odb_hash" TSRMLS_CC )) {
473
472
RETURN_FALSE ;
474
473
}
@@ -485,11 +484,11 @@ PHP_FUNCTION(git_odb_hashfile)
485
484
git_oid out = {0 };
486
485
char * path = NULL ;
487
486
int path_len = 0 , error = 0 ;
488
- zval * type = NULL ;
489
487
char buf [41 ] = {0 };
488
+ long type = 0 ;
490
489
491
490
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
492
- "s<git_otype> " , & path , & path_len , & type ) == FAILURE ) {
491
+ "sl " , & path , & path_len , & type ) == FAILURE ) {
493
492
return ;
494
493
}
495
494
error = git_odb_hashfile (& out , path , type );
0 commit comments