Skip to content

Commit 76c45f3

Browse files
committed
Use RETURN_THROWS() during ZPP in bz2, calendar, com_dotnet extensions
1 parent 3262c28 commit 76c45f3

File tree

8 files changed

+41
-42
lines changed

8 files changed

+41
-42
lines changed

ext/bz2/bz2.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static PHP_FUNCTION(bzread)
333333
zend_string *data;
334334

335335
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &bz, &len)) {
336-
return;
336+
RETURN_THROWS();
337337
}
338338

339339
php_stream_from_zval(stream, bz);
@@ -363,7 +363,7 @@ static PHP_FUNCTION(bzopen)
363363
php_stream *stream = NULL;
364364

365365
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &file, &mode, &mode_len) == FAILURE) {
366-
return;
366+
RETURN_THROWS();
367367
}
368368

369369
if (mode_len != 1 || (mode[0] != 'r' && mode[0] != 'w')) {
@@ -482,7 +482,7 @@ static PHP_FUNCTION(bzcompress)
482482
unsigned int dest_len; /* Length of the destination buffer */
483483

484484
if (zend_parse_parameters(argc, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
485-
return;
485+
RETURN_THROWS();
486486
}
487487

488488
/* Assign them to easy to use variables, dest_len is initially the length of the data
@@ -534,7 +534,7 @@ static PHP_FUNCTION(bzdecompress)
534534
bz_stream bzs;
535535

536536
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &small)) {
537-
return;
537+
RETURN_THROWS();
538538
}
539539

540540
bzs.bzalloc = NULL;
@@ -601,7 +601,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
601601
struct php_bz2_stream_data_t *self;
602602

603603
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &bzp) == FAILURE) {
604-
return;
604+
RETURN_THROWS();
605605
}
606606

607607
php_stream_from_zval(stream, bzp);

ext/calendar/cal_unix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PHP_FUNCTION(unixtojd)
2929
struct tm *ta, tmbuf;
3030

3131
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
32-
return;
32+
RETURN_THROWS();
3333
}
3434

3535
if (!ts) {
@@ -54,7 +54,7 @@ PHP_FUNCTION(jdtounix)
5454
zend_long uday;
5555

5656
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &uday) == FAILURE) {
57-
return;
57+
RETURN_THROWS();
5858
}
5959
uday -= 2440588 /* J.D. of 1.1.1970 */;
6060

ext/calendar/calendar.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,8 @@ PHP_FUNCTION(cal_info)
198198
{
199199
zend_long cal = -1;
200200

201-
202201
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &cal) == FAILURE) {
203-
return;
202+
RETURN_THROWS();
204203
}
205204

206205
if (cal == -1) {
@@ -236,7 +235,7 @@ PHP_FUNCTION(cal_days_in_month)
236235
zend_long sdn_start, sdn_next;
237236

238237
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &cal, &month, &year) == FAILURE) {
239-
return;
238+
RETURN_THROWS();
240239
}
241240

242241
if (cal < 0 || cal >= CAL_NUM_CALS) {
@@ -282,7 +281,7 @@ PHP_FUNCTION(cal_to_jd)
282281
zend_long cal, month, day, year;
283282

284283
if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &cal, &month, &day, &year) != SUCCESS) {
285-
return;
284+
RETURN_THROWS();
286285
}
287286

288287
if (cal < 0 || cal >= CAL_NUM_CALS) {
@@ -303,7 +302,7 @@ PHP_FUNCTION(cal_from_jd)
303302
const struct cal_entry_t *calendar;
304303

305304
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &jd, &cal) == FAILURE) {
306-
return;
305+
RETURN_THROWS();
307306
}
308307

309308
if (cal < 0 || cal >= CAL_NUM_CALS) {
@@ -354,7 +353,7 @@ PHP_FUNCTION(jdtogregorian)
354353
int year, month, day;
355354

356355
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
357-
return;
356+
RETURN_THROWS();
358357
}
359358

360359
SdnToGregorian(julday, &year, &month, &day);
@@ -370,7 +369,7 @@ PHP_FUNCTION(gregoriantojd)
370369
zend_long year, month, day;
371370

372371
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
373-
return;
372+
RETURN_THROWS();
374373
}
375374

