Back to index

lightning-sunbird  0.9+nobinonly
Functions
utils.cpp File Reference
#include "xp.h"

Go to the source code of this file.

Functions

BOOL XP_IsFile (char *szFileName)
void XP_DeleteFile (char *szFileName)
XP_HFILE XP_CreateFile (char *szFileName)
XP_HFILE XP_OpenFile (char *szFileName)
void XP_CloseFile (XP_HFILE hFile)
DWORD XP_WriteFile (XP_HFILE hFile, void *pBuf, int iSize)
void XP_FlushFileBuffers (XP_HFILE hFile)
voidXP_GetSymbol (XP_HLIB hLib, char *szProcName)

Function Documentation

Definition at line 88 of file utils.cpp.

{
  if(hFile != NULL)
  {
#ifdef XP_WIN
    CloseHandle((HANDLE)hFile);
#else
    fclose(hFile);
#endif
  }
}

Here is the caller graph for this function:

XP_HFILE XP_CreateFile ( char *  szFileName)

Definition at line 66 of file utils.cpp.

{
#ifdef XP_WIN
  OFSTRUCT of;
  HFILE hFile = OpenFile(szFileName, &of, OF_CREATE | OF_WRITE);
  return (hFile != HFILE_ERROR) ? hFile : NULL;
#else
  return (XP_HFILE)fopen(szFileName, "w+");
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void XP_DeleteFile ( char *  szFileName)

Definition at line 57 of file utils.cpp.

{
#ifdef XP_WIN
  DeleteFile(szFileName);
#else
  remove(szFileName);
#endif
}

Definition at line 111 of file utils.cpp.

{
#ifdef XP_WIN
  FlushFileBuffers((HANDLE)hFile);
#else
  fflush(hFile);
#endif 
}

Here is the caller graph for this function:

void* XP_GetSymbol ( XP_HLIB  hLib,
char *  szProcName 
)

Definition at line 122 of file utils.cpp.

{
#ifdef XP_WIN
  return (void *)GetProcAddress(hLib, szProcName);
#endif
}

Here is the caller graph for this function:

BOOL XP_IsFile ( char *  szFileName)

Definition at line 42 of file utils.cpp.

{
#ifdef XP_WIN
  OFSTRUCT of;
  return (HFILE_ERROR != OpenFile(szFileName, &of, OF_EXIST));
#endif
#ifdef XP_UNIX
  struct stat s;
  return (stat(szFileName, &s) != -1);
#endif
#ifdef XP_MAC /*  HACK */
       return 1;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

XP_HFILE XP_OpenFile ( char *  szFileName)

Definition at line 77 of file utils.cpp.

{
#ifdef XP_WIN
  OFSTRUCT of;
  HFILE hFile = OpenFile(szFileName, &of, OF_READ | OF_WRITE);
  return (hFile != HFILE_ERROR) ? hFile : NULL;
#else
  return (XP_HFILE)fopen(szFileName, "r+");
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD XP_WriteFile ( XP_HFILE  hFile,
void pBuf,
int  iSize 
)

Definition at line 100 of file utils.cpp.

{
#ifdef XP_WIN
  DWORD dwRet;
  WriteFile((HANDLE)hFile, pBuf, iSize, &dwRet, NULL);
  return dwRet;
#else
  return (DWORD)fwrite(pBuf, iSize, 1, hFile);
#endif
}

Here is the caller graph for this function: