diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index 4f603dbf3..fa3af9cf5 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -143,7 +143,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3 } else { - format_name->name = freerdp_uniconv_in(cliprdr->uniconv, s->p, 32); + format_name->name = freerdp_uniconv_in(s->p, 32); format_name->length = strlen(format_name->name); } @@ -187,7 +187,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32 break; } - format_name->name = freerdp_uniconv_in(cliprdr->uniconv, stream_get_tail(s), name_len); + format_name->name = freerdp_uniconv_in(stream_get_tail(s), name_len); format_name->length = strlen(format_name->name); stream_seek(s, name_len + 2); } diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index b7f4e136d..10eb26c9b 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -82,8 +82,6 @@ void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* s) static void cliprdr_process_connect(rdpSvcPlugin* plugin) { DEBUG_CLIPRDR("connecting"); - - ((cliprdrPlugin*) plugin)->uniconv = freerdp_uniconv_new(); } void cliprdr_print_general_capability_flags(uint32 flags) @@ -267,11 +265,6 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) static void cliprdr_process_terminate(rdpSvcPlugin* plugin) { - cliprdrPlugin* cliprdr_plugin = (cliprdrPlugin*) plugin; - - if (cliprdr_plugin->uniconv != NULL) - freerdp_uniconv_free(cliprdr_plugin->uniconv); - xfree(plugin); } diff --git a/channels/cliprdr/client/cliprdr_main.h b/channels/cliprdr/client/cliprdr_main.h index e3059a272..bc6b35584 100644 --- a/channels/cliprdr/client/cliprdr_main.h +++ b/channels/cliprdr/client/cliprdr_main.h @@ -35,7 +35,6 @@ typedef struct _CLIPRDR_FORMAT_NAME CLIPRDR_FORMAT_NAME; struct cliprdr_plugin { rdpSvcPlugin plugin; - UNICONV* uniconv; boolean received_caps; boolean use_long_format_names; boolean stream_fileclip_enabled; diff --git a/channels/rail/client/rail_main.h b/channels/rail/client/rail_main.h index 49870a5be..31c243aa0 100644 --- a/channels/rail/client/rail_main.h +++ b/channels/rail/client/rail_main.h @@ -29,7 +29,6 @@ struct rdp_rail_order { - UNICONV* uniconv; RDP_PLUGIN_DATA* plugin_data; void* plugin; RAIL_HANDSHAKE_ORDER handshake; diff --git a/channels/rail/client/rail_orders.c b/channels/rail/client/rail_orders.c index 09826f149..f756b5ac0 100644 --- a/channels/rail/client/rail_orders.c +++ b/channels/rail/client/rail_orders.c @@ -24,6 +24,7 @@ #include #include +#include #include "rail_orders.h" @@ -78,7 +79,7 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_ if (string == NULL || strlen(string) < 1) return; - buffer = freerdp_uniconv_out(rail_order->uniconv, string, &length); + buffer = freerdp_uniconv_out(string, &length); unicode_string->string = (uint8*) buffer; unicode_string->length = (uint16) length; @@ -631,7 +632,7 @@ rdpRailOrder* rail_order_new() if (rail_order != NULL) { - rail_order->uniconv = freerdp_uniconv_new(); + } return rail_order; @@ -641,7 +642,7 @@ void rail_order_free(rdpRailOrder* rail_order) { if (rail_order != NULL) { - freerdp_uniconv_free(rail_order->uniconv); + xfree(rail_order); } } diff --git a/channels/rdpdr/client/disk/disk_file.c b/channels/rdpdr/client/disk/disk_file.c index 44745fb11..658278500 100644 --- a/channels/rdpdr/client/disk/disk_file.c +++ b/channels/rdpdr/client/disk/disk_file.c @@ -36,8 +36,10 @@ #include #include #include + #include #include +#include #include #ifdef HAVE_UNISTD_H @@ -425,7 +427,6 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui uint64 size; char* fullpath; struct STAT st; - UNICONV* uniconv; struct timeval tv[2]; uint64 LastWriteTime; uint32 FileAttributes; @@ -485,9 +486,8 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui stream_seek_uint8(input); /* ReplaceIfExists */ stream_seek_uint8(input); /* RootDirectory */ stream_read_uint32(input, FileNameLength); - uniconv = freerdp_uniconv_new(); - s = freerdp_uniconv_in(uniconv, stream_get_tail(input), FileNameLength); - freerdp_uniconv_free(uniconv); + + s = freerdp_uniconv_in(stream_get_tail(input), FileNameLength); fullpath = disk_file_combine_fullpath(file->basepath, s); xfree(s); @@ -520,7 +520,6 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui struct dirent* ent; char* ent_path; struct STAT st; - UNICONV* uniconv; size_t len; boolean ret; @@ -549,6 +548,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui do { ent = readdir(file->dir); + if (ent == NULL) continue; @@ -572,6 +572,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui memset(&st, 0, sizeof(struct STAT)); ent_path = xmalloc(strlen(file->fullpath) + strlen(ent->d_name) + 2); sprintf(ent_path, "%s/%s", file->fullpath, ent->d_name); + if (STAT(ent_path, &st) != 0) { DEBUG_WARN("stat %s failed. errno = %d", ent_path, errno); @@ -580,9 +581,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui DEBUG_SVC(" pattern %s matched %s", file->pattern, ent_path); xfree(ent_path); - uniconv = freerdp_uniconv_new(); - ent_path = freerdp_uniconv_out(uniconv, ent->d_name, &len); - freerdp_uniconv_free(uniconv); + ent_path = freerdp_uniconv_out(ent->d_name, &len); ret = true; switch (FsInformationClass) diff --git a/channels/rdpdr/client/disk/disk_main.c b/channels/rdpdr/client/disk/disk_main.c index 5616b8196..f90e3c022 100644 --- a/channels/rdpdr/client/disk/disk_main.c +++ b/channels/rdpdr/client/disk/disk_main.c @@ -123,7 +123,6 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp) uint32 CreateDisposition; uint32 CreateOptions; uint32 PathLength; - UNICONV* uniconv; char* path; uint32 FileId; uint8 Information; @@ -134,9 +133,7 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp) stream_read_uint32(irp->input, CreateOptions); stream_read_uint32(irp->input, PathLength); - uniconv = freerdp_uniconv_new(); - path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength); - freerdp_uniconv_free(uniconv); + path = freerdp_uniconv_in(stream_get_tail(irp->input), PathLength); FileId = irp->devman->id_sequence++; @@ -388,7 +385,6 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir STREAM* output = irp->output; struct STATVFS svfst; struct STAT st; - UNICONV* uniconv; char* volumeLabel = {"FREERDP"}; /* TODO: Add sub routine to correctly pick up Volume Label name for each O/S supported */ char* diskType = {"FAT32"}; char* outStr; @@ -403,9 +399,7 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir { case FileFsVolumeInformation: /* http://msdn.microsoft.com/en-us/library/cc232108.aspx */ - uniconv = freerdp_uniconv_new(); - outStr = freerdp_uniconv_out(uniconv, volumeLabel, &len); - freerdp_uniconv_free(uniconv); + outStr = freerdp_uniconv_out(volumeLabel, &len); stream_write_uint32(output, 17 + len); /* Length */ stream_check_size(output, 17 + len); stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* VolumeCreationTime */ @@ -429,9 +423,7 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir case FileFsAttributeInformation: /* http://msdn.microsoft.com/en-us/library/cc232101.aspx */ - uniconv = freerdp_uniconv_new(); - outStr = freerdp_uniconv_out(uniconv, diskType, &len); - freerdp_uniconv_free(uniconv); + outStr = freerdp_uniconv_out(diskType, &len); stream_write_uint32(output, 12 + len); /* Length */ stream_check_size(output, 12 + len); @@ -480,7 +472,6 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp) uint32 FsInformationClass; uint8 InitialQuery; uint32 PathLength; - UNICONV* uniconv; char* path; stream_read_uint32(irp->input, FsInformationClass); @@ -488,9 +479,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp) stream_read_uint32(irp->input, PathLength); stream_seek(irp->input, 23); /* Padding */ - uniconv = freerdp_uniconv_new(); - path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength); - freerdp_uniconv_free(uniconv); + path = freerdp_uniconv_in(stream_get_tail(irp->input), PathLength); file = disk_get_file_by_id(disk, irp->FileId); diff --git a/channels/rdpdr/client/parallel/parallel_main.c b/channels/rdpdr/client/parallel/parallel_main.c index 91f2b258d..0d09287d5 100644 --- a/channels/rdpdr/client/parallel/parallel_main.c +++ b/channels/rdpdr/client/parallel/parallel_main.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include "rdpdr_constants.h" @@ -70,18 +71,15 @@ typedef struct _PARALLEL_DEVICE PARALLEL_DEVICE; static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp) { - uint32 PathLength; char* path; - UNICONV* uniconv; + uint32 PathLength; stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */ /* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */ stream_read_uint32(irp->input, PathLength); - uniconv = freerdp_uniconv_new(); - path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength); - freerdp_uniconv_free(uniconv); + path = freerdp_uniconv_in(stream_get_tail(irp->input), PathLength); parallel->id = irp->devman->id_sequence++; parallel->file = open(parallel->path, O_RDWR); diff --git a/channels/rdpdr/client/printer/printer_main.c b/channels/rdpdr/client/printer/printer_main.c index fdedd193a..25b5e35f1 100644 --- a/channels/rdpdr/client/printer/printer_main.c +++ b/channels/rdpdr/client/printer/printer_main.c @@ -230,9 +230,7 @@ static void printer_free(DEVICE* device) void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* printer) { - PRINTER_DEVICE* printer_dev; char* port; - UNICONV* uniconv; uint32 Flags; size_t DriverNameLen; char* DriverName; @@ -240,6 +238,7 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri char* PrintName; uint32 CachedFieldsLen; uint8* CachedPrinterConfigData; + PRINTER_DEVICE* printer_dev; port = xmalloc(10); snprintf(port, 10, "PRN%d", printer->id); @@ -262,10 +261,8 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri if (printer->is_default) Flags |= RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER; - uniconv = freerdp_uniconv_new(); - DriverName = freerdp_uniconv_out(uniconv, printer->driver, &DriverNameLen); - PrintName = freerdp_uniconv_out(uniconv, printer->name, &PrintNameLen); - freerdp_uniconv_free(uniconv); + DriverName = freerdp_uniconv_out(printer->driver, &DriverNameLen); + PrintName = freerdp_uniconv_out(printer->name, &PrintNameLen); printer_dev->device.data = stream_new(28 + DriverNameLen + PrintNameLen + CachedFieldsLen); diff --git a/channels/rdpdr/client/rdpdr_main.c b/channels/rdpdr/client/rdpdr_main.c index 8c03594d1..390d254a5 100644 --- a/channels/rdpdr/client/rdpdr_main.c +++ b/channels/rdpdr/client/rdpdr_main.c @@ -96,15 +96,12 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr) { char* s; STREAM* data_out; - UNICONV* uniconv; size_t computerNameLenW; - uniconv = freerdp_uniconv_new(); - if (!rdpdr->computerName[0]) gethostname(rdpdr->computerName, sizeof(rdpdr->computerName) - 1); - s = freerdp_uniconv_out(uniconv, rdpdr->computerName, &computerNameLenW); + s = freerdp_uniconv_out(rdpdr->computerName, &computerNameLenW); data_out = stream_new(16 + computerNameLenW + 2); stream_write_uint16(data_out, RDPDR_CTYP_CORE); @@ -117,7 +114,6 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr) stream_write_uint16(data_out, 0); /* null terminator */ xfree(s); - freerdp_uniconv_free(uniconv); svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out); } diff --git a/channels/rdpdr/client/serial/serial_main.c b/channels/rdpdr/client/serial/serial_main.c index 547edbfa1..dc71b9324 100644 --- a/channels/rdpdr/client/serial/serial_main.c +++ b/channels/rdpdr/client/serial/serial_main.c @@ -79,23 +79,21 @@ static boolean serial_check_fds(SERIAL_DEVICE* serial); static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) { + char* path; SERIAL_TTY* tty; uint32 PathLength; uint32 FileId; - char* path; - UNICONV* uniconv; stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */ /* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */ stream_read_uint32(irp->input, PathLength); - uniconv = freerdp_uniconv_new(); - path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength); - freerdp_uniconv_free(uniconv); + path = freerdp_uniconv_in(stream_get_tail(irp->input), PathLength); FileId = irp->devman->id_sequence++; tty = serial_tty_new(serial->path, FileId); + if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; @@ -122,6 +120,7 @@ static void serial_process_irp_close(SERIAL_DEVICE* serial, IRP* irp) SERIAL_TTY* tty; tty = serial->tty; + if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; @@ -153,6 +152,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) DEBUG_SVC("length %u offset %llu", Length, Offset); tty = serial->tty; + if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; @@ -179,11 +179,13 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) } stream_write_uint32(irp->output, Length); + if (Length > 0) { stream_check_size(irp->output, Length); stream_write(irp->output, buffer, Length); } + xfree(buffer); irp->Complete(irp); @@ -202,6 +204,7 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp) DEBUG_SVC("length %u offset %llu", Length, Offset); tty = serial->tty; + if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; @@ -243,6 +246,7 @@ static void serial_process_irp_device_control(SERIAL_DEVICE* serial, IRP* irp) stream_seek(irp->input, 20); /* Padding */ tty = serial->tty; + if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 982fabab4..55bc4291d 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -530,13 +530,10 @@ static uint8* xf_cliprdr_process_requested_unicodetext(uint8* data, int* size) uint8* inbuf; uint8* outbuf; size_t out_size; - UNICONV* uniconv; inbuf = lf2crlf(data, size); - uniconv = freerdp_uniconv_new(); - outbuf = (uint8*) freerdp_uniconv_out(uniconv, (char*) inbuf, &out_size); - freerdp_uniconv_free(uniconv); + outbuf = (uint8*) freerdp_uniconv_out((char*) inbuf, &out_size); xfree(inbuf); @@ -578,9 +575,9 @@ static uint8* xf_cliprdr_process_requested_html(uint8* data, int* size) uint8* in; uint8* outbuf; char num[11]; - UNICONV* uniconv; inbuf = NULL; + if (*size > 2) { if ((uint8) data[0] == 0xFE && (uint8) data[1] == 0xFF) @@ -590,11 +587,10 @@ static uint8* xf_cliprdr_process_requested_html(uint8* data, int* size) if ((uint8) data[0] == 0xFF && (uint8) data[1] == 0xFE) { - uniconv = freerdp_uniconv_new(); - inbuf = (uint8*) freerdp_uniconv_in(uniconv, data + 2, *size - 2); - freerdp_uniconv_free(uniconv); + inbuf = (uint8*) freerdp_uniconv_in(data + 2, *size - 2); } } + if (inbuf == NULL) { inbuf = xzalloc(*size + 1); @@ -884,11 +880,7 @@ static void xf_cliprdr_process_text(clipboardContext* cb, uint8* data, int size) static void xf_cliprdr_process_unicodetext(clipboardContext* cb, uint8* data, int size) { - UNICONV* uniconv; - - uniconv = freerdp_uniconv_new(); - cb->data = (uint8*) freerdp_uniconv_in(uniconv, data, size); - freerdp_uniconv_free(uniconv); + cb->data = (uint8*) freerdp_uniconv_in(data, size); cb->data_length = strlen((char*) cb->data); crlf2lf(cb->data, &cb->data_length); } diff --git a/include/freerdp/rail/rail.h b/include/freerdp/rail/rail.h index ce0686ffb..7ffe15f62 100644 --- a/include/freerdp/rail/rail.h +++ b/include/freerdp/rail/rail.h @@ -45,7 +45,6 @@ typedef void (*railDesktopNonMonitored) (rdpRail* rail, rdpWindow* window); struct rdp_rail { void* extra; - UNICONV* uniconv; CLRCONV* clrconv; rdpIconCache* cache; rdpWindowList* list; diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 400a5c612..f4afb7bcb 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -22,7 +22,6 @@ #include #include -#include /* Performance Flags */ #define PERF_FLAG_NONE 0x00000000 @@ -317,7 +316,7 @@ struct rdp_settings ALIGN64 char* home_path; /* 112 */ ALIGN64 uint32 share_id; /* 113 */ ALIGN64 uint32 pdu_source; /* 114 */ - ALIGN64 UNICONV* uniconv; /* 115 */ + ALIGN64 void* unused115; /* 115 */ ALIGN64 boolean server_mode; /* 116 */ ALIGN64 char* config_path; /* 117 */ ALIGN64 char* current_path; /* 118 */ diff --git a/include/freerdp/utils/string.h b/include/freerdp/utils/string.h index 636b93b04..4a67d0ea6 100644 --- a/include/freerdp/utils/string.h +++ b/include/freerdp/utils/string.h @@ -23,7 +23,6 @@ #include #include #include -#include struct rdp_string { @@ -33,7 +32,7 @@ struct rdp_string }; typedef struct rdp_string rdpString; -FREERDP_API void freerdp_string_read_length32(STREAM* s, rdpString* string, UNICONV* uniconv); +FREERDP_API void freerdp_string_read_length32(STREAM* s, rdpString* string); FREERDP_API void freerdp_string_free(rdpString* string); #endif /* __STRING_UTILS_H */ diff --git a/include/freerdp/utils/unicode.h b/include/freerdp/utils/unicode.h index b864fb3b2..c43dadbca 100644 --- a/include/freerdp/utils/unicode.h +++ b/include/freerdp/utils/unicode.h @@ -24,31 +24,8 @@ #include #include -#define DEFAULT_CODEPAGE "UTF-8" -#define WINDOWS_CODEPAGE "UTF-16LE" - -#ifdef HAVE_ICONV -#include -#endif - -#ifndef ICONV_CONST -#define ICONV_CONST "" -#endif - -struct _UNICONV -{ - int iconv; -#ifdef HAVE_ICONV - iconv_t* in_iconv_h; - iconv_t* out_iconv_h; -#endif -}; -typedef struct _UNICONV UNICONV; - -FREERDP_API UNICONV* freerdp_uniconv_new(); -FREERDP_API void freerdp_uniconv_free(UNICONV *uniconv); -FREERDP_API char* freerdp_uniconv_in(UNICONV *uniconv, unsigned char* pin, size_t in_len); -FREERDP_API char* freerdp_uniconv_out(UNICONV *uniconv, const char *str, size_t *pout_len); +FREERDP_API char* freerdp_uniconv_in(unsigned char* pin, size_t in_len); +FREERDP_API char* freerdp_uniconv_out(const char *str, size_t *pout_len); #include diff --git a/libfreerdp/cache/bitmap.c b/libfreerdp/cache/bitmap.c index c361c4f88..0d52c2f8d 100644 --- a/libfreerdp/cache/bitmap.c +++ b/libfreerdp/cache/bitmap.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include #include #include diff --git a/libfreerdp/cache/brush.c b/libfreerdp/cache/brush.c index 28ef07ef7..30cebd588 100644 --- a/libfreerdp/cache/brush.c +++ b/libfreerdp/cache/brush.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include #include #include diff --git a/libfreerdp/cache/glyph.c b/libfreerdp/cache/glyph.c index ca0ca8931..052afdbc3 100644 --- a/libfreerdp/cache/glyph.c +++ b/libfreerdp/cache/glyph.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include #include #include diff --git a/libfreerdp/cache/nine_grid.c b/libfreerdp/cache/nine_grid.c index 40bd9a3f8..7c89d40c2 100644 --- a/libfreerdp/cache/nine_grid.c +++ b/libfreerdp/cache/nine_grid.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include #include #include diff --git a/libfreerdp/cache/offscreen.c b/libfreerdp/cache/offscreen.c index 51ad5139b..132a8d5ad 100644 --- a/libfreerdp/cache/offscreen.c +++ b/libfreerdp/cache/offscreen.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include #include diff --git a/libfreerdp/cache/palette.c b/libfreerdp/cache/palette.c index ca4576700..e73765cd9 100644 --- a/libfreerdp/cache/palette.c +++ b/libfreerdp/cache/palette.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include #include diff --git a/libfreerdp/cache/pointer.c b/libfreerdp/cache/pointer.c index dea91ebf5..c396bdce8 100644 --- a/libfreerdp/cache/pointer.c +++ b/libfreerdp/cache/pointer.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include #include diff --git a/libfreerdp/codec/mppc_dec.c b/libfreerdp/codec/mppc_dec.c index b8cbe73bd..7a4d8d8a4 100644 --- a/libfreerdp/codec/mppc_dec.c +++ b/libfreerdp/codec/mppc_dec.c @@ -22,9 +22,12 @@ #include "config.h" #endif -#include +#include + #include +#include + static uint8 HuffLenLEC[] = { 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x8, 0x9, 0x9, 0xa, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0x9, 0xa, 0x9, 0xa, 0x9, 0x9, 0x9, 0xa, 0xa, 0x9, 0xa, 0x9, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x8, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x7, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xd, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xb, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0x8, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0x8, 0x7, 0xd, 0xd, 0x7, 0x7, 0xa, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x5, 0x6, 0x6, 0x6, 0x5, 0x6, 0x5, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x8, 0x5, 0x6, 0x7, 0x7 }; diff --git a/libfreerdp/core/errinfo.c b/libfreerdp/core/errinfo.c index d2f255d37..423a4e6b1 100644 --- a/libfreerdp/core/errinfo.c +++ b/libfreerdp/core/errinfo.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include "errinfo.h" int connectErrorCode; diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c index e751a263a..3c6d732a3 100644 --- a/libfreerdp/core/gcc.c +++ b/libfreerdp/core/gcc.c @@ -22,6 +22,7 @@ #endif #include +#include #include "gcc.h" #include "certificate.h" @@ -490,7 +491,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block stream_read_uint32(s, settings->client_build); /* clientBuild */ /* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */ - str = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), 32); + str = freerdp_uniconv_in(stream_get_tail(s), 32); stream_seek(s, 32); snprintf(settings->client_hostname, 31, "%s", str); settings->client_hostname[31] = 0; @@ -545,7 +546,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block if (blockLength < 64) break; - str = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), 64); + str = freerdp_uniconv_in(stream_get_tail(s), 64); stream_seek(s, 64); snprintf(settings->client_product_id, 32, "%s", str); xfree(str); @@ -642,8 +643,8 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings) gcc_write_user_data_header(s, CS_CORE, 216); version = settings->rdp_version >= 5 ? RDP_VERSION_5_PLUS : RDP_VERSION_4; - clientName = freerdp_uniconv_out(settings->uniconv, settings->client_hostname, &clientNameLength); - clientDigProductId = freerdp_uniconv_out(settings->uniconv, settings->client_product_id, &clientDigProductIdLength); + clientName = freerdp_uniconv_out(settings->client_hostname, &clientNameLength); + clientDigProductId = freerdp_uniconv_out(settings->client_product_id, &clientDigProductIdLength); stream_write_uint32(s, version); /* version */ stream_write_uint16(s, settings->width); /* desktopWidth */ diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c index e5a9d381d..8f5ac3a23 100644 --- a/libfreerdp/core/info.c +++ b/libfreerdp/core/info.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include "timezone.h" #include "info.h" @@ -119,7 +121,7 @@ boolean rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings) settings->ipv6 = (clientAddressFamily == ADDRESS_FAMILY_INET6 ? true : false); if (stream_get_left(s) < cbClientAddress) return false; - settings->ip_address = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), cbClientAddress); + settings->ip_address = freerdp_uniconv_in(stream_get_tail(s), cbClientAddress); stream_seek(s, cbClientAddress); stream_read_uint16(s, cbClientDir); /* cbClientDir */ @@ -127,7 +129,7 @@ boolean rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings) return false; if (settings->client_dir) xfree(settings->client_dir); - settings->client_dir = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), cbClientDir); + settings->client_dir = freerdp_uniconv_in(stream_get_tail(s), cbClientDir); stream_seek(s, cbClientDir); if (!rdp_read_client_time_zone(s, settings)) @@ -166,10 +168,10 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings) clientAddressFamily = settings->ipv6 ? ADDRESS_FAMILY_INET6 : ADDRESS_FAMILY_INET; - clientAddress = (uint8*) freerdp_uniconv_out(settings->uniconv, settings->ip_address, &length); + clientAddress = (uint8*) freerdp_uniconv_out(settings->ip_address, &length); cbClientAddress = length; - clientDir = (uint8*) freerdp_uniconv_out(settings->uniconv, settings->client_dir, &length); + clientDir = (uint8*) freerdp_uniconv_out(settings->client_dir, &length); cbClientDir = length; cbAutoReconnectLen = settings->client_auto_reconnect_cookie->cbLen; @@ -239,7 +241,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) return false; if (cbDomain > 0) { - settings->domain = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), cbDomain); + settings->domain = freerdp_uniconv_in(stream_get_tail(s), cbDomain); stream_seek(s, cbDomain); } stream_seek(s, 2); @@ -248,7 +250,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) return false; if (cbUserName > 0) { - settings->username = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), cbUserName); + settings->username = freerdp_uniconv_in(stream_get_tail(s), cbUserName); stream_seek(s, cbUserName); } stream_seek(s, 2); @@ -257,7 +259,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) return false; if (cbPassword > 0) { - settings->password = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), cbPassword); + settings->password = freerdp_uniconv_in(stream_get_tail(s), cbPassword); stream_seek(s, cbPassword); } stream_seek(s, 2); @@ -266,7 +268,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) return false; if (cbAlternateShell > 0) { - settings->shell = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), cbAlternateShell); + settings->shell = freerdp_uniconv_in(stream_get_tail(s), cbAlternateShell); stream_seek(s, cbAlternateShell); } stream_seek(s, 2); @@ -275,7 +277,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) return false; if (cbWorkingDir > 0) { - settings->directory = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), cbWorkingDir); + settings->directory = freerdp_uniconv_in(stream_get_tail(s), cbWorkingDir); stream_seek(s, cbWorkingDir); } stream_seek(s, 2); @@ -335,10 +337,10 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings) if (settings->compression) flags |= INFO_COMPRESSION | INFO_PACKET_COMPR_TYPE_RDP6; - domain = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->domain, &length); + domain = (uint8*) freerdp_uniconv_out(settings->domain, &length); cbDomain = length; - userName = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->username, &length); + userName = (uint8*) freerdp_uniconv_out(settings->username, &length); cbUserName = length; if (settings->password_cookie && settings->password_cookie->length > 0) @@ -349,14 +351,14 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings) } else { - password = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->password, &length); + password = (uint8*) freerdp_uniconv_out(settings->password, &length); cbPassword = length; } - alternateShell = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->shell, &length); + alternateShell = (uint8*) freerdp_uniconv_out(settings->shell, &length); cbAlternateShell = length; - workingDir = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->directory, &length); + workingDir = (uint8*) freerdp_uniconv_out(settings->directory, &length); cbWorkingDir = length; stream_write_uint32(s, 0); /* CodePage */ diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c index 8bd3fa5fb..502d7e7e0 100644 --- a/libfreerdp/core/nego.c +++ b/libfreerdp/core/nego.c @@ -26,6 +26,7 @@ #include #include +#include #include "tpkt.h" @@ -234,7 +235,6 @@ boolean nego_send_preconnection_pdu(rdpNego* nego) { STREAM* s; uint32 cbSize; - UNICONV* uniconv; uint16 cchPCB_times2 = 0; char* wszPCB = NULL; @@ -252,10 +252,8 @@ boolean nego_send_preconnection_pdu(rdpNego* nego) if (nego->preconnection_blob) { size_t size; - uniconv = freerdp_uniconv_new(); - wszPCB = freerdp_uniconv_out(uniconv, nego->preconnection_blob, &size); + wszPCB = freerdp_uniconv_out(nego->preconnection_blob, &size); cchPCB_times2 = (uint16) size; - freerdp_uniconv_free(uniconv); cchPCB_times2 += 2; /* zero-termination */ cbSize += cchPCB_times2; } diff --git a/libfreerdp/core/redirection.c b/libfreerdp/core/redirection.c index 8fe1f7659..4b0561f15 100644 --- a/libfreerdp/core/redirection.c +++ b/libfreerdp/core/redirection.c @@ -78,7 +78,7 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) if (redirection->flags & LB_TARGET_NET_ADDRESS) { - freerdp_string_read_length32(s, &redirection->targetNetAddress, rdp->settings->uniconv); + freerdp_string_read_length32(s, &redirection->targetNetAddress); DEBUG_REDIR("targetNetAddress: %s", redirection->targetNetAddress.ascii); } @@ -96,13 +96,13 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) if (redirection->flags & LB_USERNAME) { - freerdp_string_read_length32(s, &redirection->username, rdp->settings->uniconv); + freerdp_string_read_length32(s, &redirection->username); DEBUG_REDIR("username: %s", redirection->username.ascii); } if (redirection->flags & LB_DOMAIN) { - freerdp_string_read_length32(s, &redirection->domain, rdp->settings->uniconv); + freerdp_string_read_length32(s, &redirection->domain); DEBUG_REDIR("domain: %s", redirection->domain.ascii); } @@ -121,19 +121,19 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) if (redirection->flags & LB_TARGET_FQDN) { - freerdp_string_read_length32(s, &redirection->targetFQDN, rdp->settings->uniconv); + freerdp_string_read_length32(s, &redirection->targetFQDN); DEBUG_REDIR("targetFQDN: %s", redirection->targetFQDN.ascii); } if (redirection->flags & LB_TARGET_NETBIOS_NAME) { - freerdp_string_read_length32(s, &redirection->targetNetBiosName, rdp->settings->uniconv); + freerdp_string_read_length32(s, &redirection->targetNetBiosName); DEBUG_REDIR("targetNetBiosName: %s", redirection->targetNetBiosName.ascii); } if (redirection->flags & LB_CLIENT_TSV_URL) { - freerdp_string_read_length32(s, &redirection->tsvUrl, rdp->settings->uniconv); + freerdp_string_read_length32(s, &redirection->tsvUrl); DEBUG_REDIR("tsvUrl: %s", redirection->tsvUrl.ascii); } @@ -152,7 +152,7 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) for (i = 0; i < (int) count; i++) { - freerdp_string_read_length32(s, &redirection->targetNetAddresses[i], rdp->settings->uniconv); + freerdp_string_read_length32(s, &redirection->targetNetAddresses[i]); DEBUG_REDIR("targetNetAddresses: %s", (&redirection->targetNetAddresses[i])->ascii); } } diff --git a/libfreerdp/core/rpc.c b/libfreerdp/core/rpc.c index b074a19d2..08b8ff5c6 100644 --- a/libfreerdp/core/rpc.c +++ b/libfreerdp/core/rpc.c @@ -156,7 +156,7 @@ rdpNtlm* ntlm_new() if (ntlm != NULL) { - ntlm->uniconv = freerdp_uniconv_new(); + } return ntlm; @@ -166,7 +166,7 @@ void ntlm_free(rdpNtlm* ntlm) { if (ntlm != NULL) { - freerdp_uniconv_free(ntlm->uniconv); + } } diff --git a/libfreerdp/core/rpc.h b/libfreerdp/core/rpc.h index 3445c9a22..e35bab02e 100644 --- a/libfreerdp/core/rpc.h +++ b/libfreerdp/core/rpc.h @@ -530,7 +530,6 @@ typedef struct { struct rdp_ntlm { - UNICONV* uniconv; CtxtHandle context; ULONG cbMaxToken; ULONG fContextReq; @@ -647,7 +646,6 @@ struct rdp_rpc rdpNtlmHttp* ntlm_http_in; rdpNtlmHttp* ntlm_http_out; - UNICONV* uniconv; rdpSettings* settings; rdpTransport* transport; diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index 9935f4f29..20534403d 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -272,7 +272,6 @@ rdpSettings* settings_new(void* instance) settings->frame_acknowledge = 2; - settings->uniconv = freerdp_uniconv_new(); gethostname(settings->client_hostname, 31); settings->client_hostname[31] = 0; settings->mouse_motion = true; @@ -296,7 +295,6 @@ void settings_free(rdpSettings* settings) { if (settings != NULL) { - freerdp_uniconv_free(settings->uniconv); xfree(settings->hostname); xfree(settings->username); xfree(settings->password); diff --git a/libfreerdp/core/timezone.c b/libfreerdp/core/timezone.c index 071a59735..3bccf9cde 100644 --- a/libfreerdp/core/timezone.c +++ b/libfreerdp/core/timezone.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include "timezone.h" /** @@ -85,7 +87,7 @@ boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) stream_read_uint32(s, clientTimeZone->bias); /* Bias */ /* standardName (64 bytes) */ - str = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), 64); + str = freerdp_uniconv_in(stream_get_tail(s), 64); stream_seek(s, 64); strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName)); xfree(str); @@ -94,7 +96,7 @@ boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) stream_read_uint32(s, clientTimeZone->standardBias); /* StandardBias */ /* daylightName (64 bytes) */ - str = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), 64); + str = freerdp_uniconv_in(stream_get_tail(s), 64); stream_seek(s, 64); strncpy(clientTimeZone->daylightName, str, sizeof(clientTimeZone->daylightName)); xfree(str); @@ -127,10 +129,10 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) clientTimeZone = settings->client_time_zone; freerdp_time_zone_detect(clientTimeZone); - standardName = (uint8*) freerdp_uniconv_out(settings->uniconv, clientTimeZone->standardName, &length); + standardName = (uint8*) freerdp_uniconv_out(clientTimeZone->standardName, &length); standardNameLength = length; - daylightName = (uint8*) freerdp_uniconv_out(settings->uniconv, clientTimeZone->daylightName, &length); + daylightName = (uint8*) freerdp_uniconv_out(clientTimeZone->daylightName, &length); daylightNameLength = length; if (standardNameLength > 62) diff --git a/libfreerdp/core/tsg.c b/libfreerdp/core/tsg.c index a6e799740..5a4f42529 100644 --- a/libfreerdp/core/tsg.c +++ b/libfreerdp/core/tsg.c @@ -459,7 +459,6 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) uint32 length; STREAM* s_p4; int status = -1; - UNICONV* tsg_uniconv; rdpRpc* rpc = tsg->rpc; uint8* dest_addr_unic; uint32 dest_addr_unic_len; @@ -572,9 +571,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) } status = -1; - tsg_uniconv = freerdp_uniconv_new(); - dest_addr_unic = (uint8*) freerdp_uniconv_out(tsg_uniconv, hostname, (size_t*) &dest_addr_unic_len); - freerdp_uniconv_free(tsg_uniconv); + dest_addr_unic = (uint8*) freerdp_uniconv_out(hostname, (size_t*) &dest_addr_unic_len); memcpy(tsg_packet4 + 4, tsg->TunnelContext, 16); memcpy(tsg_packet4 + 38, &port, 2); diff --git a/libfreerdp/rail/rail.c b/libfreerdp/rail/rail.c index d0aeb6a12..0720ce2dd 100644 --- a/libfreerdp/rail/rail.c +++ b/libfreerdp/rail/rail.c @@ -148,7 +148,6 @@ rdpRail* rail_new(rdpSettings* settings) rail->settings = settings; rail->cache = icon_cache_new(rail); rail->list = window_list_new(rail); - rail->uniconv = freerdp_uniconv_new(); rail->clrconv = (CLRCONV*) xzalloc(sizeof(CLRCONV)); } @@ -161,7 +160,6 @@ void rail_free(rdpRail* rail) { icon_cache_free(rail->cache); window_list_free(rail->list); - freerdp_uniconv_free(rail->uniconv); xfree(rail->clrconv); xfree(rail); } diff --git a/libfreerdp/rail/window.c b/libfreerdp/rail/window.c index 208e560c9..3cccb393f 100644 --- a/libfreerdp/rail/window.c +++ b/libfreerdp/rail/window.c @@ -285,7 +285,7 @@ void rail_CreateWindow(rdpRail* rail, rdpWindow* window) { if (window->titleInfo.length > 0) { - window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length); + window->title = freerdp_uniconv_in(window->titleInfo.string, window->titleInfo.length); } else { @@ -327,7 +327,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window) if (window->title != NULL) xfree(window->title); - window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length); + window->title = freerdp_uniconv_in(window->titleInfo.string, window->titleInfo.length); IFCALL(rail->rail_SetWindowText, rail, window); } diff --git a/libfreerdp/utils/profiler.c b/libfreerdp/utils/profiler.c index dfd547a46..b12729e93 100644 --- a/libfreerdp/utils/profiler.c +++ b/libfreerdp/utils/profiler.c @@ -21,6 +21,8 @@ #include "config.h" #endif +#include + #include PROFILER* profiler_create(char* name) diff --git a/libfreerdp/utils/string.c b/libfreerdp/utils/string.c index 9b0c30106..a1c3db452 100644 --- a/libfreerdp/utils/string.c +++ b/libfreerdp/utils/string.c @@ -22,15 +22,16 @@ #endif #include +#include #include -void freerdp_string_read_length32(STREAM* s, rdpString* string, UNICONV* uniconv) +void freerdp_string_read_length32(STREAM* s, rdpString* string) { stream_read_uint32(s, string->length); string->unicode = (char*) xmalloc(string->length); stream_read(s, string->unicode, string->length); - string->ascii = freerdp_uniconv_in(uniconv, (uint8*) string->unicode, string->length); + string->ascii = freerdp_uniconv_in((uint8*) string->unicode, string->length); } void freerdp_string_free(rdpString* string) diff --git a/libfreerdp/utils/time.c b/libfreerdp/utils/time.c index 6f500a7c6..9e22d0e79 100644 --- a/libfreerdp/utils/time.c +++ b/libfreerdp/utils/time.c @@ -21,6 +21,7 @@ #include "config.h" #endif +#include #include #include diff --git a/libfreerdp/utils/unicode.c b/libfreerdp/utils/unicode.c index 76091b875..3ea8d16a8 100644 --- a/libfreerdp/utils/unicode.c +++ b/libfreerdp/utils/unicode.c @@ -31,40 +31,7 @@ #include -UNICONV* freerdp_uniconv_new() -{ - UNICONV *uniconv = xnew(UNICONV); - -#ifdef HAVE_ICONV - uniconv->iconv = 1; - uniconv->in_iconv_h = iconv_open(DEFAULT_CODEPAGE, WINDOWS_CODEPAGE); - if (errno == EINVAL) - { - printf("Error opening iconv converter to %s from %s\n", DEFAULT_CODEPAGE, WINDOWS_CODEPAGE); - } - uniconv->out_iconv_h = iconv_open(WINDOWS_CODEPAGE, DEFAULT_CODEPAGE); - if (errno == EINVAL) - { - printf("Error opening iconv converter to %s from %s\n", WINDOWS_CODEPAGE, DEFAULT_CODEPAGE); - } -#endif - - return uniconv; -} - -void freerdp_uniconv_free(UNICONV *uniconv) -{ - if (uniconv != NULL) - { -#ifdef HAVE_ICONV - iconv_close(uniconv->in_iconv_h); - iconv_close(uniconv->out_iconv_h); -#endif - xfree(uniconv); - } -} - -char* freerdp_uniconv_out(UNICONV* uniconv, const char *str, size_t* pout_len) +char* freerdp_uniconv_out(const char *str, size_t* pout_len) { WCHAR* wstr; int length; @@ -97,7 +64,7 @@ int freerdp_AsciiToUnicodeAlloc(const CHAR* str, WCHAR** wstr, int length) return length; } -char* freerdp_uniconv_in(UNICONV* uniconv, unsigned char* pin, size_t in_len) +char* freerdp_uniconv_in(unsigned char* pin, size_t in_len) { CHAR* str; int length;