376375
RETURN_LONG(GregorianToSdn(year, month, day));
@@ -385,7 +384,7 @@ PHP_FUNCTION(jdtojulian)
385384
int year, month, day;
386385

387386
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
388-
return;
387+
RETURN_THROWS();
389388
}
390389

391390
SdnToJulian(julday, &year, &month, &day);
@@ -401,7 +400,7 @@ PHP_FUNCTION(juliantojd)
401400
zend_long year, month, day;
402401

403402
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
404-
return;
403+
RETURN_THROWS();
405404
}
406405

407406
RETURN_LONG(JulianToSdn(year, month, day));
@@ -514,7 +513,7 @@ PHP_FUNCTION(jdtojewish)
514513
char *dayp, *yearp;
515514

516515
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|bl", &julday, &heb, &fl) == FAILURE) {
517-
return;
516+
RETURN_THROWS();
518517
}
519518

520519
SdnToJewish(julday, &year, &month, &day);
@@ -545,7 +544,7 @@ PHP_FUNCTION(jewishtojd)
545544
zend_long year, month, day;
546545

547546
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
548-
return;
547+
RETURN_THROWS();
549548
}
550549

551550
RETURN_LONG(JewishToSdn(year, month, day));
@@ -560,7 +559,7 @@ PHP_FUNCTION(jdtofrench)
560559
int year, month, day;
561560

562561
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
563-
return;
562+
RETURN_THROWS();
564563
}
565564

566565
SdnToFrench(julday, &year, &month, &day);
@@ -576,7 +575,7 @@ PHP_FUNCTION(frenchtojd)
576575
zend_long year, month, day;
577576

578577
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
579-
return;
578+
RETURN_THROWS();
580579
}
581580

582581
RETURN_LONG(FrenchToSdn(year, month, day));
@@ -592,7 +591,7 @@ PHP_FUNCTION(jddayofweek)
592591
const char *daynamel, *daynames;
593592

594593
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &julday, &mode) == FAILURE) {
595-
return;
594+
RETURN_THROWS();
596595
}
597596

598597
day = DayOfWeek(julday);
@@ -623,7 +622,7 @@ PHP_FUNCTION(jdmonthname)
623622
int month, day, year;
624623

625624
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &julday, &mode) == FAILURE) {
626-
return;
625+
RETURN_THROWS();
627626
}
628627

629628
switch (mode) {

ext/calendar/easter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm)
4545

4646
if (zend_parse_parameters(ZEND_NUM_ARGS(),
4747
"|ll", &year, &method) == FAILURE) {
48-
return;
48+
RETURN_THROWS();
4949
}
5050

5151
if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */

ext/com_dotnet/com_com.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ PHP_FUNCTION(com_get_active_object)
298298
php_com_initialize();
299299
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
300300
&module_name, &module_name_len, &code_page)) {
301-
return;
301+
RETURN_THROWS();
302302
}
303303

304304
module = php_com_string_to_olestring(module_name, module_name_len, (int)code_page);
@@ -666,7 +666,7 @@ PHP_FUNCTION(com_create_guid)
666666
OLECHAR *guid_string;
667667

668668
if (zend_parse_parameters_none() == FAILURE) {
669-
return;
669+
RETURN_THROWS();
670670
}
671671

672672
php_com_initialize();
@@ -699,7 +699,7 @@ PHP_FUNCTION(com_event_sink)
699699

700700
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Oo|z/",
701701
&object, php_com_variant_class_entry, &sinkobject, &sink)) {
702-
return;
702+
RETURN_THROWS();
703703
}
704704

705705
php_com_initialize();
@@ -760,7 +760,7 @@ PHP_FUNCTION(com_print_typeinfo)
760760

761761
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z/|s!b", &arg1, &ifacename,
762762
&ifacelen, &wantsink)) {
763-
return;
763+
RETURN_THROWS();
764764
}
765765

766766
php_com_initialize();
@@ -792,7 +792,7 @@ PHP_FUNCTION(com_message_pump)
792792
DWORD result;
793793

794794
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &timeoutms) == FAILURE)
795-
return;
795+
RETURN_THROWS();
796796

