Changeset 8da0c7e in mod_gnutls


Ignore:
Timestamp:
Oct 11, 2020, 10:11:12 AM (10 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, master
Children:
d8c4d75
Parents:
6be4dd0
Message:

Limit variable scopes in gnutls_io.c

This fixes issues found using CppCheck?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_io.c

    r6be4dd0 r8da0c7e  
    103103        const char *str;
    104104        apr_size_t str_len;
    105         apr_size_t consume;
    106105
    107106        /* Justin points out this is an http-ism that might
     
    140139
    141140            /* Assure we don't overflow. */
    142             consume =
    143                     (str_len + actual >
    144                     *len) ? *len - actual : str_len;
     141            apr_size_t consume =
     142                (str_len + actual > *len) ? *len - actual : str_len;
    145143
    146144            memcpy(c, str, consume);
     
    177175    apr_size_t wanted = *len;
    178176    apr_size_t bytes = 0;
    179     int rc;
    180177
    181178    *len = 0;
     
    221218    {
    222219        /* Note: The pull function sets ctxt->input_rc */
    223         rc = gnutls_record_recv(ctxt->session, buf + bytes, wanted - bytes);
     220        int rc = gnutls_record_recv(ctxt->session,
     221                                    buf + bytes, wanted - bytes);
    224222
    225223        if (rc > 0) {
     
    311309        char *buf, apr_size_t * len) {
    312310    const char *pos = NULL;
    313     apr_status_t status;
    314311    apr_size_t tmplen = *len, buflen = *len, offset = 0;
    315312
    316313    *len = 0;
    317314
    318     while (tmplen > 0) {
    319         status = gnutls_io_input_read(ctxt, buf + offset, &tmplen);
     315    while (tmplen > 0)
     316    {
     317        apr_status_t status =
     318            gnutls_io_input_read(ctxt, buf + offset, &tmplen);
    320319
    321320        if (status != APR_SUCCESS) {
     
    959958{
    960959    mgs_handle_t *ctxt = ptr;
    961     apr_status_t rc;
    962960    apr_size_t in = len;
    963961    apr_read_type_e block = ctxt->input_block;
     
    980978    if (APR_BRIGADE_EMPTY(ctxt->input_bb))
    981979    {
    982         rc = ap_get_brigade(ctxt->input_filter->next,
    983                             ctxt->input_bb, AP_MODE_READBYTES,
    984                             ctxt->input_block, in);
     980        apr_status_t rc = ap_get_brigade(ctxt->input_filter->next,
     981                                         ctxt->input_bb, AP_MODE_READBYTES,
     982                                         ctxt->input_block, in);
    985983
    986984        /* Not a problem, there was simply no data ready yet.
Note: See TracChangeset for help on using the changeset viewer.