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

wineps.drv: Build with msvcrt.

parent d5400af7
MODULE = wineps.drv
IMPORTS = user32 gdi32 winspool advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
afm.c \
bitblt.c \
......
......@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <string.h>
#include "psdrv.h"
......
......@@ -282,7 +282,7 @@ BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics)
* 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.
*/
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);
}
......
......@@ -25,8 +25,6 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "config.h"
#include <string.h>
#include "wine/debug.h"
......@@ -283,7 +281,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
WCHAR buf[256];
res = di->pi->ppd->DefaultResolution;
len = sprintfW(buf, resW, res);
len = swprintf(buf, ARRAY_SIZE(buf), resW, res);
buf[len++] = ' ';
LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
......@@ -313,9 +311,9 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
DWORD idx;
if (res->resx == res->resy)
len = sprintfW(buf, resW, res->resx);
len = swprintf(buf, ARRAY_SIZE(buf), resW, res->resx);
else
len = sprintfW(buf, resxyW, res->resx, res->resy);
len = swprintf(buf, ARRAY_SIZE(buf), resxyW, res->resx, res->resy);
buf[len++] = ' ';
LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
idx = SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
......
......@@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -28,9 +25,6 @@
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "windef.h"
#include "winbase.h"
......
......@@ -18,18 +18,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#if defined(HAVE_FLOAT_H)
# include <float.h>
#endif
#if !defined(PI)
# define PI M_PI
#endif
#include <float.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
......@@ -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));
end_angle = atan2((double)(y - end.y) * ratio, (double)(end.x - x));
start_angle *= 180.0 / PI;
end_angle *= 180.0 / PI;
start_angle *= 180.0 / M_PI;
end_angle *= 180.0 / M_PI;
PSDRV_WriteSpool(dev,"%DrawArc\n", 9);
PSDRV_SetPen(dev);
......
......@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
......@@ -36,7 +33,6 @@
#include "winuser.h"
#include "psdrv.h"
#include "winspool.h"
#include "wine/library.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
......@@ -650,7 +646,7 @@ static WCHAR *get_ppd_filename( HANDLE printer )
if (!info) return NULL;
GetPrinterDriverW( printer, NULL, 2, (BYTE*)info, needed, &needed );
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;
}
......@@ -674,15 +670,15 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
LIST_FOR_EACH_ENTRY( pi, &printer_list, PRINTERINFO, entry )
{
if (!strcmpW( pi->friendly_name, name ))
if (!wcscmp( pi->friendly_name, name ))
return pi;
}
pi = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) );
if (pi == NULL) return NULL;
if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (strlenW(name)+1)*sizeof(WCHAR) ))) goto fail;
strcpyW( pi->friendly_name, name );
if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (lstrlenW(name)+1)*sizeof(WCHAR) ))) goto fail;
lstrcpyW( pi->friendly_name, name );
if (OpenPrinterW( pi->friendly_name, &hPrinter, NULL ) == 0) {
ERR ("OpenPrinter failed with code %i\n", GetLastError ());
......
......@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
......
......@@ -29,6 +29,7 @@
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wingdi.h"
#include "psdrv.h"
#include "wine/debug.h"
......
......@@ -28,7 +28,6 @@
#include "wingdi.h"
#include "winspool.h"
#include "wine/unicode.h"
#include "wine/gdi_driver.h"
#include "wine/list.h"
......@@ -595,7 +594,7 @@ static inline WCHAR *strdupW( const WCHAR *str )
WCHAR *ret;
if (!str) return NULL;
size = (strlenW( str ) + 1) * sizeof(WCHAR);
size = (lstrlenW( str ) + 1) * sizeof(WCHAR);
ret = HeapAlloc( GetProcessHeap(), 0, size );
if (ret) memcpy( ret, str, size );
return ret;
......
......@@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
......
......@@ -25,23 +25,15 @@
*
*/
#include "config.h"
#include "wine/port.h"
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#endif
#include <errno.h>
#include <io.h>
#include <ctype.h>
#include <limits.h> /* INT_MIN */
#ifdef HAVE_FLOAT_H
#include <float.h> /* FLT_MAX */
#endif
#include "windef.h"
#include "winbase.h"
......@@ -818,7 +810,7 @@ static const LONG ansiChars[21] =
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));
}
......@@ -849,7 +841,7 @@ static inline BOOL IsWinANSI(LONG uv)
* 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 -
((const UNICODEGLYPH *)b)->name->index;
......@@ -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.
*
*/
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;
}
......@@ -1099,17 +1091,18 @@ static BOOL BuildAFM(FILE *file)
* 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;
BOOL retval;
TRACE("%s\n", filename);
TRACE("%s\n", debugstr_w(filename));
f = fopen(filename, "r");
f = _wfopen(filename, rW);
if (f == NULL)
{
WARN("%s: %s\n", filename, strerror(errno));
WARN("%s: %s\n", debugstr_w(filename), strerror(errno));
return TRUE;
}
......@@ -1127,41 +1120,41 @@ static BOOL ReadAFMFile(LPCSTR filename)
*/
static BOOL ReadAFMDir(LPCSTR dirname)
{
struct dirent *dent;
DIR *dir;
CHAR filename[256];
dir = opendir(dirname);
if (dir == NULL)
static const WCHAR starW[] = {'*',0};
static const WCHAR afmW[] = {'.','a','f','m',0};
WCHAR *path = wine_get_dos_file_name( dirname );
struct _wfinddata_t data;
intptr_t handle;
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));
return TRUE;
HeapFree( GetProcessHeap(), 0, path );
return FALSE;
}
while ((dent = readdir(dir)) != NULL)
lstrcpyW( filename, path );
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, '.');
int fn_len;
if (file_extension == NULL || _strnicmp(file_extension, ".afm", -1) != 0)
continue;
fn_len = snprintf(filename, 256, "%s/%s", dirname, dent->d_name);
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)
do
{
closedir(dir);
return FALSE;
}
WCHAR *ext = wcschr( data.name, '.' );
if (!ext || wcsicmp(ext, afmW)) continue;
lstrcpyW( p, data.name );
if (!(ret = ReadAFMFile( filename ))) break;
} while (!_wfindnext( handle, &data ));
}
_findclose( handle );
closedir(dir);
return TRUE;
HeapFree( GetProcessHeap(), 0, filename );
return ret;
}
/*******************************************************************************
......
......@@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <string.h>
#include <stdlib.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