"Adam Petaccia" <adam(a)tpetaccia.com> wrote:
+GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics, + LOGFONTA *lfa) +{ + INT bytesWritten; + /* FIXME: use graphics */ + if(!(font && graphics && lfa)) + return InvalidParameter; + + memcpy(lfa, &font->lfw, sizeof(LOGFONTA));
FIELD_OFFSET(LOGFONTA, lfFaceName) instead of sizeof(LOGFONTA) would be better IMO.
+ bytesWritten = WideCharToMultiByte(CP_ACP, 0, font->lfw.lfFaceName, -1, + lfa->lfFaceName, LF_FACESIZE, NULL, NULL); + + if (bytesWritten == 0) + { + ERR("Could not convert from WideChar to Multibyte with error %d\n", + GetLastError()); + return GenericError; + }
The ERR() as well as the bytesWritten check are useless, please remove them. -- Dmitry.