Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

File style cleanup for the SDL 2.0 release

  • Loading branch information
slouken committed May 18, 2013
1 parent d8d8542 commit e81108dd27225918dd10e88417d65a2755f445e8

File 200 of 376 in e81108d

@@ -21,11 +21,11 @@

/*
Used by the test framework and test cases.
Used by the test framework and test cases.
*/

// quiet windows compiler warnings
/* quiet windows compiler warnings */
#define _CRT_SECURE_NO_WARNINGS

#include "SDL_config.h"
@@ -50,52 +50,52 @@
*
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
*/
char *SDLTest_TimestampToString(const time_t timestamp)
char *SDLTest_TimestampToString(const time_t timestamp)
{
time_t copy;
static char buffer[64];
struct tm *local;
time_t copy;
static char buffer[64];
struct tm *local;

SDL_memset(buffer, 0, sizeof(buffer));\
copy = timestamp;
local = localtime(&copy);
strftime(buffer, sizeof(buffer), "%x %X", local);
SDL_memset(buffer, 0, sizeof(buffer));\
copy = timestamp;
local = localtime(&copy);
strftime(buffer, sizeof(buffer), "%x %X", local);

return buffer;
return buffer;
}

/*
* Prints given message with a timestamp in the TEST category and INFO priority.
*/
void SDLTest_Log(const char *fmt, ...)
{
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];

// Print log message into a buffer
SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
va_start(list, fmt);
SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
va_end(list);
/* Print log message into a buffer */
SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
va_start(list, fmt);
SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
va_end(list);

// Log with timestamp and newline
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
/* Log with timestamp and newline */
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
}

/*
* Prints given message with a timestamp in the TEST category and the ERROR priority.
*/
void SDLTest_LogError(const char *fmt, ...)
{
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
va_list list;
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];

// Print log message into a buffer
SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
va_start(list, fmt);
SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
va_end(list);
/* Print log message into a buffer */
SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
va_start(list, fmt);
SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
va_end(list);

// Log with timestamp and newline
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
/* Log with timestamp and newline */
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
}

0 comments on commit e81108d

Please sign in to comment.