summaryrefslogtreecommitdiff
path: root/training/utils
diff options
context:
space:
mode:
Diffstat (limited to 'training/utils')
-rw-r--r--training/utils/Makefile.am4
-rw-r--r--training/utils/sentclient.cc (renamed from training/utils/sentclient.c)0
-rw-r--r--training/utils/sentserver.cc (renamed from training/utils/sentserver.c)14
3 files changed, 9 insertions, 9 deletions
diff --git a/training/utils/Makefile.am b/training/utils/Makefile.am
index 156a2462..27c6e344 100644
--- a/training/utils/Makefile.am
+++ b/training/utils/Makefile.am
@@ -11,10 +11,10 @@ noinst_PROGRAMS = \
EXTRA_DIST = decode-and-evaluate.pl libcall.pl parallelize.pl
-sentserver_SOURCES = sentserver.c
+sentserver_SOURCES = sentserver.cc
sentserver_LDFLAGS = -pthread
-sentclient_SOURCES = sentclient.c
+sentclient_SOURCES = sentclient.cc
sentclient_LDFLAGS = -pthread
TESTS = lbfgs_test optimize_test
diff --git a/training/utils/sentclient.c b/training/utils/sentclient.cc
index 91d994ab..91d994ab 100644
--- a/training/utils/sentclient.c
+++ b/training/utils/sentclient.cc
diff --git a/training/utils/sentserver.c b/training/utils/sentserver.cc
index c20b4fa6..b425955f 100644
--- a/training/utils/sentserver.c
+++ b/training/utils/sentserver.cc
@@ -85,7 +85,7 @@ struct line * queue_get(int fid) {
if (log_mutex) fprintf(stderr, "Unlocking input mutex (%d)\n", fid);
pthread_mutex_unlock(&input_mutex);
- cur = malloc(sizeof (struct line));
+ cur = (line*)malloc(sizeof (struct line));
cur->id = n_sent;
cur->s = s;
cur->next = NULL;
@@ -99,7 +99,7 @@ struct line * queue_get(int fid) {
fprintf(stderr, "Received ===SYNCH=== signal (fid %d)\n", fid);
// Note: queue_finish calls free(cur->s).
// Therefore we need to create a new string here.
- synch = malloc((strlen("===SYNCH===\n")+2) * sizeof (char));
+ synch = (char*)malloc((strlen("===SYNCH===\n")+2) * sizeof (char));
synch = strcpy(synch, s);
if (log_mutex) fprintf(stderr, "Unlocking queue mutex (%d)\n", fid);
@@ -247,7 +247,7 @@ void queue_finish(struct line *node, char *s, int fid) {
char * read_line(int fd, int multiline) {
int size = 80;
char errorbuf[100];
- char *s = malloc(size+2);
+ char *s = (char*)malloc(size+2);
int result, errors=0;
int i = 0;
@@ -257,7 +257,7 @@ char * read_line(int fd, int multiline) {
if (result < 0) {
perror("read()");
sprintf(errorbuf, "Error code: %d\n", errno);
- fprintf(stderr, errorbuf);
+ fputs(errorbuf, stderr);
errors++;
if (errors > 5) {
free(s);
@@ -301,7 +301,7 @@ char * read_line(int fd, int multiline) {
if (i == size) {
size = size*2;
- s = realloc(s, size+2);
+ s = (char*)realloc(s, size+2);
}
}
@@ -343,7 +343,7 @@ void * new_client(void *arg) {
if (result < strlen(cur->s)){
perror("write()");
sprintf(errorbuf, "Error code: %d\n", errno);
- fprintf(stderr, errorbuf);
+ fputs(errorbuf, stderr);
pthread_mutex_lock(&clients_mutex);
n_clients--;
@@ -474,7 +474,7 @@ int main (int argc, char *argv[]) {
sleep(1);
continue;
}
- client = malloc(sizeof(struct clientinfo));
+ client = (clientinfo*)malloc(sizeof(struct clientinfo));
client->s = g;
bcopy(&from, &client->sin, len);