-
Notifications
You must be signed in to change notification settings - Fork 0
/
php8_support.patch
8236 lines (7151 loc) · 311 KB
/
php8_support.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Index: dllmain.cpp
===================================================================
--- dllmain.cpp (revision 251535)
+++ dllmain.cpp (working copy)
@@ -28,36 +28,40 @@
#include "PHPCadesCPSignedXML.h"
#include "PHPCadesSymmetricAlgorithm.h"
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_verbose_name, 0, 0, 1)
+ ZEND_ARG_INFO(0, verbose)
+ZEND_END_ARG_INFO()
+
PHP_MINIT_FUNCTION(php_cpcsp) {
// le_hash_resource = zend_register_list_destructors_ex(php_hash_res_dtor,
// php_hash_res_pdtor, PHP_HASH_RESOURCE_NAME, module_number);
- about_init(TSRMLS_C);
- version_init(TSRMLS_C);
- store_init(TSRMLS_C);
- certs_init(TSRMLS_C);
- cert_init(TSRMLS_C);
- ku_init(TSRMLS_C);
- exku_init(TSRMLS_C);
- eku_init(TSRMLS_C);
- algo_init(TSRMLS_C);
- private_key_init(TSRMLS_C);
- encoded_data_init(TSRMLS_C);
- public_key_init(TSRMLS_C);
- oid_init(TSRMLS_C);
- attr_init(TSRMLS_C);
- basic_constr_init(TSRMLS_C);
- certstat_init(TSRMLS_C);
- enveloped_data_init(TSRMLS_C);
- sig_init(TSRMLS_C);
- eku_col_init(TSRMLS_C);
- attr_col_init(TSRMLS_C);
- signers_init(TSRMLS_C);
- recipients_init(TSRMLS_C);
- sig_dat_init(TSRMLS_C);
- hash_dat_init(TSRMLS_C);
- raw_sig_init(TSRMLS_C);
- sig_xml_init(TSRMLS_C);
- symmetric_algorithm_init(TSRMLS_C);
+ about_init();
+ version_init();
+ store_init();
+ certs_init();
+ cert_init();
+ ku_init();
+ exku_init();
+ eku_init();
+ algo_init();
+ private_key_init();
+ encoded_data_init();
+ public_key_init();
+ oid_init();
+ attr_init();
+ basic_constr_init();
+ certstat_init();
+ enveloped_data_init();
+ sig_init();
+ eku_col_init();
+ attr_col_init();
+ signers_init();
+ recipients_init();
+ signed_data_init();
+ hashed_data_init();
+ raw_sig_init();
+ signed_xml_init();
+ symmetric_algorithm_init();
REGISTER_LONG_CONSTANT("MEMORY_STORE", 0, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LOCAL_MACHINE_STORE", 1,
Index: PHPCadesAbout.cpp
===================================================================
--- PHPCadesAbout.cpp (revision 251535)
+++ PHPCadesAbout.cpp (working copy)
@@ -3,12 +3,13 @@
#include "PHPCadesVersion.h"
using namespace CryptoPro::PKI::CAdES;
-//Ïîëíîå îáúÿâëåíèå ñòðóêòóðû
+//Полное объÑвление Ñтруктуры
-//Ìåòîäû
+//Методы
PHP_METHOD(About, __construct) {
+ zend_object *zobj = Z_OBJ_P(getThis());
about_obj *obj =
- (about_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (about_obj *)((char *)zobj - XtOffsetOf(about_obj, zobj));
obj->m_pCppCadesImpl =
boost::shared_ptr<CPPCadesAboutObject>(new CPPCadesAboutObject());
}
@@ -15,8 +16,9 @@
PHP_METHOD(About, get_MajorVersion) {
unsigned int version;
+ zend_object *zobj = Z_OBJ_P(getThis());
about_obj *obj =
- (about_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (about_obj *)((char *)zobj - XtOffsetOf(about_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_MajorVersion(&version));
RETURN_LONG(version);
@@ -25,8 +27,9 @@
PHP_METHOD(About, get_MinorVersion) {
unsigned int version;
+ zend_object *zobj = Z_OBJ_P(getThis());
about_obj *obj =
- (about_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (about_obj *)((char *)zobj - XtOffsetOf(about_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_MinorVersion(&version));
RETURN_LONG(version);
@@ -35,8 +38,9 @@
PHP_METHOD(About, get_BuildVersion) {
unsigned int version;
+ zend_object *zobj = Z_OBJ_P(getThis());
about_obj *obj =
- (about_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (about_obj *)((char *)zobj - XtOffsetOf(about_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_BuildVersion(&version));
RETURN_LONG(version);
@@ -45,8 +49,9 @@
PHP_METHOD(About, get_Version) {
CAtlString AtlVersion;
+ zend_object *zobj = Z_OBJ_P(getThis());
about_obj *obj =
- (about_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (about_obj *)((char *)zobj - XtOffsetOf(about_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_Version(AtlVersion));
RETURN_ATL_STRING(AtlVersion);
@@ -56,13 +61,17 @@
boost::shared_ptr<CPPVersionObject> version;
+ zend_object *zobj = Z_OBJ_P(getThis());
about_obj *obj =
- (about_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (about_obj *)((char *)zobj - XtOffsetOf(about_obj, zobj));
+
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_PluginVersion(version));
object_init_ex(return_value, version_ce);
+
+ zobj = Z_OBJ_P(return_value);
version_obj *pPluginVersion =
- (version_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
+ (version_obj *)((char *)zobj - XtOffsetOf(version_obj, zobj));
pPluginVersion->m_pCppCadesImpl = version;
}
@@ -70,81 +79,94 @@
boost::shared_ptr<CPPVersionObject> version;
char *szProvName;
- int szProvName_len = 0;
+ size_t szProvName_len = 0;
DWORD dwProvType = 75;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &szProvName,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "|sl", &szProvName,
&szProvName_len, &dwProvType) == FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
CAtlString provName =
CAtlString(CA2CT(CAtlStringA(szProvName, szProvName_len), CP_UTF8));
+
+ zend_object *zobj = Z_OBJ_P(getThis());
about_obj *obj =
- (about_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (about_obj *)((char *)zobj - XtOffsetOf(about_obj, zobj));
+
HR_ERRORCHECK_RETURN(
obj->m_pCppCadesImpl->get_CSPVersion(provName, dwProvType, version));
object_init_ex(return_value, version_ce);
+ zobj = Z_OBJ_P(return_value);
version_obj *pCSPVersion =
- (version_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
+ (version_obj *)((char *)zobj - XtOffsetOf(version_obj, zobj));
pCSPVersion->m_pCppCadesImpl = version;
}
-//Âñïîìîãàòåëüíûå ôóíêöèè îáåðòêè
+//Ð’Ñпомогательные функции обертки
zend_object_handlers about_obj_handlers;
zend_class_entry *about_ce;
-void about_free_storage(void *object TSRMLS_DC) {
- about_obj *obj = (about_obj *)object;
+static void about_free(zend_object *object ) {
+ about_obj *obj = (about_obj *)((char *)object - XtOffsetOf(about_obj, zobj));
obj->m_pCppCadesImpl.reset();
- zend_hash_destroy(obj->zo.properties);
- FREE_HASHTABLE(obj->zo.properties);
+ zend_object_std_dtor(object);
+}
- efree(obj);
+static zend_object* about_create_handler(zend_class_entry *ce ) {
+ about_obj *obj = (about_obj *)emalloc(sizeof(about_obj) + zend_object_properties_size(ce));
+ memset(obj, 0, sizeof(about_obj) + zend_object_properties_size(ce));
+
+ zend_object_std_init(&obj->zobj, ce);
+ object_properties_init(&obj->zobj, ce);
+ obj->zobj.handlers = &about_obj_handlers;
+
+ return &obj->zobj;
}
-zend_object_value about_create_handler(zend_class_entry *type TSRMLS_DC) {
- zend_object_value retval;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_about_construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
- about_obj *obj = (about_obj *)emalloc(sizeof(about_obj));
- memset(obj, 0, sizeof(about_obj));
- obj->zo.ce = type;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_about_get_majorversion, 0, 0, 0)
+ZEND_END_ARG_INFO()
- ALLOC_HASHTABLE(obj->zo.properties);
- zend_hash_init(obj->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-#if PHP_VERSION_ID < 50399
- zval *tmp;
- zend_hash_copy(obj->zo.properties, &(type->default_properties),
- (copy_ctor_func_t)zval_add_ref, (void *)&tmp,
- sizeof(zval *));
-#else
- object_properties_init(&obj->zo, type);
-#endif
+ZEND_BEGIN_ARG_INFO_EX(arginfo_about_get_minorversion, 0, 0, 0)
+ZEND_END_ARG_INFO()
- retval.handle =
- zend_objects_store_put(obj, NULL, about_free_storage, NULL TSRMLS_CC);
- retval.handlers = &about_obj_handlers;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_about_get_buildversion, 0, 0, 0)
+ZEND_END_ARG_INFO()
- return retval;
-}
+ZEND_BEGIN_ARG_INFO_EX(arginfo_about_get_version, 0, 0, 0)
+ZEND_END_ARG_INFO()
-//ñâÿçûâàíèå ìåòîäîâ êëàññà â function entry
+ZEND_BEGIN_ARG_INFO_EX(arginfo_about_cspversion, 0, 0, 0)
+ ZEND_ARG_INFO(0, provname)
+ ZEND_ARG_INFO(0, provtype)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_about_pluginversion, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+//ÑвÑзывание методов клаÑÑа в function entry
zend_function_entry about_methods[] = {
- PHP_ME(About, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(About, get_MajorVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(About, get_MinorVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(About, get_BuildVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(About, get_Version, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(About, CSPVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(About, PluginVersion, NULL, ZEND_ACC_PUBLIC){NULL, NULL, NULL}};
+ PHP_ME(About, __construct, arginfo_about_construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME(About, get_MajorVersion, arginfo_about_get_majorversion, ZEND_ACC_PUBLIC)
+ PHP_ME(About, get_MinorVersion, arginfo_about_get_minorversion, ZEND_ACC_PUBLIC)
+ PHP_ME(About, get_BuildVersion, arginfo_about_get_buildversion, ZEND_ACC_PUBLIC)
+ PHP_ME(About, get_Version, arginfo_about_get_version, ZEND_ACC_PUBLIC)
+ PHP_ME(About, CSPVersion, arginfo_about_cspversion, ZEND_ACC_PUBLIC)
+ PHP_ME(About, PluginVersion, arginfo_about_pluginversion, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}};
-void about_init(TSRMLS_D) {
+void about_init(void) {
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "About", about_methods);
- about_ce = zend_register_internal_class(&ce TSRMLS_CC);
+ about_ce = zend_register_internal_class(&ce );
about_ce->create_object = about_create_handler;
memcpy(&about_obj_handlers, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
about_obj_handlers.clone_obj = NULL;
+ about_obj_handlers.free_obj = about_free;
+ about_obj_handlers.offset = XtOffsetOf(about_obj, zobj);
}
Index: PHPCadesAbout.h
===================================================================
--- PHPCadesAbout.h (revision 251535)
+++ PHPCadesAbout.h (working copy)
@@ -6,11 +6,11 @@
//îáúÿâëåíèå ñòðóêòóðû, êîòîðàÿ ñâÿæåò îáúåêò îáîðà÷èâàåìîãî êëàññà
//ñ îáúåêòîì php
-struct about_obj {
- zend_object zo;
+typedef struct _about_obj {
boost::shared_ptr<CryptoPro::PKI::CAdES::CPPCadesAboutObject>
m_pCppCadesImpl;
-};
+ zend_object zobj; /* MUST be the last element */
+} about_obj;
//õýíäëåðû äëÿ îáðàáîòêè îáúåêòîâ îáîðà÷èâàåìîãî êëàññà
extern zend_object_handlers about_obj_handlers;
@@ -18,14 +18,14 @@
extern zend_class_entry *about_ce;
//ôóíêöèÿ îñâîáîæäåíèÿ ïàìÿòè. èñïîëüçóåòñÿ ïðè óíè÷òîæåíèè îáúåêòîâ
-void about_free_storage(void *object TSRMLS_DC);
+// void about_free_storage(void *object );
-//ôóíêöèÿ ñîçäàíèÿ õýíäëåðà äëÿ íîâîãî îáúåêòà êëàññà. èñïîëüçóåòñÿ ïðè
-//ñîçäàíèè íîâûõ îáúåêòîâ
-zend_object_value about_create_handler(zend_class_entry *type TSRMLS_DC);
+// //ôóíêöèÿ ñîçäàíèÿ õýíäëåðà äëÿ íîâîãî îáúåêòà êëàññà. èñïîëüçóåòñÿ ïðè
+// //ñîçäàíèè íîâûõ îáúåêòîâ
+// zend_object_value about_create_handler(zend_class_entry *type );
//ôóíêöèÿ èíèöèàëèçàöèè êëàññà. äîëæíà âêëþ÷àòüñÿ â
//ôóíêöèþ, èíèöèàëèçàöèè ìîäóëÿ
-void about_init(TSRMLS_D);
+void about_init(void);
#endif
Index: PHPCadesCPAlgorithm.cpp
===================================================================
--- PHPCadesCPAlgorithm.cpp (revision 251535)
+++ PHPCadesCPAlgorithm.cpp (working copy)
@@ -2,12 +2,13 @@
#include "PHPCadesCPAlgorithm.h"
using namespace CryptoPro::PKI::CAdES;
-//Ìåòîäû
+//Методы
PHP_METHOD(CPAlgorithm, __construct) {
CPPCadesCPAlgorithmObject *algo;
+ zend_object *zobj = Z_OBJ_P(getThis());
algo_obj *obj =
- (algo_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (algo_obj *)((char *)zobj - XtOffsetOf(algo_obj, zobj));
algo = new CPPCadesCPAlgorithmObject();
obj->m_pCppCadesImpl = algo;
}
@@ -15,11 +16,12 @@
PHP_METHOD(CPAlgorithm, get_Name) {
CADESCOM_ENCRYPTION_ALGORITHM Name;
+ zend_object *zobj = Z_OBJ_P(getThis());
algo_obj *obj =
- (algo_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (algo_obj *)((char *)zobj - XtOffsetOf(algo_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_Name(&Name));
- RETURN_LONG(Name)
+ RETURN_LONG(Name);
}
PHP_METHOD(CPAlgorithm, set_Name) {
@@ -26,14 +28,15 @@
long lName;
CADESCOM_ENCRYPTION_ALGORITHM Name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lName) ==
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "l", &lName) ==
FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
Name = (CADESCOM_ENCRYPTION_ALGORITHM)lName;
+ zend_object *zobj = Z_OBJ_P(getThis());
algo_obj *obj =
- (algo_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (algo_obj *)((char *)zobj - XtOffsetOf(algo_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->put_Name(Name));
}
@@ -40,11 +43,12 @@
PHP_METHOD(CPAlgorithm, get_KeyLength) {
CAPICOM_ENCRYPTION_KEY_LENGTH Len;
+ zend_object *zobj = Z_OBJ_P(getThis());
algo_obj *obj =
- (algo_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (algo_obj *)((char *)zobj - XtOffsetOf(algo_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_KeyLength(&Len));
- RETURN_LONG(Len)
+ RETURN_LONG(Len);
}
PHP_METHOD(CPAlgorithm, set_KeyLength) {
@@ -51,68 +55,72 @@
long lLen;
CAPICOM_ENCRYPTION_KEY_LENGTH Len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lLen) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "l", &lLen) == FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
Len = (CAPICOM_ENCRYPTION_KEY_LENGTH)lLen;
+ zend_object *zobj = Z_OBJ_P(getThis());
algo_obj *obj =
- (algo_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ (algo_obj *)((char *)zobj - XtOffsetOf(algo_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->put_KeyLength(Len));
}
-//Âñïîìàãàòåëüíûå ôóíêöèè îáåðòêè
+//Ð’Ñпомагательные функции обертки
zend_object_handlers algo_obj_handlers;
zend_class_entry *algo_ce;
-void algo_free_storage(void *object TSRMLS_DC) {
- algo_obj *obj = (algo_obj *)object;
- delete obj->m_pCppCadesImpl;
+static void algo_free(zend_object *object ) {
+ algo_obj *obj = (algo_obj *)((char *)object - XtOffsetOf(algo_obj, zobj));
+ delete(obj->m_pCppCadesImpl);
- zend_hash_destroy(obj->zo.properties);
- FREE_HASHTABLE(obj->zo.properties);
+ zend_object_std_dtor(object);
+}
- efree(obj);
+static zend_object* algo_create_handler(zend_class_entry *ce ) {
+ algo_obj *obj = (algo_obj *)emalloc(sizeof(algo_obj) + zend_object_properties_size(ce));
+ memset(obj, 0, sizeof(algo_obj) + zend_object_properties_size(ce));
+
+ zend_object_std_init(&obj->zobj, ce);
+ object_properties_init(&obj->zobj, ce);
+ obj->zobj.handlers = &algo_obj_handlers;
+
+ return &obj->zobj;
}
-zend_object_value algo_create_handler(zend_class_entry *type TSRMLS_DC) {
- zend_object_value retval;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpalgorithm_construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
- algo_obj *obj = (algo_obj *)emalloc(sizeof(algo_obj));
- memset(obj, 0, sizeof(algo_obj));
- obj->zo.ce = type;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpalgorithm_get_name, 0, 0, 0)
+ZEND_END_ARG_INFO()
- ALLOC_HASHTABLE(obj->zo.properties);
- zend_hash_init(obj->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-#if PHP_VERSION_ID < 50399
- zval *tmp;
- zend_hash_copy(obj->zo.properties, &(type->default_properties),
- (copy_ctor_func_t)zval_add_ref, (void *)&tmp,
- sizeof(zval *));
-#else
- object_properties_init(&obj->zo, type);
-#endif
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpalgorithm_set_name, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO()
- retval.handle =
- zend_objects_store_put(obj, NULL, algo_free_storage, NULL TSRMLS_CC);
- retval.handlers = &algo_obj_handlers;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpalgorithm_get_keylength, 0, 0, 0)
+ZEND_END_ARG_INFO()
- return retval;
-}
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpalgorithm_set_keylength, 0, 0, 1)
+ ZEND_ARG_INFO(0, keylength)
+ZEND_END_ARG_INFO()
-//ñâÿçûâàíèå ìåòîäîâ êëàññà â function entry
+//ÑвÑзывание методов клаÑÑа в function entry
zend_function_entry algo_methods[] = {
- PHP_ME(CPAlgorithm, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(CPAlgorithm, get_Name, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAlgorithm, set_Name, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAlgorithm, get_KeyLength, NULL, ZEND_ACC_PUBLIC) PHP_ME(
- CPAlgorithm, set_KeyLength, NULL, ZEND_ACC_PUBLIC){NULL, NULL, NULL}};
+ PHP_ME(CPAlgorithm, __construct, arginfo_cpalgorithm_construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME(CPAlgorithm, get_Name, arginfo_cpalgorithm_get_name, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAlgorithm, set_Name, arginfo_cpalgorithm_set_name, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAlgorithm, get_KeyLength, arginfo_cpalgorithm_get_keylength, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAlgorithm, set_KeyLength, arginfo_cpalgorithm_set_keylength, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}};
-void algo_init(TSRMLS_D) {
+void algo_init(void) {
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "CPAlgorithm", algo_methods);
- algo_ce = zend_register_internal_class(&ce TSRMLS_CC);
+ algo_ce = zend_register_internal_class(&ce );
algo_ce->create_object = algo_create_handler;
memcpy(&algo_obj_handlers, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
algo_obj_handlers.clone_obj = NULL;
+ algo_obj_handlers.free_obj = algo_free;
+ algo_obj_handlers.offset = XtOffsetOf(algo_obj, zobj);
}
Index: PHPCadesCPAlgorithm.h
===================================================================
--- PHPCadesCPAlgorithm.h (revision 251535)
+++ PHPCadesCPAlgorithm.h (working copy)
@@ -5,24 +5,24 @@
//îáúÿâëåíèå ñòðóêòóðû, êîòîðàÿ ñâÿæåò îáúåêò îáîðà÷èâàåìîãî êëàññà
//ñ îáúåêòîì php
-struct algo_obj {
- zend_object zo;
+typedef struct _algo_obj {
CryptoPro::PKI::CAdES::CPPCadesCPAlgorithmObject *m_pCppCadesImpl;
-};
+ zend_object zobj; /* MUST be the last element */
+} algo_obj;
//õýíäëåðû äëÿ îáðàáîòêè îáúåêòîâ îáîðà÷èâàåìîãî êëàññà
extern zend_object_handlers algo_obj_handlers;
extern zend_class_entry *algo_ce;
-//ôóíêöèÿ îñâîáîæäåíèÿ ïàìÿòè. èñïîëüçóåòñÿ ïðè óíè÷òîæåíèè îáúåêòîâ
-void algo_free_storage(void *object TSRMLS_DC);
+// //ôóíêöèÿ îñâîáîæäåíèÿ ïàìÿòè. èñïîëüçóåòñÿ ïðè óíè÷òîæåíèè îáúåêòîâ
+// void algo_free_storage(void *object );
-//ôóíêöèÿ ñîçäàíèÿ õýíäëåðà äëÿ íîâîãî îáúåêòà êëàññà. èñïîëüçóåòñÿ ïðè
-//ñîçäàíèè íîâûõ îáúåêòîâ
-zend_object_value algo_create_handler(zend_class_entry *type TSRMLS_DC);
+// //ôóíêöèÿ ñîçäàíèÿ õýíäëåðà äëÿ íîâîãî îáúåêòà êëàññà. èñïîëüçóåòñÿ ïðè
+// //ñîçäàíèè íîâûõ îáúåêòîâ
+// zend_object_value algo_create_handler(zend_class_entry *type );
//ôóíêöèÿ èíèöèàëèçàöèè êëàññà. äîëæíà âêëþ÷àòüñÿ â
//ôóíêöèþ, èíèöèàëèçàöèè ìîäóëÿ
-void algo_init(TSRMLS_D);
+void algo_init(void);
#endif
Index: PHPCadesCPAttribute.cpp
===================================================================
--- PHPCadesCPAttribute.cpp (revision 251535)
+++ PHPCadesCPAttribute.cpp (working copy)
@@ -3,10 +3,11 @@
#include "PHPCadesCPOID.h"
using namespace CryptoPro::PKI::CAdES;
-//Ìåòîäû
+//Методы
PHP_METHOD(CPAttribute, __construct) {
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
boost::shared_ptr<CPPCadesCPAttributeObject> ptr(
new CPPCadesCPAttributeObject());
obj->m_pCppCadesImpl = ptr;
@@ -16,22 +17,26 @@
char *str;
int len;
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len) ==
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &str, &len) ==
FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
+
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
+
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->put_OID(CAtlStringA(str)));
}
PHP_METHOD(CPAttribute, get_OID) {
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
object_init_ex(return_value, oid_ce);
+ zobj = Z_OBJ_P(return_value);
oid_obj *oobj =
- (oid_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
+ (oid_obj *)((char *)zobj - XtOffsetOf(oid_obj, zobj));
oobj->m_pCppCadesImpl =
boost::shared_ptr<CPPCadesCPOIDObject>(new CPPCadesCPOIDObject());
boost::shared_ptr<CPPCadesCPOIDObject> ptr(new CPPCadesCPOIDObject());
@@ -44,14 +49,16 @@
CryptoPro::CBlob val;
CADESCOM_ATTRIBUTE Name;
unsigned char *str;
- unsigned int len;
+ size_t len;
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len) ==
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "s", &str, &len) ==
FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
+
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
+
val.assign(str, len);
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_Name(&Name));
@@ -70,12 +77,12 @@
PHP_METHOD(CPAttribute, get_Value) {
CryptoPro::CBlob val;
BYTE *str;
- char *tstr;
DWORD len;
CADESCOM_ATTRIBUTE Name;
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_Name(&Name));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_Value(val));
@@ -94,22 +101,25 @@
&fTimeSize);
CryptoPro::CDateTime Time(fTime);
CryptoPro::CStringProxy prstr = Time.tostring();
- tstr = const_cast<char *>(prstr.c_str());
- RETURN_STRING(tstr, 1)
+ zend_string *tstr = zend_string_init(const_cast<char *>(prstr.c_str()), strlen(prstr.c_str()), 0);
+ RETURN_NEW_STR(tstr);
}
- RETURN_STRINGL(reinterpret_cast<char *>(str), len, 0)
+ RETURN_STRINGL(reinterpret_cast<char *>(str), len);
}
PHP_METHOD(CPAttribute, set_Name) {
long lname;
CADESCOM_ATTRIBUTE name;
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lname) ==
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "l", &lname) ==
FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
+
+
name = (CADESCOM_ATTRIBUTE)lname;
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->put_Name(name));
@@ -117,25 +127,26 @@
PHP_METHOD(CPAttribute, get_Name) {
CADESCOM_ATTRIBUTE name;
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_Name(&name));
- RETURN_LONG(name)
+ RETURN_LONG(name);
}
PHP_METHOD(CPAttribute, set_ValueEncoding) {
long lType;
CAPICOM_ENCODING_TYPE Type;
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lType) ==
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "l", &lType) ==
FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
Type = (CAPICOM_ENCODING_TYPE)lType;
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->put_ValueEncoding(Type));
}
@@ -142,72 +153,89 @@
PHP_METHOD(CPAttribute, get_ValueEncoding) {
CAPICOM_ENCODING_TYPE type;
- attr_obj *obj =
- (attr_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attribute_obj *obj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_ValueEncoding(&type));
- RETURN_LONG(type)
+ RETURN_LONG(type);
}
-//Âñïîìîãàòåëüíûå ôóíêöèè îáåðòêè
-zend_object_handlers attr_obj_handlers;
-zend_class_entry *attr_ce;
+//Ð’Ñпомогательные функции обертки
+zend_object_handlers attribute_obj_handlers;
+zend_class_entry *attribute_ce;
-void attr_free_storage(void *object TSRMLS_DC) {
- attr_obj *obj = (attr_obj *)object;
+static void attribute_free(zend_object *object) {
+ attribute_obj *obj = (attribute_obj *)((char *)object - XtOffsetOf(attribute_obj, zobj));;
obj->m_pCppCadesImpl.reset();
- zend_hash_destroy(obj->zo.properties);
- FREE_HASHTABLE(obj->zo.properties);
+ zend_object_std_dtor(object);
+}
- efree(obj);
+static zend_object* attribute_create_handler(zend_class_entry *ce ) {
+ attribute_obj *obj = (attribute_obj *)emalloc(sizeof(attribute_obj) + zend_object_properties_size(ce));
+ memset(obj, 0, sizeof(attribute_obj) + zend_object_properties_size(ce));
+
+ zend_object_std_init(&obj->zobj, ce);
+ object_properties_init(&obj->zobj, ce);
+ obj->zobj.handlers = &attribute_obj_handlers;
+
+ return &obj->zobj;
}
-zend_object_value attr_create_handler(zend_class_entry *type TSRMLS_DC) {
- zend_object_value retval;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
- attr_obj *obj = (attr_obj *)emalloc(sizeof(attr_obj));
- memset(obj, 0, sizeof(attr_obj));
- obj->zo.ce = type;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_set_oid, 0, 0, 1)
+ ZEND_ARG_INFO(0, oid)
+ZEND_END_ARG_INFO()
- ALLOC_HASHTABLE(obj->zo.properties);
- zend_hash_init(obj->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-#if PHP_VERSION_ID < 50399
- zval *tmp;
- zend_hash_copy(obj->zo.properties, &(type->default_properties),
- (copy_ctor_func_t)zval_add_ref, (void *)&tmp,
- sizeof(zval *));
-#else
- object_properties_init(&obj->zo, type);
-#endif
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_get_oid, 0, 0, 0)
+ZEND_END_ARG_INFO()
- retval.handle =
- zend_objects_store_put(obj, NULL, attr_free_storage, NULL TSRMLS_CC);
- retval.handlers = &attr_obj_handlers;
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_set_value, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
- return retval;
-}
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_get_value, 0, 0, 0)
+ZEND_END_ARG_INFO()
-//ñâÿçûâàíèå ìåòîäîâ êëàññà â function entry
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_set_name, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_get_name, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_set_valueencoding, 0, 0, 1)
+ ZEND_ARG_INFO(0, valueencoding)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cpattribute_get_valueencoding, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+//ÑвÑзывание методов клаÑÑа в function entry
zend_function_entry attr_methods[] = {
- PHP_ME(CPAttribute, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(CPAttribute, set_OID, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAttribute, get_OID, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAttribute, set_Value, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAttribute, get_Value, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAttribute, set_Name, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAttribute, get_Name, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAttribute, set_ValueEncoding, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CPAttribute, get_ValueEncoding, NULL, ZEND_ACC_PUBLIC){NULL, NULL,
- NULL}};
+ PHP_ME(CPAttribute, __construct, arginfo_cpattribute_construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME(CPAttribute, set_OID, arginfo_cpattribute_set_oid, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAttribute, get_OID, arginfo_cpattribute_get_oid, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAttribute, set_Value, arginfo_cpattribute_set_value, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAttribute, get_Value, arginfo_cpattribute_get_value, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAttribute, set_Name, arginfo_cpattribute_set_name, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAttribute, get_Name, arginfo_cpattribute_get_name, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAttribute, set_ValueEncoding, arginfo_cpattribute_set_valueencoding, ZEND_ACC_PUBLIC)
+ PHP_ME(CPAttribute, get_ValueEncoding, arginfo_cpattribute_get_valueencoding, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}};
-void attr_init(TSRMLS_D) {
+void attr_init(void) {
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "CPAttribute", attr_methods);
- attr_ce = zend_register_internal_class(&ce TSRMLS_CC);
- attr_ce->create_object = attr_create_handler;
- memcpy(&attr_obj_handlers, zend_get_std_object_handlers(),
+ attribute_ce = zend_register_internal_class(&ce );
+ attribute_ce->create_object = attribute_create_handler;
+ memcpy(&attribute_obj_handlers, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
- attr_obj_handlers.clone_obj = NULL;
+ attribute_obj_handlers.clone_obj = NULL;
+ attribute_obj_handlers.free_obj = attribute_free;
+ attribute_obj_handlers.offset = XtOffsetOf(attribute_obj, zobj);
}
Index: PHPCadesCPAttribute.h
===================================================================
--- PHPCadesCPAttribute.h (revision 251535)
+++ PHPCadesCPAttribute.h (working copy)
@@ -5,19 +5,19 @@
//îáúÿâëåíèå ñòðóêòóðû, êîòîðàÿ ñâÿæåò îáúåêò îáîðà÷èâàåìîãî êëàññà
//ñ îáúåêòîì php
-struct attr_obj {
- zend_object zo;
+typedef struct _attribute_obj {
boost::shared_ptr<CryptoPro::PKI::CAdES::CPPCadesCPAttributeObject>
m_pCppCadesImpl;
-};
+ zend_object zobj; /* MUST be the last element */
+} attribute_obj;
-extern zend_object_handlers attr_obj_handlers;
-extern zend_class_entry *attr_ce;
+extern zend_object_handlers attribute_obj_handlers;
+extern zend_class_entry *attribute_ce;
-void attr_free_storage(void *object TSRMLS_DC);
-zend_object_value attr_create_handler(zend_class_entry *type TSRMLS_DC);
+// // void attr_free_storage(void *object );
+// zend_object_value attr_create_handler(zend_class_entry *type );
//ôóíêöèÿ èíèöèàëèçàöèè êëàññà. äîëæíà âêëþ÷àòüñÿ â
//ôóíêöèþ, èíèöèàëèçàöèè ìîäóëÿ
-void attr_init(TSRMLS_D);
+void attr_init(void);
#endif
Index: PHPCadesCPAttributes.cpp
===================================================================
--- PHPCadesCPAttributes.cpp (revision 251535)
+++ PHPCadesCPAttributes.cpp (working copy)
@@ -3,10 +3,11 @@
#include "PHPCadesCPAttribute.h"
using namespace CryptoPro::PKI::CAdES;
-//Ìåòîäû
+//Методы
PHP_METHOD(CPAttributes, __construct) {
- attr_col *obj =
- (attr_col *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attributes_col_obj *obj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
boost::shared_ptr<CPPCadesCPAttributesObject> ptr(
new CPPCadesCPAttributesObject());
obj->m_pCppCadesImpl = ptr;
@@ -14,37 +15,43 @@
PHP_METHOD(CPAttributes, Add) {
zval *item;
- attr_col *obj =
- (attr_col *)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &item,
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attributes_col_obj *obj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "O", &item,
obj->type) == FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
- attr_obj *iobj = (attr_obj *)zend_object_store_get_object(item TSRMLS_CC);
+ zobj = Z_OBJ_P(item);
+ attribute_obj *iobj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->Add(iobj->m_pCppCadesImpl));
}
PHP_METHOD(CPAttributes, get_Count) {
long count;
- attr_col *obj =
- (attr_col *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attributes_col_obj *obj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->get_Count(&count));
- RETURN_LONG(count)
+ RETURN_LONG(count);
}
PHP_METHOD(CPAttributes, get_Item) {
long idx;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &idx) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "l", &idx) == FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
- attr_col *obj =
- (attr_col *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attributes_col_obj *obj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
- object_init_ex(return_value, attr_ce);
- attr_obj *aobj =
- (attr_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
+ object_init_ex(return_value, attribute_ce);
+ zobj = Z_OBJ_P(return_value);
+ attribute_obj *aobj =
+ (attribute_obj *)((char *)zobj - XtOffsetOf(attribute_obj, zobj));
HR_ERRORCHECK_RETURN(
obj->m_pCppCadesImpl->get_Item(idx, aobj->m_pCppCadesImpl));
@@ -51,8 +58,9 @@
}
PHP_METHOD(CPAttributes, Clear) {
- attr_col *obj =
- (attr_col *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attributes_col_obj *obj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->Clear());
}
@@ -59,82 +67,98 @@
PHP_METHOD(CPAttributes, Remove) {
long idx;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &idx) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "l", &idx) == FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
- attr_col *obj =
- (attr_col *)zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attributes_col_obj *obj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->Remove(idx));
}
PHP_METHOD(CPAttributes, Assign) {
zval *attrs;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &attrs,
- attr_col_ce) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() , "O", &attrs,
+ attributes_col_ce) == FAILURE)
RETURN_WITH_EXCEPTION(E_INVALIDARG);
- attr_col *obj =
- (attr_col *)zend_object_store_get_object(getThis() TSRMLS_CC);
- attr_col *aobj = (attr_col *)zend_object_store_get_object(attrs TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(getThis());
+ attributes_col_obj *obj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
+
+ zobj = Z_OBJ_P(attrs);
+ attributes_col_obj *aobj =
+ (attributes_col_obj *)((char *)zobj - XtOffsetOf(attributes_col_obj, zobj));
+
HR_ERRORCHECK_RETURN(obj->m_pCppCadesImpl->Assign(
aobj->m_pCppCadesImpl->get_CryptAttributesStruct()));
}