]> granicus.if.org Git - php/commitdiff
Add some const-ness to the protocol frame codec
authorAndrey Hristov <andrey@php.net>
Tue, 17 Nov 2015 12:16:53 +0000 (13:16 +0100)
committerAndrey Hristov <andrey@php.net>
Tue, 17 Nov 2015 12:17:17 +0000 (13:17 +0100)
ext/mysqlnd/mysqlnd_protocol_frame_codec.c
ext/mysqlnd/mysqlnd_structs.h

index 2a26bf8dfc123ff3911adc3605dcd5ac11c1b529..c6d4b1e83ee541d647b1c2d5f8d069b7b19c16c4 100644 (file)
@@ -62,14 +62,14 @@ MYSQLND_METHOD(mysqlnd_pfc, reset)(MYSQLND_PFC * const pfc, MYSQLND_STATS * cons
   count + MYSQLND_HEADER_SIZE = sizeof(buffer) (not the pointer but the actual buffer)
 */
 static size_t
-MYSQLND_METHOD(mysqlnd_pfc, send)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const vio, zend_uchar * const buffer, const size_t count,
+MYSQLND_METHOD(mysqlnd_pfc, send)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const vio, const zend_uchar * const buffer, const size_t count,
                                                                  MYSQLND_STATS * const conn_stats, MYSQLND_ERROR_INFO * const error_info)
 {
        zend_uchar safe_buf[((MYSQLND_HEADER_SIZE) + (sizeof(zend_uchar)) - 1) / (sizeof(zend_uchar))];
        zend_uchar * safe_storage = safe_buf;
        size_t bytes_sent, packets_sent = 1;
        size_t left = count;
-       zend_uchar * p = (zend_uchar *) buffer;
+       const zend_uchar * p = buffer;
        zend_uchar * compress_buf = NULL;
        size_t to_be_sent;
 
@@ -93,7 +93,7 @@ MYSQLND_METHOD(mysqlnd_pfc, send)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const v
                        /* here we need to compress the data and then write it, first comes the compressed header */
                        size_t tmp_complen = to_be_sent;
                        size_t payload_size;
-                       zend_uchar * uncompressed_payload = p; /* should include the header */
+                       const zend_uchar * uncompressed_payload = p; /* should include the header */
 
                        STORE_HEADER_SIZE(safe_storage, uncompressed_payload);
                        int3store(uncompressed_payload, to_be_sent);
index 58efe02cf12fbd3608a76326503fff2fc13ccccc..deab0235a00d3b98681f0b074cc58cb1687e9816 100644 (file)
@@ -1077,7 +1077,7 @@ typedef enum_func_status  (*func_mysqlnd_pfc__reset)(MYSQLND_PFC * const pfc, MYS
 typedef enum_func_status       (*func_mysqlnd_pfc__set_client_option)(MYSQLND_PFC * const pfc, enum_mysqlnd_client_option option, const char * const value);
 typedef enum_func_status       (*func_mysqlnd_pfc__decode)(zend_uchar * uncompressed_data, const size_t uncompressed_data_len, const zend_uchar * const compressed_data, const size_t compressed_data_len);
 typedef enum_func_status       (*func_mysqlnd_pfc__encode)(zend_uchar * compress_buffer, size_t * compress_buffer_len, const zend_uchar * const uncompressed_data, const size_t uncompressed_data_len);
-typedef size_t                         (*func_mysqlnd_pfc__send)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const vio, zend_uchar * const buffer, const size_t count, MYSQLND_STATS * const conn_stats, MYSQLND_ERROR_INFO * const error_info);
+typedef size_t                         (*func_mysqlnd_pfc__send)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const vio, const zend_uchar * const buffer, const size_t count, MYSQLND_STATS * const conn_stats, MYSQLND_ERROR_INFO * const error_info);
 typedef enum_func_status       (*func_mysqlnd_pfc__receive)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const vio, zend_uchar * const buffer, const size_t count, MYSQLND_STATS * const conn_stats, MYSQLND_ERROR_INFO * const error_info);
 typedef enum_func_status       (*func_mysqlnd_pfc__read_compressed_packet_from_stream_and_fill_read_buffer)(MYSQLND_PFC * pfc, MYSQLND_VIO * const vio, size_t net_payload_size, MYSQLND_STATS * conn_stats, MYSQLND_ERROR_INFO * error_info);
 typedef void                           (*func_mysqlnd_pfc__free_contents)(MYSQLND_PFC * pfc);