797797
php_com_initialize();
798798
result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT);
@@ -823,7 +823,7 @@ PHP_FUNCTION(com_load_typelib)
823823
int cached = 0;
824824

825825
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &name, &namelen, &cs)) {
826-
return;
826+
RETURN_THROWS();
827827
}
828828

829829
if (!cs) {

ext/com_dotnet/com_dotnet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
241241
&assembly_name, &assembly_name_len,
242242
&datatype_name, &datatype_name_len,
243243
&cp)) {
244-
return;
244+
RETURN_THROWS();
245245
}
246246

247247
cp_it = php_win32_cp_get_by_id((DWORD)cp);

ext/com_dotnet/com_persist.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ CPH_METHOD(SaveToFile)
380380
if (helper->ipf) {
381381
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p!|b",
382382
&filename, &filename_len, &remember)) {
383-
return;
383+
RETURN_THROWS();
384384
}
385385

386386
if (filename) {
@@ -443,7 +443,7 @@ CPH_METHOD(LoadFromFile)
443443

444444
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|l",
445445
&filename, &filename_len, &flags)) {
446-
return;
446+
RETURN_THROWS();
447447
}
448448

449449
if (!(fullpath = expand_filepath(filename, NULL))) {
@@ -538,7 +538,7 @@ CPH_METHOD(LoadFromStream)
538538
CPH_FETCH();
539539

540540
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
541-
return;
541+
RETURN_THROWS();
542542
}
543543

544544
php_stream_from_zval_no_verify(stream, zstm);
@@ -599,7 +599,7 @@ CPH_METHOD(SaveToStream)
599599
CPH_NO_OBJ();
600600

601601
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
602-
return;
602+
RETURN_THROWS();
603603
}
604604

605605
php_stream_from_zval_no_verify(stream, zstm);
@@ -646,7 +646,7 @@ CPH_METHOD(__construct)
646646

647647
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!",
648648
&zobj, php_com_variant_class_entry)) {
649-
return;
649+
RETURN_THROWS();
650650
}
651651

652652
if (!zobj) {

ext/com_dotnet/com_variant.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ PHP_FUNCTION(com_variant_create_instance)
450450

451451
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
452452
"z!|ll", &zvalue, &vt, &codepage)) {
453-
return;
453+
RETURN_THROWS();
454454
}
455455

456456
php_com_initialize();
@@ -511,7 +511,7 @@ PHP_FUNCTION(variant_set)
511511

512512
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
513513
"Oz!", &zobj, php_com_variant_class_entry, &zvalue)) {
514-
return;
514+
RETURN_THROWS();
515515
}
516516

517517
obj = CDNO_FETCH(zobj);
@@ -955,7 +955,7 @@ PHP_FUNCTION(variant_date_to_timestamp)
955955

956956
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
957957
"O", &zleft, php_com_variant_class_entry)) {
958-
return;
958+
RETURN_THROWS();
959959
}
960960
obj = CDNO_FETCH(zleft);
961961

@@ -994,7 +994,7 @@ PHP_FUNCTION(variant_date_from_timestamp)
994994

995995
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l",
996996
&timestamp)) {
997-
return;
997+
RETURN_THROWS();
998998
}
999999

10001000
if (timestamp < 0) {
@@ -1040,7 +1040,7 @@ PHP_FUNCTION(variant_get_type)
10401040

10411041
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
10421042
"O", &zobj, php_com_variant_class_entry)) {
1043-
return;
1043+
RETURN_THROWS();
10441044
}
10451045
obj = CDNO_FETCH(zobj);
10461046

@@ -1059,7 +1059,7 @@ PHP_FUNCTION(variant_set_type)
10591059

10601060
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
10611061
"Ol", &zobj, php_com_variant_class_entry, &vt)) {
1062-
return;
1062+
RETURN_THROWS();
10631063
}
10641064
obj = CDNO_FETCH(zobj);
10651065

@@ -1095,7 +1095,7 @@ PHP_FUNCTION(variant_cast)
10951095

10961096
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
10971097
"Ol", &zobj, php_com_variant_class_entry, &vt)) {
1098-
return;
1098+
RETURN_THROWS();
10991099
}
11001100
obj = CDNO_FETCH(zobj);
11011101

0 commit comments

Comments
 (0)