Skip to content

Commit c7b55c2

Browse files
committed
Code review fixes
1 parent dbc9afa commit c7b55c2

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

ext/dom/document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ const char *_dom_get_valid_file_path(const char *source, char *resolved_path, in
11971197
}
11981198
/* }}} */
11991199

1200-
xmlDocPtr dom_document_parser(zval *id, int mode, const char *source, size_t source_len, size_t options, xmlCharEncodingHandlerPtr encoding) /* {{{ */
1200+
xmlDocPtr dom_document_parser(zval *id, dom_load_mode mode, const char *source, size_t source_len, size_t options, xmlCharEncodingHandlerPtr encoding) /* {{{ */
12011201
{
12021202
xmlDocPtr ret;
12031203
xmlParserCtxtPtr ctxt = NULL;

ext/dom/php_dom.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ void php_dom_document_constructor(INTERNAL_FUNCTION_PARAMETERS);
160160

161161
dom_object *php_dom_instantiate_object_helper(zval *return_value, zend_class_entry *ce, xmlNodePtr obj, dom_object *parent);
162162

163-
#define DOM_LOAD_STRING 0
164-
#define DOM_LOAD_FILE 1
163+
typedef enum {
164+
DOM_LOAD_STRING = 0,
165+
DOM_LOAD_FILE = 1,
166+
} dom_load_mode;
165167

166-
xmlDocPtr dom_document_parser(zval *id, int mode, const char *source, size_t source_len, size_t options, xmlCharEncodingHandlerPtr encoding);
168+
xmlDocPtr dom_document_parser(zval *id, dom_load_mode mode, const char *source, size_t source_len, size_t options, xmlCharEncodingHandlerPtr encoding);
167169

168170
/* parentnode */
169171
void dom_parent_node_prepend(dom_object *context, zval *nodes, uint32_t nodesc);

ext/dom/xml_document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static void load_from_helper(INTERNAL_FUNCTION_PARAMETERS, int mode)
193193
}
194194

195195
if (ZEND_SIZE_T_INT_OVFL(source_len)) {
196-
zend_argument_value_error(1, "must not exceed INT_MAX in length");
196+
zend_argument_value_error(1, "is too long");
197197
RETURN_THROWS();
198198
}
199199

0 commit comments

Comments
 (0)