static size_t __stdcall strw_dump(const value_t* v, TCHAR* buffer, size_t bufsize) { const WCHAR* s = VALUE_DATA(v, WCHAR*); if(s == NULL) s = strw_empty; if(bufsize > 0) mc_str_inbuf(s, MC_STRW, buffer, MC_STRT, bufsize); #ifdef UNICODE return wcslen(s) + 1; #else return WideCharToMultiByte(CP_ACP, 0, s, -1, NULL, 0, NULL, NULL); #endif }
int table_get_cell_data(table_t* table, WORD col, WORD row, MC_TABLECELL* cell_data, BOOL unicode) { table_cell_t* cell; TABLE_TRACE("table_get_cell_data(%p, %hd, %hd, %p, %s)", table, col, row, cell_data, (unicode ? "unicode" : "ansi")); cell = table_get_cell(table, col, row); if(MC_ERR(cell == NULL)) { MC_TRACE("table_set_cell_data: table_get_cell_data() failed."); return -1; } if(MC_ERR(cell_data->fMask & ~MC_TCMF_ALL)) { MC_TRACE("table_get_cell_data: Unsupported pCell->fMask 0x%x", cell_data->fMask); SetLastError(ERROR_INVALID_PARAMETER); return -1; } if(cell_data->fMask & MC_TCMF_TEXT) { if(cell->text == MC_LPSTR_TEXTCALLBACK) { MC_TRACE("table_get_cell_data: Table cell contains " "MC_LPSTR_TEXTCALLBACK and that cannot be asked for."); SetLastError(ERROR_INVALID_PARAMETER); return -1; } else { mc_str_inbuf(cell->text, MC_STRT, cell_data->pszText, (unicode ? MC_STRW : MC_STRA), cell_data->cchTextMax); } } if(cell_data->fMask & MC_TCMF_PARAM) cell_data->lParam = cell->lp; if(cell_data->fMask & MC_TCMF_FLAGS) cell_data->dwFlags = cell->flags; return 0; }