Lines Matching refs:p

64 	if ((size_t)(p - begin) > packet->header.size) { \
132 register zend_uchar *p= (zend_uchar *)*packet; in php_mysqlnd_net_field_length() local
134 if (*p < 251) { in php_mysqlnd_net_field_length()
136 return (unsigned long) *p; in php_mysqlnd_net_field_length()
139 switch (*p) { in php_mysqlnd_net_field_length()
145 return (unsigned long) uint2korr(p+1); in php_mysqlnd_net_field_length()
148 return (unsigned long) uint3korr(p+1); in php_mysqlnd_net_field_length()
151 return (unsigned long) uint4korr(p+1); in php_mysqlnd_net_field_length()
162 register zend_uchar *p= (zend_uchar *)*packet; in php_mysqlnd_net_field_length_ll() local
164 if (*p < 251) { in php_mysqlnd_net_field_length_ll()
166 return (uint64_t) *p; in php_mysqlnd_net_field_length_ll()
169 switch (*p) { in php_mysqlnd_net_field_length_ll()
175 return (uint64_t) uint2korr(p + 1); in php_mysqlnd_net_field_length_ll()
178 return (uint64_t) uint3korr(p + 1); in php_mysqlnd_net_field_length_ll()
181 return (uint64_t) uint8korr(p + 1); in php_mysqlnd_net_field_length_ll()
220 zend_uchar *p = buf; in php_mysqlnd_read_error_from_line() local
229 *error_no = uint2korr(p); in php_mysqlnd_read_error_from_line()
230 p+= 2; in php_mysqlnd_read_error_from_line()
235 if (*p == '#') { in php_mysqlnd_read_error_from_line()
236 ++p; in php_mysqlnd_read_error_from_line()
237 if ((buf_len - (p - buf)) >= MYSQLND_SQLSTATE_LENGTH) { in php_mysqlnd_read_error_from_line()
238 memcpy(sqlstate, p, MYSQLND_SQLSTATE_LENGTH); in php_mysqlnd_read_error_from_line()
239 p+= MYSQLND_SQLSTATE_LENGTH; in php_mysqlnd_read_error_from_line()
244 if ((buf_len - (p - buf)) > 0) { in php_mysqlnd_read_error_from_line()
245 error_msg_len = MIN((int)((buf_len - (p - buf))), (int) (error_buf_len - 1)); in php_mysqlnd_read_error_from_line()
246 memcpy(error, p, error_msg_len); in php_mysqlnd_read_error_from_line()
306 zend_uchar *p = buf; in php_mysqlnd_greet_read() local
315 packet->protocol_version = uint1korr(p); in php_mysqlnd_greet_read()
316 p++; in php_mysqlnd_greet_read()
320 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_greet_read()
335 packet->server_version = estrdup((char *)p); in php_mysqlnd_greet_read()
336 p+= strlen(packet->server_version) + 1; /* eat the '\0' */ in php_mysqlnd_greet_read()
339 packet->thread_id = uint4korr(p); in php_mysqlnd_greet_read()
340 p+=4; in php_mysqlnd_greet_read()
343 memcpy(packet->scramble_buf, p, SCRAMBLE_LENGTH_323); in php_mysqlnd_greet_read()
344 p+= 8; in php_mysqlnd_greet_read()
348 p++; in php_mysqlnd_greet_read()
351 packet->server_capabilities = uint2korr(p); in php_mysqlnd_greet_read()
352 p+= 2; in php_mysqlnd_greet_read()
355 packet->charset_no = uint1korr(p); in php_mysqlnd_greet_read()
356 p++; in php_mysqlnd_greet_read()
359 packet->server_status = uint2korr(p); in php_mysqlnd_greet_read()
360 p+= 2; in php_mysqlnd_greet_read()
364 p+= 13; in php_mysqlnd_greet_read()
367 if ((size_t) (p - buf) < packet->header.size) { in php_mysqlnd_greet_read()
370 p, SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323); in php_mysqlnd_greet_read()
383 DBG_ERR_FMT("GREET packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_greet_read()
385 p - begin - packet->header.size); in php_mysqlnd_greet_read()
395 MYSQLND_PACKET_GREET *p= (MYSQLND_PACKET_GREET *) _packet; in php_mysqlnd_greet_free_mem() local
396 if (p->server_version) { in php_mysqlnd_greet_free_mem()
397 efree(p->server_version); in php_mysqlnd_greet_free_mem()
398 p->server_version = NULL; in php_mysqlnd_greet_free_mem()
401 mnd_pefree(p, p->header.persistent); in php_mysqlnd_greet_free_mem()
456 register char *p= buffer + MYSQLND_HEADER_SIZE; /* start after the header */ in php_mysqlnd_auth_write() local
462 int4store(p, packet->client_flags); in php_mysqlnd_auth_write()
463 p+= 4; in php_mysqlnd_auth_write()
465 int4store(p, packet->max_packet_size); in php_mysqlnd_auth_write()
466 p+= 4; in php_mysqlnd_auth_write()
468 int1store(p, packet->charset_no); in php_mysqlnd_auth_write()
469 p++; in php_mysqlnd_auth_write()
471 memset(p, 0, 23); /* filler */ in php_mysqlnd_auth_write()
472 p+= 23; in php_mysqlnd_auth_write()
476 memcpy(p, packet->user, len); in php_mysqlnd_auth_write()
477 p+= len; in php_mysqlnd_auth_write()
478 *p++ = '\0'; in php_mysqlnd_auth_write()
483 int1store(p, SHA1_MAX_LENGTH); in php_mysqlnd_auth_write()
484 p++; in php_mysqlnd_auth_write()
485 php_mysqlnd_scramble((zend_uchar*)p, packet->server_scramble_buf, (zend_uchar*)packet->password); in php_mysqlnd_auth_write()
486 p+= SHA1_MAX_LENGTH; in php_mysqlnd_auth_write()
489 int1store(p, 0); in php_mysqlnd_auth_write()
490 p++; in php_mysqlnd_auth_write()
495 memcpy(p, packet->db, real_db_len); in php_mysqlnd_auth_write()
496 p+= real_db_len; in php_mysqlnd_auth_write()
497 *p++= '\0'; in php_mysqlnd_auth_write()
503 DBG_RETURN(conn->net->m.send(conn, buffer, p - buffer - MYSQLND_HEADER_SIZE TSRMLS_CC)); in php_mysqlnd_auth_write()
513 MYSQLND_PACKET_AUTH * p = (MYSQLND_PACKET_AUTH *) _packet; in php_mysqlnd_auth_free_mem() local
514 mnd_pefree(p, p->header.persistent); in php_mysqlnd_auth_free_mem()
529 zend_uchar *p = buf; in php_mysqlnd_ok_read() local
540 packet->field_count = uint1korr(p); in php_mysqlnd_ok_read()
541 p++; in php_mysqlnd_ok_read()
545 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_ok_read()
552 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_ok_read()
555 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_ok_read()
558 packet->server_status = uint2korr(p); in php_mysqlnd_ok_read()
559 p+= 2; in php_mysqlnd_ok_read()
562 packet->warning_count = uint2korr(p); in php_mysqlnd_ok_read()
563 p+= 2; in php_mysqlnd_ok_read()
567 if (packet->header.size > (size_t) (p - buf) && (i = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_ok_read()
568 packet->message_len = MIN(i, buf_len - (p - begin)); in php_mysqlnd_ok_read()
569 packet->message = mnd_pestrndup((char *)p, packet->message_len, FALSE); in php_mysqlnd_ok_read()
583 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_ok_read()
585 p - begin - packet->header.size); in php_mysqlnd_ok_read()
595 MYSQLND_PACKET_OK *p= (MYSQLND_PACKET_OK *) _packet; in php_mysqlnd_ok_free_mem() local
596 if (p->message) { in php_mysqlnd_ok_free_mem()
597 mnd_efree(p->message); in php_mysqlnd_ok_free_mem()
598 p->message = NULL; in php_mysqlnd_ok_free_mem()
601 mnd_pefree(p, p->header.persistent); in php_mysqlnd_ok_free_mem()
620 zend_uchar *p = buf; in php_mysqlnd_eof_read() local
629 packet->field_count = uint1korr(p); in php_mysqlnd_eof_read()
630 p++; in php_mysqlnd_eof_read()
634 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_eof_read()
647 packet->warning_count = uint2korr(p); in php_mysqlnd_eof_read()
648 p+= 2; in php_mysqlnd_eof_read()
651 packet->server_status = uint2korr(p); in php_mysqlnd_eof_read()
652 p+= 2; in php_mysqlnd_eof_read()
666 DBG_ERR_FMT("EOF packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_eof_read()
668 p - begin - packet->header.size); in php_mysqlnd_eof_read()
719 zend_uchar *tmp, *p; in php_mysqlnd_cmd_write() local
724 p = tmp + MYSQLND_HEADER_SIZE; /* skip the header */ in php_mysqlnd_cmd_write()
726 int1store(p, packet->command); in php_mysqlnd_cmd_write()
727 p++; in php_mysqlnd_cmd_write()
729 memcpy(p, packet->argument, packet->arg_len); in php_mysqlnd_cmd_write()
753 MYSQLND_PACKET_COMMAND * p = (MYSQLND_PACKET_COMMAND *) _packet; in php_mysqlnd_cmd_free_mem() local
754 mnd_pefree(p, p->header.persistent); in php_mysqlnd_cmd_free_mem()
767 zend_uchar *p = buf; in php_mysqlnd_rset_header_read() local
781 if (ERROR_MARKER == *p) { in php_mysqlnd_rset_header_read()
783 p++; in php_mysqlnd_rset_header_read()
785 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_rset_header_read()
792 packet->field_count = php_mysqlnd_net_field_length(&p); in php_mysqlnd_rset_header_read()
808 memcpy(packet->info_or_local_file, p, len); in php_mysqlnd_rset_header_read()
818 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_rset_header_read()
821 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_rset_header_read()
824 packet->server_status = uint2korr(p); in php_mysqlnd_rset_header_read()
825 p+=2; in php_mysqlnd_rset_header_read()
828 packet->warning_count = uint2korr(p); in php_mysqlnd_rset_header_read()
829 p+=2; in php_mysqlnd_rset_header_read()
832 if (packet->header.size > (size_t) (p - buf) && (len = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_rset_header_read()
835 memcpy(packet->info_or_local_file, p, len); in php_mysqlnd_rset_header_read()
856 DBG_ERR_FMT("RSET_HEADER packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_header_read()
858 p - begin - packet->header.size); in php_mysqlnd_rset_header_read()
868 MYSQLND_PACKET_RSET_HEADER *p= (MYSQLND_PACKET_RSET_HEADER *) _packet; in php_mysqlnd_rset_header_free_mem() local
870 if (p->info_or_local_file) { in php_mysqlnd_rset_header_free_mem()
871 mnd_efree(p->info_or_local_file); in php_mysqlnd_rset_header_free_mem()
872 p->info_or_local_file = NULL; in php_mysqlnd_rset_header_free_mem()
875 mnd_pefree(p, p->header.persistent); in php_mysqlnd_rset_header_free_mem()
906 zend_uchar *p = buf; in php_mysqlnd_rset_field_read() local
922 if (ERROR_MARKER == *p) { in php_mysqlnd_rset_field_read()
924 p++; in php_mysqlnd_rset_field_read()
926 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_rset_field_read()
932 } else if (EODATA_MARKER == *p && packet->header.size < 8) { in php_mysqlnd_rset_field_read()
942 len = php_mysqlnd_net_field_length(&p); in php_mysqlnd_rset_field_read()
952 *(const char **)(((char *)meta) + rset_field_offsets[i]) = (const char *)p; in php_mysqlnd_rset_field_read()
954 p += len; in php_mysqlnd_rset_field_read()
962 if (12 != *p) { in php_mysqlnd_rset_field_read()
963 DBG_ERR_FMT("Protocol error. Server sent false length. Expected 12 got %d", (int) *p); in php_mysqlnd_rset_field_read()
966 p++; in php_mysqlnd_rset_field_read()
969 meta->charsetnr = uint2korr(p); in php_mysqlnd_rset_field_read()
970 p += 2; in php_mysqlnd_rset_field_read()
973 meta->length = uint4korr(p); in php_mysqlnd_rset_field_read()
974 p += 4; in php_mysqlnd_rset_field_read()
977 meta->type = uint1korr(p); in php_mysqlnd_rset_field_read()
978 p += 1; in php_mysqlnd_rset_field_read()
981 meta->flags = uint2korr(p); in php_mysqlnd_rset_field_read()
982 p += 2; in php_mysqlnd_rset_field_read()
985 meta->decimals = uint1korr(p); in php_mysqlnd_rset_field_read()
986 p += 1; in php_mysqlnd_rset_field_read()
990 p +=2; in php_mysqlnd_rset_field_read()
1008 if (packet->header.size > (size_t) (p - buf) && in php_mysqlnd_rset_field_read()
1009 (len = php_mysqlnd_net_field_length(&p)) && in php_mysqlnd_rset_field_read()
1019 memcpy(meta->def, p, len); in php_mysqlnd_rset_field_read()
1022 p += len; in php_mysqlnd_rset_field_read()
1087 DBG_ERR_FMT("RSET field packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_field_read()
1089 "shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_field_read()
1099 MYSQLND_PACKET_RES_FIELD *p= (MYSQLND_PACKET_RES_FIELD *) _packet; in php_mysqlnd_rset_field_free_mem() local
1102 mnd_pefree(p, p->header.persistent); in php_mysqlnd_rset_field_free_mem()
1117 zend_uchar *p = NULL; in php_mysqlnd_read_row_ex() local
1150 p = (*buffer)->ptr; in php_mysqlnd_read_row_ex()
1169 p = (*buffer)->ptr + (*data_size - header.size); in php_mysqlnd_read_row_ex()
1172 if (PASS != (ret = conn->net->m.receive(conn, p, header.size TSRMLS_CC))) { in php_mysqlnd_read_row_ex()
1201 zend_uchar *p = row_buffer->ptr; in php_mysqlnd_rowp_read_binary_protocol() local
1214 p++; in php_mysqlnd_rowp_read_binary_protocol()
1215 null_ptr= p; in php_mysqlnd_rowp_read_binary_protocol()
1216 p += (field_count + 9)/8; /* skip null bits */ in php_mysqlnd_rowp_read_binary_protocol()
1229 zend_uchar * orig_p = p; in php_mysqlnd_rowp_read_binary_protocol()
1241 …mysqlnd_ps_fetch_functions[type].func(*current_field, &fields_metadata[i], 0, &p, as_unicode TSRML… in php_mysqlnd_rowp_read_binary_protocol()
1279 Z_STRLEN_PP(current_field) : (p - orig_p)); in php_mysqlnd_rowp_read_binary_protocol()
1303 zend_uchar *p = row_buffer->ptr; in php_mysqlnd_rowp_read_text_protocol() local
1325 zend_uchar *this_field_len_pos = p; in php_mysqlnd_rowp_read_text_protocol()
1327 unsigned long len = php_mysqlnd_net_field_length(&p); in php_mysqlnd_rowp_read_text_protocol()
1390 zend_uchar save = *(p + len); in php_mysqlnd_rowp_read_text_protocol()
1392 *(p + len) = '\0'; in php_mysqlnd_rowp_read_text_protocol()
1397 atoll((char *) p); in php_mysqlnd_rowp_read_text_protocol()
1399 _atoi64((char *) p); in php_mysqlnd_rowp_read_text_protocol()
1405 (uint64_t) atoll((char *) p); in php_mysqlnd_rowp_read_text_protocol()
1407 (uint64_t) _atoi64((char *) p); in php_mysqlnd_rowp_read_text_protocol()
1421 ZVAL_STRINGL(*current_field, (char *)p, len, 0); in php_mysqlnd_rowp_read_text_protocol()
1426 *(p + len) = save; in php_mysqlnd_rowp_read_text_protocol()
1428 zend_uchar save = *(p + len); in php_mysqlnd_rowp_read_text_protocol()
1430 *(p + len) = '\0'; in php_mysqlnd_rowp_read_text_protocol()
1431 ZVAL_DOUBLE(*current_field, atof((char *) p)); in php_mysqlnd_rowp_read_text_protocol()
1432 *(p + len) = save; in php_mysqlnd_rowp_read_text_protocol()
1446 …ps_fetch_from_1_to_8_bytes(*current_field, &(fields_metadata[i]), 0, &p, as_unicode, len TSRMLS_CC… in php_mysqlnd_rowp_read_text_protocol()
1451 p -= len; in php_mysqlnd_rowp_read_text_protocol()
1483 ZVAL_STRINGL(*current_field, (char *)p, len, 0); in php_mysqlnd_rowp_read_text_protocol()
1503 ZVAL_STRINGL(*current_field, (char *)p, len, 0); in php_mysqlnd_rowp_read_text_protocol()
1505 ZVAL_UTF8_STRINGL(*current_field, (char *)p, len, 0); in php_mysqlnd_rowp_read_text_protocol()
1508 p += len; in php_mysqlnd_rowp_read_text_protocol()
1531 zend_uchar *p; in php_mysqlnd_rowp_read() local
1560 if (ERROR_MARKER == (*(p = packet->row_buffer->ptr))) { in php_mysqlnd_rowp_read()
1567 php_mysqlnd_read_error_from_line(p + 1, data_size - 1, in php_mysqlnd_rowp_read()
1573 } else if (EODATA_MARKER == *p && data_size < 8) { /* EOF */ in php_mysqlnd_rowp_read()
1575 p++; in php_mysqlnd_rowp_read()
1577 packet->warning_count = uint2korr(p); in php_mysqlnd_rowp_read()
1578 p += 2; in php_mysqlnd_rowp_read()
1579 packet->server_status = uint2korr(p); in php_mysqlnd_rowp_read()
1625 MYSQLND_PACKET_ROW *p; in php_mysqlnd_rowp_free_mem() local
1628 p = (MYSQLND_PACKET_ROW *) _packet; in php_mysqlnd_rowp_free_mem()
1629 if (p->row_buffer) { in php_mysqlnd_rowp_free_mem()
1630 p->row_buffer->free_chunk(p->row_buffer TSRMLS_CC); in php_mysqlnd_rowp_free_mem()
1631 p->row_buffer = NULL; in php_mysqlnd_rowp_free_mem()
1633 DBG_INF_FMT("stack_allocation=%u persistent=%u", (int)stack_allocation, (int)p->header.persistent); in php_mysqlnd_rowp_free_mem()
1642 mnd_pefree(p, p->header.persistent); in php_mysqlnd_rowp_free_mem()
1675 MYSQLND_PACKET_STATS *p= (MYSQLND_PACKET_STATS *) _packet; in php_mysqlnd_stats_free_mem() local
1676 if (p->message) { in php_mysqlnd_stats_free_mem()
1677 mnd_efree(p->message); in php_mysqlnd_stats_free_mem()
1678 p->message = NULL; in php_mysqlnd_stats_free_mem()
1681 mnd_pefree(p, p->header.persistent); in php_mysqlnd_stats_free_mem()
1698 zend_uchar *p = buf; in php_mysqlnd_prepare_read() local
1709 packet->error_code = uint1korr(p); in php_mysqlnd_prepare_read()
1710 p++; in php_mysqlnd_prepare_read()
1714 php_mysqlnd_read_error_from_line(p, data_size - 1, in php_mysqlnd_prepare_read()
1731 packet->stmt_id = uint4korr(p); in php_mysqlnd_prepare_read()
1732 p += 4; in php_mysqlnd_prepare_read()
1736 packet->field_count = uint2korr(p); in php_mysqlnd_prepare_read()
1737 p += 2; in php_mysqlnd_prepare_read()
1740 packet->param_count = uint2korr(p); in php_mysqlnd_prepare_read()
1741 p += 2; in php_mysqlnd_prepare_read()
1746 p++; in php_mysqlnd_prepare_read()
1749 packet->warning_count = uint2korr(p); in php_mysqlnd_prepare_read()
1759 DBG_ERR_FMT("PREPARE packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_prepare_read()
1761 p - begin - packet->header.size); in php_mysqlnd_prepare_read()
1771 MYSQLND_PACKET_PREPARE_RESPONSE *p= (MYSQLND_PACKET_PREPARE_RESPONSE *) _packet; in php_mysqlnd_prepare_free_mem() local
1773 mnd_pefree(p, p->header.persistent); in php_mysqlnd_prepare_free_mem()
1786 zend_uchar *p = buf; in php_mysqlnd_chg_user_read() local
1801 packet->field_count= uint1korr(p); in php_mysqlnd_chg_user_read()
1802 p++; in php_mysqlnd_chg_user_read()
1811 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_chg_user_read()
1822 DBG_ERR_FMT("CHANGE_USER packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_chg_user_read()
1824 p - begin - packet->header.size); in php_mysqlnd_chg_user_read()