23 |
#include <unistd.h> |
#include <unistd.h> |
24 |
#include "rdesktop.h" |
#include "rdesktop.h" |
25 |
|
|
26 |
|
#ifdef HAVE_ICONV |
27 |
#ifdef HAVE_ICONV_H |
#ifdef HAVE_ICONV_H |
28 |
#include <iconv.h> |
#include <iconv.h> |
29 |
#endif |
#endif |
30 |
|
#endif |
31 |
|
|
32 |
extern uint16 g_mcs_userid; |
extern uint16 g_mcs_userid; |
33 |
extern char g_username[64]; |
extern char g_username[64]; |
150 |
void |
void |
151 |
rdp_out_unistr(STREAM s, char *string, int len) |
rdp_out_unistr(STREAM s, char *string, int len) |
152 |
{ |
{ |
153 |
#ifdef HAVE_ICONV |
#ifdef HAVE_ICONV |
154 |
size_t ibl = strlen(string), obl = len + 2; |
size_t ibl = strlen(string), obl = len + 2; |
155 |
static iconv_t iconv_h = (iconv_t)-1; |
static iconv_t iconv_h = (iconv_t)-1; |
156 |
char *pin = string, *pout; |
char *pin = string, *pout; |
157 |
#ifdef B_ENDIAN |
#ifdef B_ENDIAN |
158 |
char ss[4096]; // FIXME: global MAX_BUF_SIZE macro need |
char ss[4096]; // FIXME: global MAX_BUF_SIZE macro need |
159 |
|
|
160 |
pout = ss; |
pout = ss; |
191 |
return; |
return; |
192 |
} |
} |
193 |
|
|
194 |
#ifdef B_ENDIAN |
#ifdef B_ENDIAN |
195 |
swab(ss, s->p, len + 4); |
swab(ss, s->p, len + 4); |
196 |
#endif |
#endif |
197 |
|
|
219 |
int |
int |
220 |
rdp_in_unistr(STREAM s, char *string, int uni_len) |
rdp_in_unistr(STREAM s, char *string, int uni_len) |
221 |
{ |
{ |
222 |
#ifdef HAVE_ICONV |
#ifdef HAVE_ICONV |
223 |
size_t ibl = uni_len, obl = uni_len; |
size_t ibl = uni_len, obl = uni_len; |
224 |
char *pin, *pout = string; |
char *pin, *pout = string; |
225 |
static iconv_t iconv_h = (iconv_t)-1; |
static iconv_t iconv_h = (iconv_t)-1; |
226 |
#ifdef B_ENDIAN |
#ifdef B_ENDIAN |
227 |
char ss[4096]; // FIXME: global MAX_BUF_SIZE macro need |
char ss[4096]; // FIXME: global MAX_BUF_SIZE macro need |
228 |
|
|
229 |
swab(s->p, ss, uni_len); |
swab(s->p, ss, uni_len); |