Skip to content

Commit cfc48bd

Browse files
committed
ext/soap: Use bool as return type instead of int for parse_packet_soap()
1 parent a7c7158 commit cfc48bd

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

ext/soap/php_packet_soap.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "php_soap.h"
2020

2121
/* SOAP client calls this function to parse response from SOAP server */
22-
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers)
22+
bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers)
2323
{
2424
char* envelope_ns = NULL;
2525
xmlDocPtr response;
@@ -33,20 +33,20 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
3333

3434
/* Response for one-way opearation */
3535
if (buffer_size == 0) {
36-
return TRUE;
36+
return true;
3737
}
3838

3939
/* Parse XML packet */
4040
response = soap_xmlParseMemory(buffer, buffer_size);
4141

4242
if (!response) {
4343
add_soap_fault(this_ptr, "Client", "looks like we got no XML document", NULL, NULL);
44-
return FALSE;
44+
return false;
4545
}
4646
if (xmlGetIntSubset(response) != NULL) {
4747
add_soap_fault(this_ptr, "Client", "DTD are not supported by SOAP", NULL, NULL);
4848
xmlFreeDoc(response);
49-
return FALSE;
49+
return false;
5050
}
5151

5252
/* Get <Envelope> element */
@@ -65,32 +65,32 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
6565
} else {
6666
add_soap_fault(this_ptr, "VersionMismatch", "Wrong Version", NULL, NULL);
6767
xmlFreeDoc(response);
68-
return FALSE;
68+
return false;
6969
}
7070
}
7171
trav = trav->next;
7272
}
7373
if (env == NULL) {
7474
add_soap_fault(this_ptr, "Client", "looks like we got XML without \"Envelope\" element", NULL, NULL);
7575
xmlFreeDoc(response);
76-
return FALSE;
76+
return false;
7777
}
7878

7979
attr = env->properties;
8080
while (attr != NULL) {
8181
if (attr->ns == NULL) {
8282
add_soap_fault(this_ptr, "Client", "A SOAP Envelope element cannot have non Namespace qualified attributes", NULL, NULL);
8383
xmlFreeDoc(response);
84-
return FALSE;
84+
return false;
8585
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
8686
if (soap_version == SOAP_1_2) {
8787
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Envelope", NULL, NULL);
8888
xmlFreeDoc(response);
89-
return FALSE;
89+
return false;
9090
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
9191
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
9292
xmlFreeDoc(response);
93-
return FALSE;
93+
return false;
9494
}
9595
}
9696
attr = attr->next;
@@ -122,33 +122,33 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
122122
if (body == NULL) {
123123
add_soap_fault(this_ptr, "Client", "Body must be present in a SOAP envelope", NULL, NULL);
124124
xmlFreeDoc(response);
125-
return FALSE;
125+
return false;
126126
}
127127
attr = body->properties;
128128
while (attr != NULL) {
129129
if (attr->ns == NULL) {
130130
if (soap_version == SOAP_1_2) {
131131
add_soap_fault(this_ptr, "Client", "A SOAP Body element cannot have non Namespace qualified attributes", NULL, NULL);
132132
xmlFreeDoc(response);
133-
return FALSE;
133+
return false;
134134
}
135135
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
136136
if (soap_version == SOAP_1_2) {
137137
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Body", NULL, NULL);
138138
xmlFreeDoc(response);
139-
return FALSE;
139+
return false;
140140
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
141141
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
142142
xmlFreeDoc(response);
143-
return FALSE;
143+
return false;
144144
}
145145
}
146146
attr = attr->next;
147147
}
148148
if (trav != NULL && soap_version == SOAP_1_2) {
149149
add_soap_fault(this_ptr, "Client", "A SOAP 1.2 envelope can contain only Header and Body", NULL, NULL);
150150
xmlFreeDoc(response);
151-
return FALSE;
151+
return false;
152152
}
153153

154154
if (head != NULL) {
@@ -157,16 +157,16 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
157157
if (attr->ns == NULL) {
158158
add_soap_fault(this_ptr, "Client", "A SOAP Header element cannot have non Namespace qualified attributes", NULL, NULL);
159159
xmlFreeDoc(response);
160-
return FALSE;
160+
return false;
161161
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
162162
if (soap_version == SOAP_1_2) {
163163
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Header", NULL, NULL);
164164
xmlFreeDoc(response);
165-
return FALSE;
165+
return false;
166166
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
167167
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
168168
xmlFreeDoc(response);
169-
return FALSE;
169+
return false;
170170
}
171171
}
172172
attr = attr->next;
@@ -242,7 +242,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
242242
Z_DELREF(details);
243243
}
244244
xmlFreeDoc(response);
245-
return FALSE;
245+
return false;
246246
}
247247

248248
/* Parse content of <Body> element */
@@ -316,7 +316,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
316316
/*
317317
add_soap_fault(this_ptr, "Client", "Can't find response data", NULL, NULL);
318318
xmlFreeDoc(response);
319-
return FALSE;
319+
return false;
320320
*/
321321
} else {
322322
/* Decoding value of parameter */
@@ -417,5 +417,5 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
417417
}
418418

419419
xmlFreeDoc(response);
420-
return TRUE;
420+
return true;
421421
}

ext/soap/php_packet_soap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
#ifndef PHP_PACKET_SOAP_H
2020
#define PHP_PACKET_SOAP_H
2121

22-
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers);
22+
bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers);
2323

2424
#endif

0 commit comments

Comments
 (0)