9 changed files with 91 additions and 130 deletions
-
9include/tr/remote_data.h
-
57include/tr/socket.h
-
1src/Makefile.am
-
4src/i_socket.c
-
22src/remote_data.c
-
46src/remote_data_set_data.c
-
9src/socket_accept.c
-
23src/tcp_socket.c
-
26src/udp_socket.c
@ -1,46 +0,0 @@ |
|||||
/** |
|
||||
* \file |
|
||||
* |
|
||||
* \author Georg Hopp |
|
||||
* |
|
||||
* \copyright |
|
||||
* Copyright © 2014 Georg Hopp |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||
*/ |
|
||||
|
|
||||
#include <string.h> // for atoi() and exit() |
|
||||
#include <errno.h> // for errno |
|
||||
#include <stdio.h> |
|
||||
#include <unistd.h> |
|
||||
|
|
||||
#include "tr/remote_data.h" |
|
||||
#include "tr/logger.h" |
|
||||
|
|
||||
void |
|
||||
TR_remoteDataSetData(TR_RemoteData this, unsigned char * data, size_t size) |
|
||||
{ |
|
||||
if (this->data && TR_getSize(this->data) < size) { |
|
||||
TR_MEM_FREE(this->data); |
|
||||
} |
|
||||
|
|
||||
if (! this->data) { |
|
||||
this->data = TR_malloc(size); |
|
||||
} |
|
||||
|
|
||||
this->ndata = size; |
|
||||
memcpy(this->data, data, size); |
|
||||
} |
|
||||
|
|
||||
// vim: set ts=4 sw=4: |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue