Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert sorm.h to c-style #465

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions 3rdParty/Storm/Source/storm.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ STORMAPI
SNetGetGameInfo(
int type,
void *dst,
size_t length,
size_t *byteswritten = NULL);
unsigned int length,
unsigned int *byteswritten);


#define SNGetGameInfo(typ,dst) SNetGetGameInfo(typ, &dst, sizeof(dst))
Expand Down Expand Up @@ -150,7 +150,7 @@ STORMAPI
SNetGetPlayerName(
int playerid,
char *buffer,
size_t buffersize);
unsigned int buffersize);

/* SNetGetProviderCaps @ 114
*
Expand Down Expand Up @@ -375,7 +375,7 @@ STORMAPI
SNetSendMessage(
int playerID,
void *data,
size_t databytes);
unsigned int databytes);


// Macro values to target specific players
Expand All @@ -398,7 +398,7 @@ BOOL
STORMAPI
SNetSendTurn(
char *data,
size_t databytes);
unsigned int databytes);

/* SNetSetGameMode @ 130
*
Expand All @@ -424,7 +424,7 @@ BOOL
STORMAPI
SNetSetGameMode(
DWORD modeFlags,
bool makePublic = false);
BOOLEAN makePublic);

#define SNMakeGamePublic() SNetSetGameMode( (DWORD mode, SNetGetGameInfo(GAMEINFO_MODEFLAGS, &mode, 4), mode), true)

Expand All @@ -446,7 +446,7 @@ int STORMAPI SNetSendReplayPath(int a1, int a2, char *replayPath);
int STORMAPI SNetGetLeagueName(int leagueID);
BOOL STORMAPI SNetGetPlayerNames(char **names);
int STORMAPI SNetLeagueLogout(char *bnetName);
int STORMAPI SNetGetLeaguePlayerName(char *curPlayerLeageName, size_t nameSize);
int STORMAPI SNetGetLeaguePlayerName(char *curPlayerLeageName, unsigned int nameSize);

HGDIOBJ STORMAPI SDlgDefDialogProc(HWND hDlg, signed int DlgType, HDC textLabel, HWND hWnd);

Expand Down Expand Up @@ -531,8 +531,8 @@ BOOL STORMAPI SFileLoadFileEx(void *hArchive, char *filename, int a3, int a4, in
// 6: { DWORD blocks_allocated; DWORD blocks_freed; } Used to determine the amount of memory/heap blocks that have been allocated and freed by storm.
// Can also be used for custom allocations outside of storm.
//
//BOOL STORMAPI StormGetOption(int type, void *pValue, size_t *pSize);
//BOOL STORMAPI StormSetOption(int type, void *pValue, size_t size);
//BOOL STORMAPI StormGetOption(int type, void *pValue, unsigned int *pSize);
//BOOL STORMAPI StormSetOption(int type, void *pValue, unsigned int size);

BOOL STORMAPI SBltROP3(void *lpDstBuffer, void *lpSrcBuffer, int srcDrawWidth, int srcDrawHeight, int dstWidth, int srcWidth, int a7, DWORD rop);
BOOL STORMAPI SBltROP3Clipped(void *lpDstBuffer, RECT *lpDstRect, POINT *lpDstPt, int a4, void *lpSrcBuffer, RECT *lpSrcRect, POINT *lpSrcPt, int a8, int a9, DWORD rop);
Expand Down Expand Up @@ -567,12 +567,12 @@ SBmpDecodeImage(
DWORD dwImgType,
void *pSrcBuffer,
DWORD dwSrcBuffersize,
PALETTEENTRY *pPalette = NULL,
void *pDstBuffer = NULL,
DWORD dwDstBuffersize = 0,
DWORD *pdwWidth = NULL,
DWORD *pdwHeight = NULL,
DWORD *pdwBpp = NULL);
PALETTEENTRY *pPalette,
void *pDstBuffer,
DWORD dwDstBuffersize,
DWORD *pdwWidth,
DWORD *pdwHeight,
DWORD *pdwBpp);


/* SBmpLoadImage @ 323
Expand All @@ -593,12 +593,12 @@ BOOL
STORMAPI
SBmpLoadImage(
const char *pszFileName,
PALETTEENTRY *pPalette = NULL,
void *pBuffer = NULL,
DWORD dwBuffersize = 0,
DWORD *pdwWidth = NULL,
DWORD *pdwHeight = NULL,
DWORD *pdwBpp = NULL);
PALETTEENTRY *pPalette ,
void *pBuffer,
DWORD dwBuffersize,
DWORD *pdwWidth,
DWORD *pdwHeight,
DWORD *pdwBpp);

/* SBmpSaveImage @ 324
*
Expand All @@ -622,7 +622,7 @@ SBmpSaveImage(
void *pBuffer,
DWORD dwWidth,
DWORD dwHeight,
DWORD dwBpp = 8);
DWORD dwBpp);


HANDLE STORMAPI SBmpAllocLoadImage(const char *fileName, PALETTEENTRY *palette, void **buffer, int *width, int *height, int unused6, int unused7, void *(STORMAPI *allocFunction)(DWORD));
Expand Down Expand Up @@ -683,13 +683,13 @@ SDrawGetFrameWindow(
BOOL
STORMAPI
SDrawGetObjects(
LPDIRECTDRAW *ddInterface = NULL,
LPDIRECTDRAWSURFACE *primarySurface = NULL,
LPDIRECTDRAWSURFACE *surface2 = NULL,
LPDIRECTDRAWSURFACE *surface3 = NULL,
LPDIRECTDRAWSURFACE *backSurface = NULL,
LPDIRECTDRAWPALETTE *ddPalette = NULL,
HPALETTE *hPalette = NULL);
LPDIRECTDRAW *ddInterface ,
LPDIRECTDRAWSURFACE *primarySurface,
LPDIRECTDRAWSURFACE *surface2,
LPDIRECTDRAWSURFACE *surface3,
LPDIRECTDRAWSURFACE *backSurface ,
LPDIRECTDRAWPALETTE *ddPalette,
HPALETTE *hPalette);


/* SDrawGetScreenSize @ 348
Expand Down Expand Up @@ -735,14 +735,14 @@ BOOL STORMAPI SDrawLockSurface(int surfacenumber, RECT *lpDestRect, void **lplpS
BOOL
STORMAPI
SDrawManualInitialize(
HWND hWnd = NULL,
LPDIRECTDRAW ddInterface = NULL,
LPDIRECTDRAWSURFACE primarySurface = NULL,
LPDIRECTDRAWSURFACE surface2 = NULL,
LPDIRECTDRAWSURFACE surface3 = NULL,
LPDIRECTDRAWSURFACE backSurface = NULL,
LPDIRECTDRAWPALETTE ddPalette = NULL,
HPALETTE hPalette = NULL);
HWND hWnd,
LPDIRECTDRAW ddInterface,
LPDIRECTDRAWSURFACE primarySurface,
LPDIRECTDRAWSURFACE surface2,
LPDIRECTDRAWSURFACE surface3,
LPDIRECTDRAWSURFACE backSurface,
LPDIRECTDRAWPALETTE ddPalette,
HPALETTE hPalette);


/* SDrawPostClose @ 353
Expand Down Expand Up @@ -793,10 +793,10 @@ BOOL STORMAPI Ordinal393(char *pszString, int, int);
void*
STORMAPI
SMemAlloc(
size_t amount,
unsigned int amount,
char *logfilename,
int logline,
char defaultValue = 0);
char defaultValue);

#define SMAlloc(amount) SMemAlloc((amount), __FILE__, __LINE__)

Expand All @@ -819,7 +819,7 @@ SMemFree(
void *location,
char *logfilename,
int logline,
char defaultValue = 0);
char defaultValue);

#define SMFree(loc) SMemFree((loc), __FILE__, __LINE__)

Expand All @@ -843,10 +843,10 @@ void*
STORMAPI
SMemReAlloc(
void *location,
size_t amount,
unsigned int amount,
char *logfilename,
int logline,
char defaultValue = 0);
char defaultValue);

#define SMReAlloc(loc,s) SMemReAlloc((loc),(s), __FILE__, __LINE__)

Expand All @@ -860,7 +860,7 @@ SMemReAlloc(


BOOL STORMAPI SRegLoadData(const char *keyname, const char *valuename, int size, LPBYTE lpData, BYTE flags, LPDWORD lpcbData);
BOOL STORMAPI SRegLoadString(const char *keyname, const char *valuename, BYTE flags, char *buffer, size_t buffersize);
BOOL STORMAPI SRegLoadString(const char *keyname, const char *valuename, BYTE flags, char *buffer, unsigned int buffersize);
BOOL STORMAPI SRegLoadValue(const char *keyname, const char *valuename, BYTE flags, int *value);
BOOL STORMAPI SRegSaveData(const char *keyname, const char *valuename, int size, BYTE *lpData, DWORD cbData);
BOOL STORMAPI SRegSaveString(const char *keyname, const char *valuename, BYTE flags, char *string);
Expand Down Expand Up @@ -924,9 +924,9 @@ SErrDisplayError(
DWORD dwErrMsg,
const char *logfilename,
int logline,
const char *message = NULL,
BOOL allowOption = FALSE,
int exitCode = 1);
const char *message,
BOOL allowOption,
int exitCode);

#define SAssert(x) { if ( !(x) ) SErrDisplayError(STORM_ERROR_ASSERTION, __FILE__, __LINE__, #x) }

Expand All @@ -948,7 +948,7 @@ STORMAPI
SErrGetErrorStr(
DWORD dwErrCode,
char *buffer,
size_t bufferchars);
unsigned int bufferchars);

#define SEGetErrorStr(e,b) SErrGetErrorStr(e,b,sizeof(b))

Expand Down Expand Up @@ -979,7 +979,7 @@ SErrGetLastError();
void
STORMAPI
SErrSetLastError(
DWORD dwErrCode = NO_ERROR);
DWORD dwErrCode);

//
// void STORMAPI SErrReportNamedResourceLeak(const char *pszMsg, const char *pszSubMsg = nullptr)
Expand Down Expand Up @@ -1039,7 +1039,7 @@ STORMAPI
SMemCopy(
void *dest,
const void *source,
size_t size);
unsigned int size);

#define SMCopy(d,s) ( SMemCopy(d, s, __STORM_SSIZEMIN(s,d)) )

Expand All @@ -1057,8 +1057,8 @@ void
STORMAPI
SMemFill(
void *location,
size_t length,
char fillWith = 0);
unsigned int length,
char fillWith);

#define SMFill(l,f) (SMemFill(l, sizeof(l), f))

Expand All @@ -1073,7 +1073,7 @@ void
STORMAPI
SMemZero(
void *location,
size_t length);
unsigned int length);

#define SMZero(l) (SMemZero(l, sizeof(l)))

Expand All @@ -1098,7 +1098,7 @@ STORMAPI
SStrCopy(
char *dest,
const char *src,
int max_length = 0x7FFFFFFF);
int max_length);

#define SSCopy(d,s) (SStrCopy(d, s, sizeof(d)))

Expand All @@ -1123,8 +1123,8 @@ DWORD
STORMAPI
SStrHash(
const char *string,
DWORD flags = 0,
DWORD Seed = 0);
DWORD flags,
DWORD Seed);

int STORMAPI SStrPack(char *dest, const char *src, DWORD max_length);

Expand Down Expand Up @@ -1157,7 +1157,7 @@ STORMAPI
SStrCmp(
const char *string1,
const char *string2,
size_t size);
unsigned int size);

#define SSCmp(s,x) ( SStrCmp(s,x,__STORM_SSIZEMIN(s,x)) )

Expand All @@ -1176,7 +1176,7 @@ STORMAPI
SStrCmpI(
const char *string1,
const char *string2,
size_t size);
unsigned int size);

#define SSCmpI(s,x) ( SStrCmpI(s,x,__STORM_SSIZEMIN(s,x)) )

Expand Down Expand Up @@ -1269,16 +1269,16 @@ char *STORMAPI SStrChrR(const char *string, char c);
*
* Returns the number of characters written.
*/
size_t
unsigned int
SStrVPrintf(
char *dest,
size_t size,
unsigned int size,
const char *format, ...);


int STORMAPI SBigDel(void *buffer);

int STORMAPI SBigFromBinary(void *buffer, const void *str, size_t size);
int STORMAPI SBigFromBinary(void *buffer, const void *str, unsigned int size);

int STORMAPI SBigNew(void **buffer);

Expand Down