Mercurial > pidgin.yaz
comparison src/socket.c @ 3867:43e396e94095
[gaim-migrate @ 4019]
compile cleanups by nathan
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Sun, 03 Nov 2002 07:36:09 +0000 |
parents | bb49f0c4f7cd |
children | fa6395637e2c |
comparison
equal
deleted
inserted
replaced
3866:994b5c4d15dd | 3867:43e396e94095 |
---|---|
29 * it. It will eventually be made a library once the core and ui are split. */ | 29 * it. It will eventually be made a library once the core and ui are split. */ |
30 | 30 |
31 #include <sys/types.h> | 31 #include <sys/types.h> |
32 #include <sys/socket.h> | 32 #include <sys/socket.h> |
33 #include <sys/un.h> | 33 #include <sys/un.h> |
34 #include <unistd.h> | |
34 #include "gaim.h" | 35 #include "gaim.h" |
35 #include "gaim-socket.h" | 36 #include "gaim-socket.h" |
36 | 37 |
37 void cui_send_packet (int fd, struct gaim_cui_packet *p) { | 38 void cui_send_packet (int fd, struct gaim_cui_packet *p) { |
38 int len = sizeof(p->type) + sizeof(p->subtype) + sizeof(p->length) + p->length; | 39 int len = sizeof(p->type) + sizeof(p->subtype) + sizeof(p->length) + p->length; |
100 | 101 |
101 struct gaim_cui_packet *cui_read_packet(int fd) { | 102 struct gaim_cui_packet *cui_read_packet(int fd) { |
102 struct gaim_cui_packet *p = g_new0(struct gaim_cui_packet, 1); | 103 struct gaim_cui_packet *p = g_new0(struct gaim_cui_packet, 1); |
103 char *data = NULL; | 104 char *data = NULL; |
104 | 105 |
105 if (!(read(fd, p->type, sizeof(p->type)))) { | 106 if (!(read(fd, &p->type, sizeof(p->type)))) { |
106 g_free(p); | 107 g_free(p); |
107 return NULL; | 108 return NULL; |
108 } | 109 } |
109 | 110 |
110 | 111 |
111 if (!(read(fd, p->subtype, sizeof(p->subtype)))) { | 112 if (!(read(fd, &p->subtype, sizeof(p->subtype)))) { |
112 g_free(p); | 113 g_free(p); |
113 return NULL; | 114 return NULL; |
114 } | 115 } |
115 | 116 |
116 | 117 |
117 if (!(read(fd, p->length, sizeof(p->length)))) { | 118 if (!(read(fd, &p->length, sizeof(p->length)))) { |
118 g_free(p); | 119 g_free(p); |
119 return NULL; | 120 return NULL; |
120 } | 121 } |
121 | 122 |
122 if (p->length) { | 123 if (p->length) { |
125 g_free(p); | 126 g_free(p); |
126 return NULL; | 127 return NULL; |
127 } | 128 } |
128 } | 129 } |
129 p->data = data; | 130 p->data = data; |
131 return p; | |
130 } | 132 } |
131 | 133 |
132 /* copied directly from xmms_connect_to_session */ | 134 /* copied directly from xmms_connect_to_session */ |
133 gint gaim_connect_to_session(gint session) | 135 gint gaim_connect_to_session(gint session) |
134 { | 136 { |