Ticket #71127: patch-libssh2-1.11-pragmas-older-gcc.diff

File patch-libssh2-1.11-pragmas-older-gcc.diff, 11.5 KB (added by ballapete (Peter "Pete" Dyballa), 3 weeks ago)

Set of patches to make libssh 1.11 compile with GCC 4

  • src/session.c

    old new  
    568568#pragma warning(disable:4054)
    569569/* 'type cast': from function pointer to data pointer */
    570570#pragma warning(disable:4055)
    571 #else
    572 #pragma GCC diagnostic push
    573 #pragma GCC diagnostic ignored "-Wpedantic"
    574571#endif
    575572LIBSSH2_API void *
    576573libssh2_session_callback_set(LIBSSH2_SESSION * session,
     
    581578}
    582579#ifdef _MSC_VER
    583580#pragma warning(pop)
    584 #else
    585 #pragma GCC diagnostic pop
    586581#endif
    587582
    588583/*
     
    675670
    676671        if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
    677672            FD_ZERO(&rfd);
    678 #if defined(__GNUC__)
    679 #pragma GCC diagnostic push
    680 #pragma GCC diagnostic ignored "-Wsign-conversion"
    681 #endif
    682673            FD_SET(session->socket_fd, &rfd);
    683 #if defined(__GNUC__)
    684 #pragma GCC diagnostic pop
    685 #endif
    686674            readfd = &rfd;
    687675        }
    688676
    689677        if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND) {
    690678            FD_ZERO(&wfd);
    691 #if defined(__GNUC__)
    692 #pragma GCC diagnostic push
    693 #pragma GCC diagnostic ignored "-Wsign-conversion"
    694 #endif
    695679            FD_SET(session->socket_fd, &wfd);
    696 #if defined(__GNUC__)
    697 #pragma GCC diagnostic pop
    698 #endif
    699680            writefd = &wfd;
    700681        }
    701682
     
    16551636        switch(fds[i].type) {
    16561637        case LIBSSH2_POLLFD_SOCKET:
    16571638            if(fds[i].events & LIBSSH2_POLLFD_POLLIN) {
    1658 #if defined(__GNUC__)
    1659 #pragma GCC diagnostic push
    1660 #pragma GCC diagnostic ignored "-Wsign-conversion"
    1661 #endif
    16621639                FD_SET(fds[i].fd.socket, &rfds);
    1663 #if defined(__GNUC__)
    1664 #pragma GCC diagnostic pop
    1665 #endif
    16661640                if(fds[i].fd.socket > maxfd)
    16671641                    maxfd = fds[i].fd.socket;
    16681642            }
    16691643            if(fds[i].events & LIBSSH2_POLLFD_POLLOUT) {
    1670 #if defined(__GNUC__)
    1671 #pragma GCC diagnostic push
    1672 #pragma GCC diagnostic ignored "-Wsign-conversion"
    1673 #endif
    16741644                FD_SET(fds[i].fd.socket, &wfds);
    1675 #if defined(__GNUC__)
    1676 #pragma GCC diagnostic pop
    1677 #endif
    16781645                if(fds[i].fd.socket > maxfd)
    16791646                    maxfd = fds[i].fd.socket;
    16801647            }
    16811648            break;
    16821649
    16831650        case LIBSSH2_POLLFD_CHANNEL:
    1684 #if defined(__GNUC__)
    1685 #pragma GCC diagnostic push
    1686 #pragma GCC diagnostic ignored "-Wsign-conversion"
    1687 #endif
    16881651            FD_SET(fds[i].fd.channel->session->socket_fd, &rfds);
    1689 #if defined(__GNUC__)
    1690 #pragma GCC diagnostic pop
    1691 #endif
    16921652            if(fds[i].fd.channel->session->socket_fd > maxfd)
    16931653                maxfd = fds[i].fd.channel->session->socket_fd;
    16941654            if(!session)
     
    16961656            break;
    16971657
    16981658        case LIBSSH2_POLLFD_LISTENER:
    1699 #if defined(__GNUC__)
    1700 #pragma GCC diagnostic push
    1701 #pragma GCC diagnostic ignored "-Wsign-conversion"
    1702 #endif
    17031659            FD_SET(fds[i].fd.listener->session->socket_fd, &rfds);
    1704 #if defined(__GNUC__)
    1705 #pragma GCC diagnostic pop
    1706 #endif
    17071660            if(fds[i].fd.listener->session->socket_fd > maxfd)
    17081661                maxfd = fds[i].fd.listener->session->socket_fd;
    17091662            if(!session)
     
    18801833            for(i = 0; i < nfds; i++) {
    18811834                switch(fds[i].type) {
    18821835                case LIBSSH2_POLLFD_SOCKET:
    1883 #if defined(__GNUC__)
    1884 #pragma GCC diagnostic push
    1885 #pragma GCC diagnostic ignored "-Wsign-conversion"
    1886 #endif
    18871836                    if(FD_ISSET(fds[i].fd.socket, &rfds)) {
    18881837                        fds[i].revents |= LIBSSH2_POLLFD_POLLIN;
    18891838                    }
     
    18931842                    if(fds[i].revents) {
    18941843                        active_fds++;
    18951844                    }
    1896 #if defined(__GNUC__)
    1897 #pragma GCC diagnostic pop
    1898 #endif
    18991845                    break;
    19001846
    19011847                case LIBSSH2_POLLFD_CHANNEL:
  • example/direct_tcpip.c

    old new  
    248248    for(;;) {
    249249        fd_set fds;
    250250        FD_ZERO(&fds);
    251 #if defined(__GNUC__)
    252 #pragma GCC diagnostic push
    253 #pragma GCC diagnostic ignored "-Wsign-conversion"
    254 #endif
    255251        FD_SET(forwardsock, &fds);
    256 #if defined(__GNUC__)
    257 #pragma GCC diagnostic pop
    258 #endif
    259252        tv.tv_sec = 0;
    260253        tv.tv_usec = 100000;
    261254        rc = select((int)(forwardsock + 1), &fds, NULL, NULL, &tv);
     
    263256            fprintf(stderr, "failed to select().\n");
    264257            goto shutdown;
    265258        }
    266 #if defined(__GNUC__)
    267 #pragma GCC diagnostic push
    268 #pragma GCC diagnostic ignored "-Wsign-conversion"
    269 #endif
    270259        if(rc && FD_ISSET(forwardsock, &fds)) {
    271 #if defined(__GNUC__)
    272 #pragma GCC diagnostic pop
    273 #endif
    274260            len = recv(forwardsock, buf, sizeof(buf), 0);
    275261            if(len < 0) {
    276262                fprintf(stderr, "failed to recv().\n");
  • example/scp_nonblock.c

    old new  
    6464
    6565    FD_ZERO(&fd);
    6666
    67 #if defined(__GNUC__)
    68 #pragma GCC diagnostic push
    69 #pragma GCC diagnostic ignored "-Wsign-conversion"
    70 #endif
    7167    FD_SET(socket_fd, &fd);
    72 #if defined(__GNUC__)
    73 #pragma GCC diagnostic pop
    74 #endif
    7568
    7669    /* now make sure we wait in the correct direction */
    7770    dir = libssh2_session_block_directions(session);
  • example/sftp_write_nonblock.c

    old new  
    5454
    5555    FD_ZERO(&fd);
    5656
    57 #if defined(__GNUC__)
    58 #pragma GCC diagnostic push
    59 #pragma GCC diagnostic ignored "-Wsign-conversion"
    60 #endif
    6157    FD_SET(socket_fd, &fd);
    62 #if defined(__GNUC__)
    63 #pragma GCC diagnostic pop
    64 #endif
    6558
    6659    /* now make sure we wait in the correct direction */
    6760    dir = libssh2_session_block_directions(session);
  • example/scp_write_nonblock.c

    old new  
    4848
    4949    FD_ZERO(&fd);
    5050
    51 #if defined(__GNUC__)
    52 #pragma GCC diagnostic push
    53 #pragma GCC diagnostic ignored "-Wsign-conversion"
    54 #endif
    5551    FD_SET(socket_fd, &fd);
    56 #if defined(__GNUC__)
    57 #pragma GCC diagnostic pop
    58 #endif
    5952
    6053    /* now make sure we wait in the correct direction */
    6154    dir = libssh2_session_block_directions(session);
  • example/sftp_RW_nonblock.c

    old new  
    5656
    5757    FD_ZERO(&fd);
    5858
    59 #if defined(__GNUC__)
    60 #pragma GCC diagnostic push
    61 #pragma GCC diagnostic ignored "-Wsign-conversion"
    62 #endif
    6359    FD_SET(socket_fd, &fd);
    64 #if defined(__GNUC__)
    65 #pragma GCC diagnostic pop
    66 #endif
    6760
    6861    /* now make sure we wait in the correct direction */
    6962    dir = libssh2_session_block_directions(session);
     
    258251
    259252        FD_ZERO(&fd);
    260253        FD_ZERO(&fd2);
    261 #if defined(__GNUC__)
    262 #pragma GCC diagnostic push
    263 #pragma GCC diagnostic ignored "-Wsign-conversion"
    264 #endif
    265254        FD_SET(sock, &fd);
    266255        FD_SET(sock, &fd2);
    267 #if defined(__GNUC__)
    268 #pragma GCC diagnostic pop
    269 #endif
    270256
    271257        /* wait for readable or writeable */
    272258        rc = select((int)(sock + 1), &fd, &fd2, NULL, &timeout);
     
    329315
    330316            FD_ZERO(&fd);
    331317            FD_ZERO(&fd2);
    332 #if defined(__GNUC__)
    333 #pragma GCC diagnostic push
    334 #pragma GCC diagnostic ignored "-Wsign-conversion"
    335 #endif
    336318            FD_SET(sock, &fd);
    337319            FD_SET(sock, &fd2);
    338 #if defined(__GNUC__)
    339 #pragma GCC diagnostic pop
    340 #endif
    341320
    342321            /* wait for readable or writeable */
    343322            rc = select((int)(sock + 1), &fd, &fd2, NULL, &timeout);
  • example/sftp_nonblock.c

    old new  
    6565
    6666    FD_ZERO(&fd);
    6767
    68 #if defined(__GNUC__)
    69 #pragma GCC diagnostic push
    70 #pragma GCC diagnostic ignored "-Wsign-conversion"
    71 #endif
    7268    FD_SET(socket_fd, &fd);
    73 #if defined(__GNUC__)
    74 #pragma GCC diagnostic pop
    75 #endif
    7669
    7770    /* now make sure we wait in the correct direction */
    7871    dir = libssh2_session_block_directions(session);
  • example/sftp_write_sliding.c

    old new  
    5555
    5656    FD_ZERO(&fd);
    5757
    58 #if defined(__GNUC__)
    59 #pragma GCC diagnostic push
    60 #pragma GCC diagnostic ignored "-Wsign-conversion"
    61 #endif
    6258    FD_SET(socket_fd, &fd);
    63 #if defined(__GNUC__)
    64 #pragma GCC diagnostic pop
    65 #endif
    6659
    6760    /* now make sure we wait in the correct direction */
    6861    dir = libssh2_session_block_directions(session);
  • example/ssh2_agent_forwarding.c

    old new  
    5050
    5151    FD_ZERO(&fd);
    5252
    53 #if defined(__GNUC__)
    54 #pragma GCC diagnostic push
    55 #pragma GCC diagnostic ignored "-Wsign-conversion"
    56 #endif
    5753    FD_SET(socket_fd, &fd);
    58 #if defined(__GNUC__)
    59 #pragma GCC diagnostic pop
    60 #endif
    6154
    6255    /* now make sure we wait in the correct direction */
    6356    dir = libssh2_session_block_directions(session);
  • example/ssh2_echo.c

    old new  
    4747
    4848    FD_ZERO(&fd);
    4949
    50 #if defined(__GNUC__)
    51 #pragma GCC diagnostic push
    52 #pragma GCC diagnostic ignored "-Wsign-conversion"
    53 #endif
    5450    FD_SET(socket_fd, &fd);
    55 #if defined(__GNUC__)
    56 #pragma GCC diagnostic pop
    57 #endif
    5851
    5952    /* now make sure we wait in the correct direction */
    6053    dir = libssh2_session_block_directions(session);
  • example/ssh2_exec.c

    old new  
    5151
    5252    FD_ZERO(&fd);
    5353
    54 #if defined(__GNUC__)
    55 #pragma GCC diagnostic push
    56 #pragma GCC diagnostic ignored "-Wsign-conversion"
    57 #endif
    5854    FD_SET(socket_fd, &fd);
    59 #if defined(__GNUC__)
    60 #pragma GCC diagnostic pop
    61 #endif
    6255
    6356    /* now make sure we wait in the correct direction */
    6457    dir = libssh2_session_block_directions(session);
  • example/tcpip-forward.c

    old new  
    246246    for(;;) {
    247247        fd_set fds;
    248248        FD_ZERO(&fds);
    249 #if defined(__GNUC__)
    250 #pragma GCC diagnostic push
    251 #pragma GCC diagnostic ignored "-Wsign-conversion"
    252 #endif
    253249        FD_SET(forwardsock, &fds);
    254 #if defined(__GNUC__)
    255 #pragma GCC diagnostic pop
    256 #endif
    257250        tv.tv_sec = 0;
    258251        tv.tv_usec = 100000;
    259252        rc = select((int)(forwardsock + 1), &fds, NULL, NULL, &tv);
     
    261254            fprintf(stderr, "failed to select().\n");
    262255            goto shutdown;
    263256        }
    264 #if defined(__GNUC__)
    265 #pragma GCC diagnostic push
    266 #pragma GCC diagnostic ignored "-Wsign-conversion"
    267 #endif
    268257        if(rc && FD_ISSET(forwardsock, &fds)) {
    269 #if defined(__GNUC__)
    270 #pragma GCC diagnostic pop
    271 #endif
    272258            ssize_t nwritten;
    273259            len = recv(forwardsock, buf, sizeof(buf), 0);
    274260            if(len < 0) {
  • example/x11.c

    old new  
    210210    timeval_out.tv_usec = 0;
    211211
    212212    FD_ZERO(&set);
    213 #if defined(__GNUC__)
    214 #pragma GCC diagnostic push
    215 #pragma GCC diagnostic ignored "-Wsign-conversion"
    216 #endif
    217213    FD_SET(sock, &set);
    218 #if defined(__GNUC__)
    219 #pragma GCC diagnostic pop
    220 #endif
    221214
    222215    buf = calloc(bufsize, sizeof(char));
    223216    if(!buf)
     
    415408    for(;;) {
    416409
    417410        FD_ZERO(&set);
    418 #if defined(__GNUC__)
    419 #pragma GCC diagnostic push
    420 #pragma GCC diagnostic ignored "-Wsign-conversion"
    421 #endif
    422411        FD_SET(fileno(stdin), &set);
    423 #if defined(__GNUC__)
    424 #pragma GCC diagnostic pop
    425 #endif
    426412
    427413        /* Search if a resize pty has to be send */
    428414        ioctl(fileno(stdin), TIOCGWINSZ, &w_size);