Commit 6887af4f authored by Alexandre Julliard's avatar Alexandre Julliard

wineps.drv: Build with msvcrt.

parent d5400af7
MODULE = wineps.drv MODULE = wineps.drv
IMPORTS = user32 gdi32 winspool advapi32 IMPORTS = user32 gdi32 winspool advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
afm.c \ afm.c \
bitblt.c \ bitblt.c \
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <string.h> #include <string.h>
#include "psdrv.h" #include "psdrv.h"
......
...@@ -282,7 +282,7 @@ BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) ...@@ -282,7 +282,7 @@ BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics)
* Find the AFMMETRICS for a given UV. Returns first glyph in the font * Find the AFMMETRICS for a given UV. Returns first glyph in the font
* (space?) if the font does not have a glyph for the given UV. * (space?) if the font does not have a glyph for the given UV.
*/ */
static int MetricsByUV(const void *a, const void *b) static int __cdecl MetricsByUV(const void *a, const void *b)
{ {
return (int)(((const AFMMETRICS *)a)->UV - ((const AFMMETRICS *)b)->UV); return (int)(((const AFMMETRICS *)a)->UV - ((const AFMMETRICS *)b)->UV);
} }
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#include "config.h"
#include <string.h> #include <string.h>
#include "wine/debug.h" #include "wine/debug.h"
...@@ -283,7 +281,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, ...@@ -283,7 +281,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
WCHAR buf[256]; WCHAR buf[256];
res = di->pi->ppd->DefaultResolution; res = di->pi->ppd->DefaultResolution;
len = sprintfW(buf, resW, res); len = swprintf(buf, ARRAY_SIZE(buf), resW, res);
buf[len++] = ' '; buf[len++] = ' ';
LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len); LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf); SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
...@@ -313,9 +311,9 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, ...@@ -313,9 +311,9 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
DWORD idx; DWORD idx;
if (res->resx == res->resy) if (res->resx == res->resy)
len = sprintfW(buf, resW, res->resx); len = swprintf(buf, ARRAY_SIZE(buf), resW, res->resx);
else else
len = sprintfW(buf, resxyW, res->resx, res->resy); len = swprintf(buf, ARRAY_SIZE(buf), resxyW, res->resx, res->resy);
buf[len++] = ' '; buf[len++] = ' ';
LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len); LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
idx = SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf); idx = SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -28,9 +25,6 @@ ...@@ -28,9 +25,6 @@
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
......
...@@ -18,18 +18,11 @@ ...@@ -18,18 +18,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#if defined(HAVE_FLOAT_H) #include <float.h>
# include <float.h>
#endif
#if !defined(PI)
# define PI M_PI
#endif
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
...@@ -221,8 +214,8 @@ static BOOL PSDRV_DrawArc( PHYSDEV dev, INT left, INT top, ...@@ -221,8 +214,8 @@ static BOOL PSDRV_DrawArc( PHYSDEV dev, INT left, INT top,
start_angle = atan2((double)(y - start.y) * ratio, (double)(start.x - x)); start_angle = atan2((double)(y - start.y) * ratio, (double)(start.x - x));
end_angle = atan2((double)(y - end.y) * ratio, (double)(end.x - x)); end_angle = atan2((double)(y - end.y) * ratio, (double)(end.x - x));
start_angle *= 180.0 / PI; start_angle *= 180.0 / M_PI;
end_angle *= 180.0 / PI; end_angle *= 180.0 / M_PI;
PSDRV_WriteSpool(dev,"%DrawArc\n", 9); PSDRV_WriteSpool(dev,"%DrawArc\n", 9);
PSDRV_SetPen(dev); PSDRV_SetPen(dev);
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
...@@ -36,7 +33,6 @@ ...@@ -36,7 +33,6 @@
#include "winuser.h" #include "winuser.h"
#include "psdrv.h" #include "psdrv.h"
#include "winspool.h" #include "winspool.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
...@@ -650,7 +646,7 @@ static WCHAR *get_ppd_filename( HANDLE printer ) ...@@ -650,7 +646,7 @@ static WCHAR *get_ppd_filename( HANDLE printer )
if (!info) return NULL; if (!info) return NULL;
GetPrinterDriverW( printer, NULL, 2, (BYTE*)info, needed, &needed ); GetPrinterDriverW( printer, NULL, 2, (BYTE*)info, needed, &needed );
name = (WCHAR *)info; name = (WCHAR *)info;
memmove( name, info->pDataFile, (strlenW( info->pDataFile ) + 1) * sizeof(WCHAR) ); memmove( name, info->pDataFile, (lstrlenW( info->pDataFile ) + 1) * sizeof(WCHAR) );
return name; return name;
} }
...@@ -674,15 +670,15 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) ...@@ -674,15 +670,15 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
LIST_FOR_EACH_ENTRY( pi, &printer_list, PRINTERINFO, entry ) LIST_FOR_EACH_ENTRY( pi, &printer_list, PRINTERINFO, entry )
{ {
if (!strcmpW( pi->friendly_name, name )) if (!wcscmp( pi->friendly_name, name ))
return pi; return pi;
} }
pi = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) ); pi = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) );
if (pi == NULL) return NULL; if (pi == NULL) return NULL;
if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (strlenW(name)+1)*sizeof(WCHAR) ))) goto fail; if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (lstrlenW(name)+1)*sizeof(WCHAR) ))) goto fail;
strcpyW( pi->friendly_name, name ); lstrcpyW( pi->friendly_name, name );
if (OpenPrinterW( pi->friendly_name, &hPrinter, NULL ) == 0) { if (OpenPrinterW( pi->friendly_name, &hPrinter, NULL ) == 0) {
ERR ("OpenPrinter failed with code %i\n", GetLastError ()); ERR ("OpenPrinter failed with code %i\n", GetLastError ());
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h"
#include "wingdi.h" #include "wingdi.h"
#include "psdrv.h" #include "psdrv.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "wingdi.h" #include "wingdi.h"
#include "winspool.h" #include "winspool.h"
#include "wine/unicode.h"
#include "wine/gdi_driver.h" #include "wine/gdi_driver.h"
#include "wine/list.h" #include "wine/list.h"
...@@ -595,7 +594,7 @@ static inline WCHAR *strdupW( const WCHAR *str ) ...@@ -595,7 +594,7 @@ static inline WCHAR *strdupW( const WCHAR *str )
WCHAR *ret; WCHAR *ret;
if (!str) return NULL; if (!str) return NULL;
size = (strlenW( str ) + 1) * sizeof(WCHAR); size = (lstrlenW( str ) + 1) * sizeof(WCHAR);
ret = HeapAlloc( GetProcessHeap(), 0, size ); ret = HeapAlloc( GetProcessHeap(), 0, size );
if (ret) memcpy( ret, str, size ); if (ret) memcpy( ret, str, size );
return ret; return ret;
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
......
...@@ -25,23 +25,15 @@ ...@@ -25,23 +25,15 @@
* *
*/ */
#include "config.h"
#include "wine/port.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#endif
#include <errno.h> #include <errno.h>
#include <io.h>
#include <ctype.h> #include <ctype.h>
#include <limits.h> /* INT_MIN */ #include <limits.h> /* INT_MIN */
#ifdef HAVE_FLOAT_H
#include <float.h> /* FLT_MAX */ #include <float.h> /* FLT_MAX */
#endif
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -818,7 +810,7 @@ static const LONG ansiChars[21] = ...@@ -818,7 +810,7 @@ static const LONG ansiChars[21] =
0x20ac, 0x2122, 0x2219 0x20ac, 0x2122, 0x2219
}; };
static int cmpUV(const void *a, const void *b) static int __cdecl cmpUV(const void *a, const void *b)
{ {
return (int)(*((const LONG *)a) - *((const LONG *)b)); return (int)(*((const LONG *)a) - *((const LONG *)b));
} }
...@@ -849,7 +841,7 @@ static inline BOOL IsWinANSI(LONG uv) ...@@ -849,7 +841,7 @@ static inline BOOL IsWinANSI(LONG uv)
* Also does some font metric calculations that require UVs to be known. * Also does some font metric calculations that require UVs to be known.
* *
*/ */
static int UnicodeGlyphByNameIndex(const void *a, const void *b) static int __cdecl UnicodeGlyphByNameIndex(const void *a, const void *b)
{ {
return ((const UNICODEGLYPH *)a)->name->index - return ((const UNICODEGLYPH *)a)->name->index -
((const UNICODEGLYPH *)b)->name->index; ((const UNICODEGLYPH *)b)->name->index;
...@@ -935,7 +927,7 @@ static VOID Unicodify(AFM *afm, OLD_AFMMETRICS *metrics) ...@@ -935,7 +927,7 @@ static VOID Unicodify(AFM *afm, OLD_AFMMETRICS *metrics)
* Reads metrics for all glyphs. *p_metrics will be NULL on non-fatal error. * Reads metrics for all glyphs. *p_metrics will be NULL on non-fatal error.
* *
*/ */
static int OldAFMMetricsByUV(const void *a, const void *b) static int __cdecl OldAFMMetricsByUV(const void *a, const void *b)
{ {
return ((const OLD_AFMMETRICS *)a)->UV - ((const OLD_AFMMETRICS *)b)->UV; return ((const OLD_AFMMETRICS *)a)->UV - ((const OLD_AFMMETRICS *)b)->UV;
} }
...@@ -1099,17 +1091,18 @@ static BOOL BuildAFM(FILE *file) ...@@ -1099,17 +1091,18 @@ static BOOL BuildAFM(FILE *file)
* unexpected errors (memory allocation or I/O). * unexpected errors (memory allocation or I/O).
* *
*/ */
static BOOL ReadAFMFile(LPCSTR filename) static BOOL ReadAFMFile(LPCWSTR filename)
{ {
static const WCHAR rW[] = {'r',0};
FILE *f; FILE *f;
BOOL retval; BOOL retval;
TRACE("%s\n", filename); TRACE("%s\n", debugstr_w(filename));
f = fopen(filename, "r"); f = _wfopen(filename, rW);
if (f == NULL) if (f == NULL)
{ {
WARN("%s: %s\n", filename, strerror(errno)); WARN("%s: %s\n", debugstr_w(filename), strerror(errno));
return TRUE; return TRUE;
} }
...@@ -1127,41 +1120,41 @@ static BOOL ReadAFMFile(LPCSTR filename) ...@@ -1127,41 +1120,41 @@ static BOOL ReadAFMFile(LPCSTR filename)
*/ */
static BOOL ReadAFMDir(LPCSTR dirname) static BOOL ReadAFMDir(LPCSTR dirname)
{ {
struct dirent *dent; static const WCHAR starW[] = {'*',0};
DIR *dir; static const WCHAR afmW[] = {'.','a','f','m',0};
CHAR filename[256]; WCHAR *path = wine_get_dos_file_name( dirname );
struct _wfinddata_t data;
dir = opendir(dirname); intptr_t handle;
if (dir == NULL) WCHAR *p, *filename;
BOOL ret = TRUE;
if (!path) return TRUE;
if (!(filename = HeapAlloc( GetProcessHeap(), 0, lstrlenW(path) + 256 )))
{ {
WARN("%s: %s\n", dirname, strerror(errno)); HeapFree( GetProcessHeap(), 0, path );
return TRUE; return FALSE;
} }
lstrcpyW( filename, path );
while ((dent = readdir(dir)) != NULL) HeapFree( GetProcessHeap(), 0, path );
p = filename + lstrlenW(filename);
*p++ = '\\';
lstrcpyW( p, starW );
handle = _wfindfirst( filename, &data );
if (handle != -1)
{ {
CHAR *file_extension = strchr(dent->d_name, '.'); do
int fn_len; {
WCHAR *ext = wcschr( data.name, '.' );
if (file_extension == NULL || _strnicmp(file_extension, ".afm", -1) != 0) if (!ext || wcsicmp(ext, afmW)) continue;
continue; lstrcpyW( p, data.name );
if (!(ret = ReadAFMFile( filename ))) break;
fn_len = snprintf(filename, 256, "%s/%s", dirname, dent->d_name); } while (!_wfindnext( handle, &data ));
if (fn_len < 0 || fn_len > sizeof(filename) - 1)
{
WARN("Path '%s/%s' is too long\n", dirname, dent->d_name);
continue;
}
if (ReadAFMFile(filename) == FALSE)
{
closedir(dir);
return FALSE;
}
} }
_findclose( handle );
closedir(dir); HeapFree( GetProcessHeap(), 0, filename );
return TRUE; return ret;
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment