Skip to content

Commit

Permalink
Fix compiler warnings and errors.
Browse files Browse the repository at this point in the history
Run fromdos on all files because there have been
mixed linebreak styles all over the place.

Compiles fine on Debian GNU/Linux now.



git-svn-id: http://svn.openstreetmap.org/applications/rendering/gosmore@18342 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
  • Loading branch information
giggls committed Oct 28, 2009
1 parent c3840a6 commit 941fae3
Show file tree
Hide file tree
Showing 10 changed files with 5,922 additions and 5,915 deletions.
162 changes: 81 additions & 81 deletions ceglue.c
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
#include <windows.h>
#include <windows.h>
#ifdef _WIN32_WCE
#include "ceglue.h"

BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;

BOOL FAR (*SHInitDialogPtr)(PSHINITDLGINFO pshidi) = NULL;

void InitCeGlue (void)
{
HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
if (ayg != NULL) {
SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
GetProcAddressW (ayg, TEXT ("SHFullScreen"));
SHInitDialogPtr = (BOOL (*)(PSHINITDLGINFO))
GetProcAddressW (ayg, TEXT ("SHInitDialog"));
}
}

// code to turn of screen adopted from
// http://msdn.microsoft.com/en-us/library/ms838354.aspx

// GDI Escapes for ExtEscape()
#define QUERYESCSUPPORT 8

// The following are unique to CE
#define GETVFRAMEPHYSICAL 6144
#define GETVFRAMELEN 6145
#define DBGDRIVERSTAT 6146
#define SETPOWERMANAGEMENT 6147
#define GETPOWERMANAGEMENT 6148


typedef enum _VIDEO_POWER_STATE {
VideoPowerOn = 1,
VideoPowerStandBy,
VideoPowerSuspend,
VideoPowerOff
} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;


typedef struct _VIDEO_POWER_MANAGEMENT {
ULONG Length;
ULONG DPMSVersion;
ULONG PowerState;
} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;


int CeEnableBacklight(int enable)
{
HDC gdc;
int iESC=SETPOWERMANAGEMENT;

gdc = GetDC(NULL);
if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC,
0, NULL)==0)
{
MessageBox(NULL,
L"Sorry, your Pocket PC does not support DisplayOff",
L"Pocket PC Display Off Feature",
MB_OK);
ReleaseDC(NULL, gdc);
return FALSE;
}
else
{
VIDEO_POWER_MANAGEMENT vpm;
vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
vpm.DPMSVersion = 0x0001;
if (enable) {
vpm.PowerState = VideoPowerOn;
} else {
vpm.PowerState = VideoPowerOff;
}
// Power off the display
ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm,
0, NULL);
ReleaseDC(NULL, gdc);
return TRUE;
}
}
#include "ceglue.h"

BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;

BOOL FAR (*SHInitDialogPtr)(PSHINITDLGINFO pshidi) = NULL;

void InitCeGlue (void)
{
HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
if (ayg != NULL) {
SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
GetProcAddressW (ayg, TEXT ("SHFullScreen"));
SHInitDialogPtr = (BOOL (*)(PSHINITDLGINFO))
GetProcAddressW (ayg, TEXT ("SHInitDialog"));
}
}

// code to turn of screen adopted from
// http://msdn.microsoft.com/en-us/library/ms838354.aspx

// GDI Escapes for ExtEscape()
#define QUERYESCSUPPORT 8

// The following are unique to CE
#define GETVFRAMEPHYSICAL 6144
#define GETVFRAMELEN 6145
#define DBGDRIVERSTAT 6146
#define SETPOWERMANAGEMENT 6147
#define GETPOWERMANAGEMENT 6148


typedef enum _VIDEO_POWER_STATE {
VideoPowerOn = 1,
VideoPowerStandBy,
VideoPowerSuspend,
VideoPowerOff
} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;


typedef struct _VIDEO_POWER_MANAGEMENT {
ULONG Length;
ULONG DPMSVersion;
ULONG PowerState;
} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;


int CeEnableBacklight(int enable)
{
HDC gdc;
int iESC=SETPOWERMANAGEMENT;

gdc = GetDC(NULL);
if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC,
0, NULL)==0)
{
MessageBox(NULL,
L"Sorry, your Pocket PC does not support DisplayOff",
L"Pocket PC Display Off Feature",
MB_OK);
ReleaseDC(NULL, gdc);
return FALSE;
}
else
{
VIDEO_POWER_MANAGEMENT vpm;
vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
vpm.DPMSVersion = 0x0001;
if (enable) {
vpm.PowerState = VideoPowerOn;
} else {
vpm.PowerState = VideoPowerOff;
}
// Power off the display
ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm,
0, NULL);
ReleaseDC(NULL, gdc);
return TRUE;
}
}
#endif // Not WIN NT

40 changes: 20 additions & 20 deletions ceglue.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#ifndef CEGLUE_H
#define CEGLUE_H
#ifdef __cplusplus
extern "C" {
#endif

#include <aygshell.h>

extern BOOL (*SHFullScreenPtr)(HWND hwnd, DWORD state);
extern BOOL (*SHInitDialogPtr)(PSHINITDLGINFO pshidi);

void InitCeGlue (void);

int CeEnableBacklight(int enable);

#ifdef __cplusplus
}
#endif

#endif
#ifndef CEGLUE_H
#define CEGLUE_H
#ifdef __cplusplus
extern "C" {
#endif

#include <aygshell.h>

extern BOOL (*SHFullScreenPtr)(HWND hwnd, DWORD state);
extern BOOL (*SHInitDialogPtr)(PSHINITDLGINFO pshidi);

void InitCeGlue (void);

int CeEnableBacklight(int enable);

#ifdef __cplusplus
}
#endif

#endif
40 changes: 20 additions & 20 deletions extract.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* This software is placed by in the public domain by its authors. */
/* Written by Nic Roets. */

#include <stdio.h>
#include <unistd.h>
#include <libxml/xmlreader.h>

int main (void)
{
xmlTextReaderPtr xml = xmlReaderForFd (STDIN_FILENO, "", NULL, 0);
while (xmlTextReaderRead (xml)) {
char *name = (char *) BAD_CAST xmlTextReaderName (xml);
if (xmlTextReaderNodeType (xml) == XML_READER_TYPE_ELEMENT &&
strcasecmp (name, "text") == 0) {
while (xmlTextReaderRead (xml) && // memory leak :
xmlStrcmp (xmlTextReaderName (xml), BAD_CAST "#text") != 0) {}
printf ("%s\n", xmlTextReaderValue (xml));
}
}
}
/* This software is placed by in the public domain by its authors. */
/* Written by Nic Roets. */

#include <stdio.h>
#include <unistd.h>
#include <libxml/xmlreader.h>

int main (void)
{
xmlTextReaderPtr xml = xmlReaderForFd (STDIN_FILENO, "", NULL, 0);
while (xmlTextReaderRead (xml)) {
char *name = (char *) BAD_CAST xmlTextReaderName (xml);
if (xmlTextReaderNodeType (xml) == XML_READER_TYPE_ELEMENT &&
strcasecmp (name, "text") == 0) {
while (xmlTextReaderRead (xml) && // memory leak :
xmlStrcmp (xmlTextReaderName (xml), BAD_CAST "#text") != 0) {}
printf ("%s\n", xmlTextReaderValue (xml));
}
}
}
Loading

0 comments on commit 941fae3

Please sign in to comment.