29 const char *fromCs,
const char *toCs)
37 ic=iconv_open(toCs, fromCs);
38 if (ic==(iconv_t)-1) {
40 fromCs, toCs, strerror(errno));
62 done=iconv(ic, &pInbuf, &inLeft, &pOutbuf, &outLeft);
65 if (done==(
size_t)-1) {
81 strerror(errno), errno);
114 const char *
fmt, ...)
123 rv=vfprintf(stream,
fmt, args);
126 rv=vfprintf(stream,
fmt, args);
136 if (spaceNeeded==(
size_t) -1) {
137 fprintf(stderr,
"GWEN INTERNAL ERROR: vsnprintf returned -1 on fmt=\"%s\"?\n",
fmt);
141 if (spaceNeeded>=bufLen) {
148 if (spaceNeeded>=bufLen) {
149 fprintf(stderr,
"GWEN INTERNAL ERROR: Still not enough space (%lu >=%lu)? SNH!\n",
150 (
long unsigned int) spaceNeeded, (
long unsigned int) bufLen);
151 assert(spaceNeeded<bufLen);
159 outbuf,
"UTF-8", gui->charSet);
217 while ((p=strchr(p,
'<'))) {
222 if (toupper(*t)==
'H') {
224 if (toupper(*t)==
'T') {
226 if (toupper(*t)==
'M') {
228 if (toupper(*t)==
'L') {
GWENHYWFAR_API const char * fmt
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
int GWEN_Buffer_AllocRoom(GWEN_BUFFER *bf, uint32_t size)
uint32_t GWEN_Buffer_GetMaxUnsegmentedWrite(GWEN_BUFFER *bf)
int GWEN_Gui_ConvertFromUtf8(const GWEN_GUI *gui, const char *text, int len, GWEN_BUFFER *tbuf)
void GWEN_Gui_GetRawText(GWEN_UNUSED const GWEN_GUI *gui, const char *text, GWEN_BUFFER *tbuf)
int GWEN_Buffer_AdjustUsedBytes(GWEN_BUFFER *bf)
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
int GWEN_Gui_StdPrintf(const GWEN_GUI *gui, FILE *stream, const char *fmt,...)
char * GWEN_Buffer_GetPosPointer(const GWEN_BUFFER *bf)
int GWEN_Buffer_IncrementPos(GWEN_BUFFER *bf, uint32_t i)
#define DBG_DEBUG(dbg_logger, format, args...)
GWEN_GUI * GWEN_Gui_GetGui(void)
#define GWEN_ERROR_GENERIC
int GWEN_Gui_ConvertString(const char *text, size_t len, GWEN_BUFFER *tbuf, const char *fromCs, const char *toCs)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
#define DBG_ERROR(dbg_logger, format, args...)
int GWEN_Buffer_SetPos(GWEN_BUFFER *bf, uint32_t i)
#define DBG_INFO(dbg_logger, format, args...)
int GWEN_Buffer_AppendBytes(GWEN_BUFFER *bf, const char *buffer, uint32_t size)
int GWEN_Gui_ReadString(const char *text, GWEN_BUFFER *tbuf)
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)