[standard] replace __FUNCTION__ with __func__

This commit is contained in:
Armin Novak 2023-07-27 09:02:03 +02:00 committed by akallabeth
parent 9ea1ab285b
commit e61880d077
83 changed files with 482 additions and 505 deletions

View File

@ -37,7 +37,7 @@
#include "smartcard_main.h" #include "smartcard_main.h"
#define CAST_FROM_DEVICE(device) cast_device_from(device, __FUNCTION__, __FILE__, __LINE__) #define CAST_FROM_DEVICE(device) cast_device_from(device, __func__, __FILE__, __LINE__)
typedef struct typedef struct
{ {

View File

@ -149,7 +149,7 @@ static BOOL log_libusb_result_(wLog* log, DWORD lvl, const char* fmt, const char
} }
#define log_libusb_result(log, lvl, fmt, error, ...) \ #define log_libusb_result(log, lvl, fmt, error, ...) \
log_libusb_result_((log), (lvl), (fmt), __FUNCTION__, __FILE__, __LINE__, error, ##__VA_ARGS__) log_libusb_result_((log), (lvl), (fmt), __func__, __FILE__, __LINE__, error, ##__VA_ARGS__)
const char* usb_interface_class_to_string(uint8_t class) const char* usb_interface_class_to_string(uint8_t class)
{ {

View File

@ -63,7 +63,7 @@ class SdlWidget
const SDL_Rect& rect() const; const SDL_Rect& rect() const;
public: public:
#define widget_log_error(res, what) SdlWidget::error_ex(res, what, __FILE__, __LINE__, __FUNCTION__) #define widget_log_error(res, what) SdlWidget::error_ex(res, what, __FILE__, __LINE__, __func__)
static bool error_ex(Uint32 res, const char* what, const char* file, size_t line, static bool error_ex(Uint32 res, const char* what, const char* file, size_t line,
const char* fkt); const char* fkt);

View File

@ -92,7 +92,6 @@ BOOL sdl_push_user_event(Uint32 type, ...);
const char* sdl_event_type_str(Uint32 type); const char* sdl_event_type_str(Uint32 type);
const char* sdl_error_string(Uint32 res); const char* sdl_error_string(Uint32 res);
#define sdl_log_error(res, log, what) \ #define sdl_log_error(res, log, what) sdl_log_error_ex(res, log, what, __FILE__, __LINE__, __func__)
sdl_log_error_ex(res, log, what, __FILE__, __LINE__, __FUNCTION__)
BOOL sdl_log_error_ex(Uint32 res, wLog* log, const char* what, const char* file, size_t line, BOOL sdl_log_error_ex(Uint32 res, wLog* log, const char* what, const char* file, size_t line,
const char* fkt); const char* fkt);

View File

@ -28,7 +28,7 @@ char* Safe_XGetAtomName(Display* display, Atom atom);
#define LogTagAndXGetWindowProperty(tag, display, w, property, long_offset, long_length, delete, \ #define LogTagAndXGetWindowProperty(tag, display, w, property, long_offset, long_length, delete, \
req_type, actual_type_return, actual_format_return, \ req_type, actual_type_return, actual_format_return, \
nitems_return, bytes_after_return, prop_return) \ nitems_return, bytes_after_return, prop_return) \
LogTagAndXGetWindowProperty_ex((tag), __FILE__, __FUNCTION__, __LINE__, (display), (w), \ LogTagAndXGetWindowProperty_ex((tag), __FILE__, __func__, __LINE__, (display), (w), \
(property), (long_offset), (long_length), (delete), (req_type), \ (property), (long_offset), (long_length), (delete), (req_type), \
(actual_type_return), (actual_format_return), (nitems_return), \ (actual_type_return), (actual_format_return), (nitems_return), \
(bytes_after_return), (prop_return)) (bytes_after_return), (prop_return))
@ -42,7 +42,7 @@ int LogTagAndXGetWindowProperty_ex(const char* tag, const char* file, const char
#define LogDynAndXGetWindowProperty(log, display, w, property, long_offset, long_length, delete, \ #define LogDynAndXGetWindowProperty(log, display, w, property, long_offset, long_length, delete, \
req_type, actual_type_return, actual_format_return, \ req_type, actual_type_return, actual_format_return, \
nitems_return, bytes_after_return, prop_return) \ nitems_return, bytes_after_return, prop_return) \
LogDynAndXGetWindowProperty_ex((log), __FILE__, __FUNCTION__, __LINE__, (display), (w), \ LogDynAndXGetWindowProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), \
(property), (long_offset), (long_length), (delete), (req_type), \ (property), (long_offset), (long_length), (delete), (req_type), \
(actual_type_return), (actual_format_return), (nitems_return), \ (actual_type_return), (actual_format_return), (nitems_return), \
(bytes_after_return), (prop_return)) (bytes_after_return), (prop_return))
@ -54,25 +54,25 @@ int LogDynAndXGetWindowProperty_ex(wLog* log, const char* file, const char* fkt,
unsigned char** prop_return); unsigned char** prop_return);
#define LogTagAndXChangeProperty(tag, display, w, property, type, format, mode, data, nelements) \ #define LogTagAndXChangeProperty(tag, display, w, property, type, format, mode, data, nelements) \
LogTagAndXChangeProperty_ex((tag), __FILE__, __FUNCTION__, __LINE__, (display), (w), \ LogTagAndXChangeProperty_ex((tag), __FILE__, __func__, __LINE__, (display), (w), (property), \
(property), (type), (format), (mode), (data), (nelements)) (type), (format), (mode), (data), (nelements))
int LogTagAndXChangeProperty_ex(const char* tag, const char* file, const char* fkt, size_t line, int LogTagAndXChangeProperty_ex(const char* tag, const char* file, const char* fkt, size_t line,
Display* display, Window w, Atom property, Atom type, int format, Display* display, Window w, Atom property, Atom type, int format,
int mode, _Xconst unsigned char* data, int nelements); int mode, _Xconst unsigned char* data, int nelements);
#define LogDynAndXChangeProperty(log, display, w, property, type, format, mode, data, nelements) \ #define LogDynAndXChangeProperty(log, display, w, property, type, format, mode, data, nelements) \
LogDynAndXChangeProperty_ex((log), __FILE__, __FUNCTION__, __LINE__, (display), (w), \ LogDynAndXChangeProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property), \
(property), (type), (format), (mode), (data), (nelements)) (type), (format), (mode), (data), (nelements))
int LogDynAndXChangeProperty_ex(wLog* log, const char* file, const char* fkt, size_t line, int LogDynAndXChangeProperty_ex(wLog* log, const char* file, const char* fkt, size_t line,
Display* display, Window w, Atom property, Atom type, int format, Display* display, Window w, Atom property, Atom type, int format,
int mode, _Xconst unsigned char* data, int nelements); int mode, _Xconst unsigned char* data, int nelements);
#define LogTagAndXDeleteProperty(tag, display, w, property) \ #define LogTagAndXDeleteProperty(tag, display, w, property) \
LogTagAndXDeleteProperty_ex((tag), __FILE__, __FUNCTION__, __LINE__, (display), (w), (property)) LogTagAndXDeleteProperty_ex((tag), __FILE__, __func__, __LINE__, (display), (w), (property))
int LogTagAndXDeleteProperty_ex(const char* tag, const char* file, const char* fkt, size_t line, int LogTagAndXDeleteProperty_ex(const char* tag, const char* file, const char* fkt, size_t line,
Display* display, Window w, Atom property); Display* display, Window w, Atom property);
#define LogDynAndXDeleteProperty(log, display, w, property) \ #define LogDynAndXDeleteProperty(log, display, w, property) \
LogDynAndXDeleteProperty_ex((log), __FILE__, __FUNCTION__, __LINE__, (display), (w), (property)) LogDynAndXDeleteProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property))
int LogDynAndXDeleteProperty_ex(wLog* log, const char* file, const char* fkt, size_t line, int LogDynAndXDeleteProperty_ex(wLog* log, const char* file, const char* fkt, size_t line,
Display* display, Window w, Atom property); Display* display, Window w, Atom property);

View File

@ -370,8 +370,8 @@ enum XF_EXIT_CODE
XF_EXIT_UNKNOWN = 255, XF_EXIT_UNKNOWN = 255,
}; };
#define xf_lock_x11(xfc) xf_lock_x11_(xfc, __FUNCTION__) #define xf_lock_x11(xfc) xf_lock_x11_(xfc, __func__)
#define xf_unlock_x11(xfc) xf_unlock_x11_(xfc, __FUNCTION__) #define xf_unlock_x11(xfc) xf_unlock_x11_(xfc, __func__)
void xf_lock_x11_(xfContext* xfc, const char* fkt); void xf_lock_x11_(xfContext* xfc, const char* fkt);
void xf_unlock_x11_(xfContext* xfc, const char* fkt); void xf_unlock_x11_(xfContext* xfc, const char* fkt);
@ -379,7 +379,7 @@ void xf_unlock_x11_(xfContext* xfc, const char* fkt);
BOOL xf_picture_transform_required(xfContext* xfc); BOOL xf_picture_transform_required(xfContext* xfc);
#define xf_draw_screen(_xfc, _x, _y, _w, _h) \ #define xf_draw_screen(_xfc, _x, _y, _w, _h) \
xf_draw_screen_((_xfc), (_x), (_y), (_w), (_h), __FUNCTION__, __FILE__, __LINE__) xf_draw_screen_((_xfc), (_x), (_y), (_w), (_h), __func__, __FILE__, __LINE__)
void xf_draw_screen_(xfContext* xfc, int x, int y, int w, int h, const char* fkt, const char* file, void xf_draw_screen_(xfContext* xfc, int x, int y, int w, int h, const char* fkt, const char* file,
int line); int line);

View File

@ -1276,7 +1276,7 @@ static UINT cliprdr_file_context_send_file_contents_failure(
const UINT64 offset = (((UINT64)fileContentsRequest->nPositionHigh) << 32) | const UINT64 offset = (((UINT64)fileContentsRequest->nPositionHigh) << 32) |
((UINT64)fileContentsRequest->nPositionLow); ((UINT64)fileContentsRequest->nPositionLow);
writelog(file->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, writelog(file->log, WLOG_WARN, __FILE__, __func__, __LINE__,
"server file contents request [lockID %" PRIu32 ", streamID %" PRIu32 "server file contents request [lockID %" PRIu32 ", streamID %" PRIu32
", index %" PRIu32 "] offset %" PRIu64 ", size %" PRIu32 " failed", ", index %" PRIu32 "] offset %" PRIu64 ", size %" PRIu32 " failed",
fileContentsRequest->clipDataId, fileContentsRequest->streamId, fileContentsRequest->clipDataId, fileContentsRequest->streamId,
@ -1315,14 +1315,14 @@ static BOOL dump_streams(const void* key, void* value, void* arg)
const UINT32* ukey = key; const UINT32* ukey = key;
CliprdrLocalStream* cur = value; CliprdrLocalStream* cur = value;
writelog(cur->context->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, writelog(cur->context->log, WLOG_WARN, __FILE__, __func__, __LINE__,
"[key %" PRIu32 "] lockID %" PRIu32 ", count %" PRIuz ", locked %d", *ukey, "[key %" PRIu32 "] lockID %" PRIu32 ", count %" PRIuz ", locked %d", *ukey,
cur->lockId, cur->count, cur->locked); cur->lockId, cur->count, cur->locked);
for (size_t x = 0; x < cur->count; x++) for (size_t x = 0; x < cur->count; x++)
{ {
const CliprdrLocalFile* file = &cur->files[x]; const CliprdrLocalFile* file = &cur->files[x];
writelog(cur->context->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, writelog(cur->context->log, WLOG_WARN, __FILE__, __func__, __LINE__, "file [%" PRIuz "] ",
"file [%" PRIuz "] ", x, file->name, file->size); x, file->name, file->size);
} }
return TRUE; return TRUE;
} }
@ -1342,7 +1342,7 @@ static CliprdrLocalFile* file_info_for_request(CliprdrFileContext* file, UINT32
} }
else else
{ {
writelog(file->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, writelog(file->log, WLOG_WARN, __FILE__, __func__, __LINE__,
"invalid entry index for lockID %" PRIu32 ", index %" PRIu32 " [count %" PRIu32 "invalid entry index for lockID %" PRIu32 ", index %" PRIu32 " [count %" PRIu32
"] [locked %d]", "] [locked %d]",
lockId, listIndex, cur->count, cur->locked); lockId, listIndex, cur->count, cur->locked);
@ -1350,7 +1350,7 @@ static CliprdrLocalFile* file_info_for_request(CliprdrFileContext* file, UINT32
} }
else else
{ {
writelog(file->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, writelog(file->log, WLOG_WARN, __FILE__, __func__, __LINE__,
"missing entry for lockID %" PRIu32 ", index %" PRIu32, lockId, listIndex); "missing entry for lockID %" PRIu32 ", index %" PRIu32, lockId, listIndex);
HashTable_Foreach(file->local_streams, dump_streams, file); HashTable_Foreach(file->local_streams, dump_streams, file);
} }
@ -1370,7 +1370,7 @@ static CliprdrLocalFile* file_for_request(CliprdrFileContext* file, UINT32 lockI
} }
if (!f->fp) if (!f->fp)
{ {
writelog(file->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, writelog(file->log, WLOG_WARN, __FILE__, __func__, __LINE__,
"[lockID %" PRIu32 ", index %" PRIu32 "[lockID %" PRIu32 ", index %" PRIu32
"] failed to open file '%s' [size %" PRId64 "] %s [%d]", "] failed to open file '%s' [size %" PRId64 "] %s [%d]",
lockId, listIndex, f->name, f->size, strerror(errno), errno); lockId, listIndex, f->name, f->size, strerror(errno), errno);

View File

@ -8,7 +8,7 @@
typedef BOOL (*validate_settings_pr)(rdpSettings* settings); typedef BOOL (*validate_settings_pr)(rdpSettings* settings);
#define printref() printf("%s:%d: in function %-40s:", __FILE__, __LINE__, __FUNCTION__) #define printref() printf("%s:%d: in function %-40s:", __FILE__, __LINE__, __func__)
#define TEST_ERROR(format, ...) \ #define TEST_ERROR(format, ...) \
do \ do \
@ -244,8 +244,7 @@ int TestClientCmdLine(int argc, char* argv[])
int failure = 0; int failure = 0;
char** command_line = string_list_copy(current->command_line); char** command_line = string_list_copy(current->command_line);
if (!testcase(__FUNCTION__, command_line, if (!testcase(__func__, command_line, string_list_length((const char* const*)command_line),
string_list_length((const char* const*)command_line),
current->expected_status, current->validate_settings)) current->expected_status, current->validate_settings))
{ {
TEST_FAILURE("parsing arguments.\n"); TEST_FAILURE("parsing arguments.\n");

View File

@ -30,7 +30,7 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define __func__ __FUNCTION__ #define __func__ __func__
#endif #endif
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__

View File

@ -611,7 +611,7 @@ owned by rdpRdp */
FREERDP_API const char* freerdp_get_last_error_category(UINT32 error); FREERDP_API const char* freerdp_get_last_error_category(UINT32 error);
#define freerdp_set_last_error(context, lastError) \ #define freerdp_set_last_error(context, lastError) \
freerdp_set_last_error_ex((context), (lastError), __FUNCTION__, __FILE__, __LINE__) freerdp_set_last_error_ex((context), (lastError), __func__, __FILE__, __LINE__)
#define freerdp_set_last_error_if_not(context, lastError) \ #define freerdp_set_last_error_if_not(context, lastError) \
do \ do \
@ -621,7 +621,7 @@ owned by rdpRdp */
} while (0) } while (0)
#define freerdp_set_last_error_log(context, lastError) \ #define freerdp_set_last_error_log(context, lastError) \
freerdp_set_last_error_ex((context), (lastError), __FUNCTION__, __FILE__, __LINE__) freerdp_set_last_error_ex((context), (lastError), __func__, __FILE__, __LINE__)
FREERDP_API void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError, FREERDP_API void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError,
const char* fkt, const char* file, int line); const char* fkt, const char* file, int line);

View File

@ -153,7 +153,7 @@ static const char* rle_code_str_buffer(UINT32 code, char* buffer, size_t size)
} }
#define buffer_within_range(pbSrc, pbEnd) \ #define buffer_within_range(pbSrc, pbEnd) \
buffer_within_range_((pbSrc), (pbEnd), __FUNCTION__, __FILE__, __LINE__) buffer_within_range_((pbSrc), (pbEnd), __func__, __FILE__, __LINE__)
static INLINE BOOL buffer_within_range_(const void* pbSrc, const void* pbEnd, const char* fkt, static INLINE BOOL buffer_within_range_(const void* pbSrc, const void* pbEnd, const char* fkt,
const char* file, size_t line) const char* file, size_t line)
{ {
@ -353,7 +353,7 @@ static INLINE UINT32 ExtractRunLength(UINT32 code, const BYTE* pbOrderHdr, const
} }
#define ensure_capacity(start, end, size, base) \ #define ensure_capacity(start, end, size, base) \
ensure_capacity_((start), (end), (size), (base), __FUNCTION__, __FILE__, __LINE__) ensure_capacity_((start), (end), (size), (base), __func__, __FILE__, __LINE__)
static INLINE BOOL ensure_capacity_(const BYTE* start, const BYTE* end, size_t size, size_t base, static INLINE BOOL ensure_capacity_(const BYTE* start, const BYTE* end, size_t size, size_t base,
const char* fkt, const char* file, size_t line) const char* fkt, const char* file, size_t line)
{ {

View File

@ -771,9 +771,9 @@ static int test_MppcCompressBellsRdp5(void)
{ {
printf("MppcCompressBellsRdp5: output mismatch\n"); printf("MppcCompressBellsRdp5: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_MPPC_BELLS_RDP5, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_MPPC_BELLS_RDP5, DstSize * 8, 0);
goto fail; goto fail;
} }
@ -818,9 +818,9 @@ static int test_MppcCompressBellsRdp4(void)
{ {
printf("MppcCompressBellsRdp4: output mismatch\n"); printf("MppcCompressBellsRdp4: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_MPPC_BELLS_RDP4, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_MPPC_BELLS_RDP4, DstSize * 8, 0);
goto fail; goto fail;
} }
@ -959,9 +959,9 @@ static int test_MppcCompressIslandRdp5(void)
{ {
printf("MppcCompressIslandRdp5: output mismatch\n"); printf("MppcCompressIslandRdp5: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_ISLAND_DATA_RDP5, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_ISLAND_DATA_RDP5, DstSize * 8, 0);
goto fail; goto fail;
} }

View File

@ -39,9 +39,9 @@ static BOOL test_NCrushCompressBells(void)
"\n", "\n",
DstSize, expectedSize); DstSize, expectedSize);
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_BELLS_NCRUSH, expectedSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_BELLS_NCRUSH, expectedSize * 8, 0);
goto fail; goto fail;
} }
@ -49,9 +49,9 @@ static BOOL test_NCrushCompressBells(void)
{ {
printf("NCrushCompressBells: output mismatch\n"); printf("NCrushCompressBells: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_BELLS_NCRUSH, expectedSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_BELLS_NCRUSH, expectedSize * 8, 0);
goto fail; goto fail;
} }

View File

@ -5503,7 +5503,7 @@ static BOOL RunTestPlanar(BITMAP_PLANAR_CONTEXT* planar, const BYTE* srcBitmap,
BYTE* compressedBitmap = freerdp_bitmap_compress_planar(planar, srcBitmap, srcFormat, width, BYTE* compressedBitmap = freerdp_bitmap_compress_planar(planar, srcBitmap, srcFormat, width,
height, 0, NULL, &dstSize); height, 0, NULL, &dstSize);
BYTE* decompressedBitmap = (BYTE*)calloc(height, width * FreeRDPGetBytesPerPixel(dstFormat)); BYTE* decompressedBitmap = (BYTE*)calloc(height, width * FreeRDPGetBytesPerPixel(dstFormat));
printf("%s [%s] --> [%s]: ", __FUNCTION__, FreeRDPGetColorFormatName(srcFormat), printf("%s [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat)); FreeRDPGetColorFormatName(dstFormat));
fflush(stdout); fflush(stdout);
printf("TODO: Skipping unfinished test!"); printf("TODO: Skipping unfinished test!");
@ -5543,7 +5543,7 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, const UINT32
{ {
UINT32 i, j, x, y; UINT32 i, j, x, y;
BOOL rc = FALSE; BOOL rc = FALSE;
printf("%s: [%s] --> [%s]: ", __FUNCTION__, FreeRDPGetColorFormatName(srcFormat), printf("%s: [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat),
FreeRDPGetColorFormatName(dstFormat)); FreeRDPGetColorFormatName(dstFormat));
fflush(stdout); fflush(stdout);

View File

@ -62,9 +62,9 @@ static int test_ZGfxCompressFox(void)
{ {
printf("test_ZGfxCompressFox: output mismatch\n"); printf("test_ZGfxCompressFox: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_FOX_DATA_SINGLE, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_FOX_DATA_SINGLE, DstSize * 8, 0);
goto fail; goto fail;
} }
@ -114,9 +114,9 @@ static int test_ZGfxDecompressFoxSingle(void)
{ {
printf("test_ZGfxDecompressFoxSingle: output mismatch\n"); printf("test_ZGfxDecompressFoxSingle: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_FOX_DATA, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_FOX_DATA, DstSize * 8, 0);
goto fail; goto fail;
} }
@ -166,9 +166,9 @@ static int test_ZGfxDecompressFoxMultipart(void)
{ {
printf("test_ZGfxDecompressFoxSingle: output mismatch\n"); printf("test_ZGfxDecompressFoxSingle: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, TEST_FOX_DATA, DstSize * 8, 0); BitDump(__func__, WLOG_INFO, TEST_FOX_DATA, DstSize * 8, 0);
goto fail; goto fail;
} }
@ -231,17 +231,17 @@ static int test_ZGfxCompressConsistent(void)
{ {
printf("test_ZGfxDecompressFoxSingle: output mismatch\n"); printf("test_ZGfxDecompressFoxSingle: output mismatch\n");
printf("Actual\n"); printf("Actual\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData, 64 * 8, 0); BitDump(__func__, WLOG_INFO, pDstData, 64 * 8, 0);
printf("...\n"); printf("...\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData + DstSize - 64, 64 * 8, 0); BitDump(__func__, WLOG_INFO, pDstData + DstSize - 64, 64 * 8, 0);
printf("Expected\n"); printf("Expected\n");
BitDump(__FUNCTION__, WLOG_INFO, BigBuffer, 64 * 8, 0); BitDump(__func__, WLOG_INFO, BigBuffer, 64 * 8, 0);
printf("...\n"); printf("...\n");
BitDump(__FUNCTION__, WLOG_INFO, BigBuffer + DstSize - 64, 64 * 8, 0); BitDump(__func__, WLOG_INFO, BigBuffer + DstSize - 64, 64 * 8, 0);
printf("Middle Result\n"); printf("Middle Result\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData2, 64 * 8, 0); BitDump(__func__, WLOG_INFO, pDstData2, 64 * 8, 0);
printf("...\n"); printf("...\n");
BitDump(__FUNCTION__, WLOG_INFO, pDstData2 + DstSize2 - 64, 64 * 8, 0); BitDump(__func__, WLOG_INFO, pDstData2 + DstSize2 - 64, 64 * 8, 0);
goto fail; goto fail;
} }

View File

@ -708,57 +708,57 @@ static int test_norbert2_case(void)
if (!region16_union_rect(&region, &region, &rect1)) if (!region16_union_rect(&region, &region, &rect1))
{ {
fprintf(stderr, "%s: Error 1 - region16_union_rect failed\n", __FUNCTION__); fprintf(stderr, "%s: Error 1 - region16_union_rect failed\n", __func__);
goto out; goto out;
} }
if (!(rects = region16_rects(&region, &nbRects))) if (!(rects = region16_rects(&region, &nbRects)))
{ {
fprintf(stderr, "%s: Error 2 - region16_rects failed\n", __FUNCTION__); fprintf(stderr, "%s: Error 2 - region16_rects failed\n", __func__);
goto out; goto out;
} }
if (nbRects != 1) if (nbRects != 1)
{ {
fprintf(stderr, "%s: Error 3 - expected nbRects == 1 but got %" PRIu32 "\n", __FUNCTION__, fprintf(stderr, "%s: Error 3 - expected nbRects == 1 but got %" PRIu32 "\n", __func__,
nbRects); nbRects);
goto out; goto out;
} }
if (!compareRectangles(&rects[0], &rect1, 1)) if (!compareRectangles(&rects[0], &rect1, 1))
{ {
fprintf(stderr, "%s: Error 4 - compare failed\n", __FUNCTION__); fprintf(stderr, "%s: Error 4 - compare failed\n", __func__);
goto out; goto out;
} }
if (!region16_union_rect(&region, &region, &rect2)) if (!region16_union_rect(&region, &region, &rect2))
{ {
fprintf(stderr, "%s: Error 5 - region16_union_rect failed\n", __FUNCTION__); fprintf(stderr, "%s: Error 5 - region16_union_rect failed\n", __func__);
goto out; goto out;
} }
if (!(rects = region16_rects(&region, &nbRects))) if (!(rects = region16_rects(&region, &nbRects)))
{ {
fprintf(stderr, "%s: Error 6 - region16_rects failed\n", __FUNCTION__); fprintf(stderr, "%s: Error 6 - region16_rects failed\n", __func__);
goto out; goto out;
} }
if (nbRects != 2) if (nbRects != 2)
{ {
fprintf(stderr, "%s: Error 7 - expected nbRects == 2 but got %" PRIu32 "\n", __FUNCTION__, fprintf(stderr, "%s: Error 7 - expected nbRects == 2 but got %" PRIu32 "\n", __func__,
nbRects); nbRects);
goto out; goto out;
} }
if (!compareRectangles(&rects[0], &rect2, 1)) if (!compareRectangles(&rects[0], &rect2, 1))
{ {
fprintf(stderr, "%s: Error 8 - compare failed\n", __FUNCTION__); fprintf(stderr, "%s: Error 8 - compare failed\n", __func__);
goto out; goto out;
} }
if (!compareRectangles(&rects[1], &rect1, 1)) if (!compareRectangles(&rects[1], &rect1, 1))
{ {
fprintf(stderr, "%s: Error 9 - compare failed\n", __FUNCTION__); fprintf(stderr, "%s: Error 9 - compare failed\n", __func__);
goto out; goto out;
} }

View File

@ -52,7 +52,7 @@ fail:
freerdp_addin_argv_free(arg2); freerdp_addin_argv_free(arg2);
freerdp_addin_argv_free(arg3); freerdp_addin_argv_free(arg3);
freerdp_addin_argv_free(arg4); freerdp_addin_argv_free(arg4);
printf("%s: %d\n", __FUNCTION__, rc); printf("%s: %d\n", __func__, rc);
return rc; return rc;
} }
@ -88,7 +88,7 @@ fail:
freerdp_addin_argv_free(arg); freerdp_addin_argv_free(arg);
freerdp_addin_argv_free(clone); freerdp_addin_argv_free(clone);
freerdp_addin_argv_free(clone2); freerdp_addin_argv_free(clone2);
printf("%s: %d\n", __FUNCTION__, rc); printf("%s: %d\n", __func__, rc);
return rc; return rc;
} }
@ -142,7 +142,7 @@ static BOOL test_add_remove(void)
rc = TRUE; rc = TRUE;
fail: fail:
freerdp_addin_argv_free(arg); freerdp_addin_argv_free(arg);
printf("%s: %d\n", __FUNCTION__, rc); printf("%s: %d\n", __func__, rc);
return rc; return rc;
} }
@ -180,7 +180,7 @@ static BOOL test_set_argument(void)
rc = TRUE; rc = TRUE;
fail: fail:
freerdp_addin_argv_free(arg); freerdp_addin_argv_free(arg);
printf("%s: %d\n", __FUNCTION__, rc); printf("%s: %d\n", __func__, rc);
return rc; return rc;
} }
@ -221,7 +221,7 @@ static BOOL test_replace_argument(void)
rc = TRUE; rc = TRUE;
fail: fail:
freerdp_addin_argv_free(arg); freerdp_addin_argv_free(arg);
printf("%s: %d\n", __FUNCTION__, rc); printf("%s: %d\n", __func__, rc);
return rc; return rc;
} }
@ -269,7 +269,7 @@ static BOOL test_set_argument_value(void)
rc = TRUE; rc = TRUE;
fail: fail:
freerdp_addin_argv_free(arg); freerdp_addin_argv_free(arg);
printf("%s: %d\n", __FUNCTION__, rc); printf("%s: %d\n", __func__, rc);
return rc; return rc;
} }
@ -320,7 +320,7 @@ static BOOL test_replace_argument_value(void)
rc = TRUE; rc = TRUE;
fail: fail:
freerdp_addin_argv_free(arg); freerdp_addin_argv_free(arg);
printf("%s: %d\n", __FUNCTION__, rc); printf("%s: %d\n", __func__, rc);
return rc; return rc;
} }

View File

@ -214,7 +214,7 @@ int TestCommonAssistance(int argc, char* argv[])
wLog* log; wLog* log;
WINPR_UNUSED(argc); WINPR_UNUSED(argc);
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
log = WLog_Get(__FUNCTION__); log = WLog_Get(__func__);
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT); winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
for (size_t x = 0; x < ARRAYSIZE(fail_tests); x++) for (size_t x = 0; x < ARRAYSIZE(fail_tests); x++)

View File

@ -47,7 +47,7 @@ static BOOL rdp_recv_sync_pdu(rdpRdp* rdp, wStream* s, const char* what)
WINPR_UNUSED(rdp); WINPR_UNUSED(rdp);
if (!Stream_CheckAndLogRequiredLengthEx(TAG, WLOG_WARN, s, 4, 1, "%s(%s:%" PRIuz ") %s", if (!Stream_CheckAndLogRequiredLengthEx(TAG, WLOG_WARN, s, 4, 1, "%s(%s:%" PRIuz ") %s",
__FUNCTION__, __FILE__, (size_t)__LINE__, what)) __func__, __FILE__, (size_t)__LINE__, what))
return FALSE; return FALSE;
Stream_Read_UINT16(s, msgType); Stream_Read_UINT16(s, msgType);
if (msgType != SYNCMSGTYPE_SYNC) if (msgType != SYNCMSGTYPE_SYNC)

View File

@ -463,7 +463,7 @@ static BOOL license_check_stream_capacity(wStream* s, size_t expect, const char*
WINPR_ASSERT(where); WINPR_ASSERT(where);
if (!Stream_CheckAndLogRequiredCapacityEx(TAG, WLOG_WARN, s, expect, 1, "%s(%s:%" PRIuz ") %s", if (!Stream_CheckAndLogRequiredCapacityEx(TAG, WLOG_WARN, s, expect, 1, "%s(%s:%" PRIuz ") %s",
__FUNCTION__, __FILE__, (size_t)__LINE__, where)) __func__, __FILE__, (size_t)__LINE__, where))
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -639,7 +639,7 @@ static int rdstls_recv(rdpTransport* transport, wStream* s, void* extra)
} }
#define rdstls_check_state_requirements(rdstls, expected) \ #define rdstls_check_state_requirements(rdstls, expected) \
rdstls_check_state_requirements_((rdstls), (expected), __FILE__, __FUNCTION__, __LINE__) rdstls_check_state_requirements_((rdstls), (expected), __FILE__, __func__, __LINE__)
static BOOL rdstls_check_state_requirements_(rdpRdstls* rdstls, RDSTLS_STATE expected, static BOOL rdstls_check_state_requirements_(rdpRdstls* rdstls, RDSTLS_STATE expected,
const char* file, const char* fkt, size_t line) const char* file, const char* fkt, size_t line)
{ {

View File

@ -1181,7 +1181,7 @@ BOOL redirection_set_byte_option(rdpRedirection* redirection, UINT32 flag, const
case LB_TARGET_CERTIFICATE: case LB_TARGET_CERTIFICATE:
return rdp_redirection_read_target_cert(redirection, data, length); return rdp_redirection_read_target_cert(redirection, data, length);
default: default:
return redirection_unsupported(__FUNCTION__, flag, return redirection_unsupported(__func__, flag,
LB_CLIENT_TSV_URL | LB_PASSWORD | LB_LOAD_BALANCE_INFO | LB_CLIENT_TSV_URL | LB_PASSWORD | LB_LOAD_BALANCE_INFO |
LB_REDIRECTION_GUID | LB_TARGET_CERTIFICATE); LB_REDIRECTION_GUID | LB_TARGET_CERTIFICATE);
} }
@ -1203,7 +1203,7 @@ BOOL redirection_set_string_option(rdpRedirection* redirection, UINT32 flag, con
case LB_TARGET_NET_ADDRESS: case LB_TARGET_NET_ADDRESS:
return redirection_copy_string(&redirection->TargetNetAddress, str); return redirection_copy_string(&redirection->TargetNetAddress, str);
default: default:
return redirection_unsupported(__FUNCTION__, flag, return redirection_unsupported(__func__, flag,
LB_USERNAME | LB_DOMAIN | LB_TARGET_FQDN | LB_USERNAME | LB_DOMAIN | LB_TARGET_FQDN |
LB_TARGET_NETBIOS_NAME | LB_TARGET_NET_ADDRESS); LB_TARGET_NETBIOS_NAME | LB_TARGET_NET_ADDRESS);
} }
@ -1219,6 +1219,6 @@ BOOL redirection_set_array_option(rdpRedirection* redirection, UINT32 flag, cons
return redirection_copy_array(&redirection->TargetNetAddresses, return redirection_copy_array(&redirection->TargetNetAddresses,
&redirection->TargetNetAddressesCount, str, count); &redirection->TargetNetAddressesCount, str, count);
default: default:
return redirection_unsupported(__FUNCTION__, flag, LB_TARGET_NET_ADDRESSES); return redirection_unsupported(__func__, flag, LB_TARGET_NET_ADDRESSES);
} }
} }

View File

@ -93,7 +93,7 @@ static int testTimeout(int port)
if (diff < timeout) if (diff < timeout)
return -1; return -1;
printf("%s: Success!\n", __FUNCTION__); printf("%s: Success!\n", __func__);
return 0; return 0;
} }
@ -168,14 +168,14 @@ static int testAbort(int port)
if (diff > 5000) if (diff > 5000)
{ {
printf("%s required %" PRIu32 "ms for the test\n", __FUNCTION__, diff); printf("%s required %" PRIu32 "ms for the test\n", __func__, diff);
return -1; return -1;
} }
if (WAIT_OBJECT_0 != status) if (WAIT_OBJECT_0 != status)
return -1; return -1;
printf("%s: Success!\n", __FUNCTION__); printf("%s: Success!\n", __func__);
return 0; return 0;
} }
@ -297,11 +297,11 @@ static int testSuccess(int port)
WaitForSingleObject(process.hProcess, INFINITE); WaitForSingleObject(process.hProcess, INFINITE);
CloseHandle(process.hProcess); CloseHandle(process.hProcess);
CloseHandle(process.hThread); CloseHandle(process.hThread);
printf("%s: returned %d!\n", __FUNCTION__, r); printf("%s: returned %d!\n", __func__, r);
rc = r; rc = r;
if (rc == 0) if (rc == 0)
printf("%s: Success!\n", __FUNCTION__); printf("%s: Success!\n", __func__);
fail: fail:
free(exe); free(exe);

View File

@ -235,7 +235,7 @@ fail:
static BOOL test_copy(void) static BOOL test_copy(void)
{ {
BOOL rc = FALSE; BOOL rc = FALSE;
wLog* log = WLog_Get(__FUNCTION__); wLog* log = WLog_Get(__func__);
rdpSettings* settings = freerdp_settings_new(0); rdpSettings* settings = freerdp_settings_new(0);
rdpSettings* copy = freerdp_settings_clone(settings); rdpSettings* copy = freerdp_settings_clone(settings);
rdpSettings* modified = freerdp_settings_clone(settings); rdpSettings* modified = freerdp_settings_clone(settings);

View File

@ -30,7 +30,7 @@ static BOOL test_entry_read_write(void)
name = GetKnownSubPath(KNOWN_PATH_TEMP, tmp2); name = GetKnownSubPath(KNOWN_PATH_TEMP, tmp2);
if (!name) if (!name)
{ {
fprintf(stderr, "[%s] Could not create temporary path\n", __FUNCTION__); fprintf(stderr, "[%s] Could not create temporary path\n", __func__);
goto fail; goto fail;
} }
@ -38,7 +38,7 @@ static BOOL test_entry_read_write(void)
sr = Stream_New(NULL, 1024); sr = Stream_New(NULL, 1024);
if (!sr || !sw) if (!sr || !sw)
{ {
fprintf(stderr, "[%s] Could not create iostreams sw=%p, sr=%p\n", __FUNCTION__, (void*)sw, fprintf(stderr, "[%s] Could not create iostreams sw=%p, sr=%p\n", __func__, (void*)sw,
(void*)sr); (void*)sr);
goto fail; goto fail;
} }
@ -62,21 +62,21 @@ static BOOL test_entry_read_write(void)
if (entrysize != offset) if (entrysize != offset)
{ {
fprintf(stderr, "[%s] offset %" PRIuz " bytes, entrysize %" PRIuz " bytes\n", __FUNCTION__, fprintf(stderr, "[%s] offset %" PRIuz " bytes, entrysize %" PRIuz " bytes\n", __func__,
offset, entrysize); offset, entrysize);
goto fail; goto fail;
} }
if (Stream_Length(sr) != Stream_Capacity(sw)) if (Stream_Length(sr) != Stream_Capacity(sw))
{ {
fprintf(stderr, "[%s] Written %" PRIuz " bytes, read %" PRIuz " bytes\n", __FUNCTION__, fprintf(stderr, "[%s] Written %" PRIuz " bytes, read %" PRIuz " bytes\n", __func__,
Stream_Length(sr), Stream_Capacity(sw)); Stream_Length(sr), Stream_Capacity(sw));
goto fail; goto fail;
} }
if (memcmp(Stream_Buffer(sw), Stream_Buffer(sr), Stream_Capacity(sw)) != 0) if (memcmp(Stream_Buffer(sw), Stream_Buffer(sr), Stream_Capacity(sw)) != 0)
{ {
fprintf(stderr, "[%s] Written data does not match data read back\n", __FUNCTION__); fprintf(stderr, "[%s] Written data does not match data read back\n", __func__);
goto fail; goto fail;
} }
rc = TRUE; rc = TRUE;

View File

@ -31,8 +31,7 @@
FREERDP_LOCAL int tpkt_verify_header(wStream* s); FREERDP_LOCAL int tpkt_verify_header(wStream* s);
FREERDP_LOCAL BOOL tpkt_read_header(wStream* s, UINT16* length); FREERDP_LOCAL BOOL tpkt_read_header(wStream* s, UINT16* length);
FREERDP_LOCAL BOOL tpkt_write_header(wStream* s, UINT16 length); FREERDP_LOCAL BOOL tpkt_write_header(wStream* s, UINT16 length);
#define tpkt_ensure_stream_consumed(s, length) \ #define tpkt_ensure_stream_consumed(s, length) tpkt_ensure_stream_consumed_((s), (length), __func__)
tpkt_ensure_stream_consumed_((s), (length), __FUNCTION__)
FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_(wStream* s, UINT16 length, const char* fkt); FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_(wStream* s, UINT16 length, const char* fkt);
#endif /* FREERDP_LIB_CORE_TPKT_H */ #endif /* FREERDP_LIB_CORE_TPKT_H */

View File

@ -696,7 +696,7 @@ fail:
} }
#define WLog_ERR_BIO(transport, biofunc, bio) \ #define WLog_ERR_BIO(transport, biofunc, bio) \
transport_bio_error_log(transport, biofunc, bio, __FILE__, __FUNCTION__, __LINE__) transport_bio_error_log(transport, biofunc, bio, __FILE__, __func__, __LINE__)
static void transport_bio_error_log(rdpTransport* transport, LPCSTR biofunc, BIO* bio, LPCSTR file, static void transport_bio_error_log(rdpTransport* transport, LPCSTR biofunc, BIO* bio, LPCSTR file,
LPCSTR func, DWORD line) LPCSTR func, DWORD line)

View File

@ -260,7 +260,7 @@ static BOOL test_certs_dir(void)
rdpCertificateData* data3 = NULL; rdpCertificateData* data3 = NULL;
rdpCertificateData* data4 = NULL; rdpCertificateData* data4 = NULL;
printf("%s\n", __FUNCTION__); printf("%s\n", __func__);
if (!setup_config(&settings)) if (!setup_config(&settings))
goto fail; goto fail;

View File

@ -94,7 +94,7 @@ static int TestCertificateFile(const char* certificate_path,
if (!certificate) if (!certificate)
{ {
printf("%s: failure: cannot read certificate file '%s'\n", __FUNCTION__, certificate_path); printf("%s: failure: cannot read certificate file '%s'\n", __func__, certificate_path);
success = -1; success = -1;
goto fail; goto fail;
} }
@ -113,12 +113,11 @@ static int TestCertificateFile(const char* certificate_path,
if (result) if (result)
{ {
printf("%s: crypto got %-40s -> \"%s\"\n", __FUNCTION__, test->field_description, printf("%s: crypto got %-40s -> \"%s\"\n", __func__, test->field_description, result);
result);
if (0 != strcmp(result, test->expected_result)) if (0 != strcmp(result, test->expected_result))
{ {
printf("%s: failure: for %s, actual: \"%s\", expected \"%s\"\n", __FUNCTION__, printf("%s: failure: for %s, actual: \"%s\", expected \"%s\"\n", __func__,
test->field_description, result, test->expected_result); test->field_description, result, test->expected_result);
success = -1; success = -1;
} }
@ -127,7 +126,7 @@ static int TestCertificateFile(const char* certificate_path,
} }
else else
{ {
printf("%s: failure: cannot get %s\n", __FUNCTION__, test->field_description); printf("%s: failure: cannot get %s\n", __func__, test->field_description);
} }
} }

View File

@ -531,7 +531,7 @@ fail:
gdi_DeleteObject((HGDIOBJECT)hBmpDstOriginal); gdi_DeleteObject((HGDIOBJECT)hBmpDstOriginal);
gdi_DeleteDC(hdcSrc); gdi_DeleteDC(hdcSrc);
gdi_DeleteDC(hdcDst); gdi_DeleteDC(hdcDst);
fprintf(stderr, "%s: TODO Test not implemented!!!\n", __FUNCTION__); fprintf(stderr, "%s: TODO Test not implemented!!!\n", __func__);
return TRUE; // rc; return TRUE; // rc;
} }

View File

@ -40,7 +40,7 @@ static const char post_header_fmt[] = "POST %s HTTP/1.1\r\n"
"Content-Length: %lu\r\n" "Content-Length: %lu\r\n"
"\r\n"; "\r\n";
#define log_errors(log, msg) log_errors_(log, msg, __FILE__, __FUNCTION__, __LINE__) #define log_errors(log, msg) log_errors_(log, msg, __FILE__, __func__, __LINE__)
static void log_errors_(wLog* log, const char* msg, const char* file, const char* fkt, size_t line) static void log_errors_(wLog* log, const char* msg, const char* file, const char* fkt, size_t line)
{ {
const DWORD level = WLOG_ERROR; const DWORD level = WLOG_ERROR;

View File

@ -35,9 +35,9 @@
static const DWORD g_LogLevel = WLOG_DEBUG; static const DWORD g_LogLevel = WLOG_DEBUG;
#define smartcard_unpack_redir_scard_context(s, context, index) \ #define smartcard_unpack_redir_scard_context(s, context, index) \
smartcard_unpack_redir_scard_context_((s), (context), (index), __FILE__, __FUNCTION__, __LINE__) smartcard_unpack_redir_scard_context_((s), (context), (index), __FILE__, __func__, __LINE__)
#define smartcard_unpack_redir_scard_handle(s, context, index) \ #define smartcard_unpack_redir_scard_handle(s, context, index) \
smartcard_unpack_redir_scard_handle_((s), (context), (index), __FILE__, __FUNCTION__, __LINE__) smartcard_unpack_redir_scard_handle_((s), (context), (index), __FILE__, __func__, __LINE__)
static LONG smartcard_unpack_redir_scard_context_(wStream* s, REDIR_SCARDCONTEXT* context, static LONG smartcard_unpack_redir_scard_context_(wStream* s, REDIR_SCARDCONTEXT* context,
UINT32* index, const char* file, UINT32* index, const char* file,
@ -65,7 +65,7 @@ typedef enum
/* Reads a NDR pointer and checks if the value read has the expected relative /* Reads a NDR pointer and checks if the value read has the expected relative
* addressing */ * addressing */
#define smartcard_ndr_pointer_read(s, index, ptr) \ #define smartcard_ndr_pointer_read(s, index, ptr) \
smartcard_ndr_pointer_read_((s), (index), (ptr), __FILE__, __FUNCTION__, __LINE__) smartcard_ndr_pointer_read_((s), (index), (ptr), __FILE__, __func__, __LINE__)
static BOOL smartcard_ndr_pointer_read_(wStream* s, UINT32* index, UINT32* ptr, const char* file, static BOOL smartcard_ndr_pointer_read_(wStream* s, UINT32* index, UINT32* ptr, const char* file,
const char* fkt, size_t line) const char* fkt, size_t line)
{ {
@ -1440,7 +1440,7 @@ static LONG smartcard_unpack_common_context_and_string_a(wStream* s, REDIR_SCARD
if (status != SCARD_S_SUCCESS) if (status != SCARD_S_SUCCESS)
return status; return status;
smartcard_trace_context_and_string_call_a(__FUNCTION__, phContext, *pszReaderName); smartcard_trace_context_and_string_call_a(__func__, phContext, *pszReaderName);
return SCARD_S_SUCCESS; return SCARD_S_SUCCESS;
} }
@ -1465,7 +1465,7 @@ static LONG smartcard_unpack_common_context_and_string_w(wStream* s, REDIR_SCARD
if (status != SCARD_S_SUCCESS) if (status != SCARD_S_SUCCESS)
return status; return status;
smartcard_trace_context_and_string_call_w(__FUNCTION__, phContext, *pszReaderName); smartcard_trace_context_and_string_call_w(__func__, phContext, *pszReaderName);
return SCARD_S_SUCCESS; return SCARD_S_SUCCESS;
} }

View File

@ -19,7 +19,7 @@ int TestRdTkNinePatch(int argc, char* argv[])
if (!(engine = rdtk_engine_new())) if (!(engine = rdtk_engine_new()))
{ {
printf("%s: error creating rdtk engine (%" PRIu32 ")\n", __FUNCTION__, GetLastError()); printf("%s: error creating rdtk engine (%" PRIu32 ")\n", __func__, GetLastError());
goto out; goto out;
} }
@ -30,7 +30,7 @@ int TestRdTkNinePatch(int argc, char* argv[])
/* let rdtk allocate the surface buffer */ /* let rdtk allocate the surface buffer */
if (!(surface = rdtk_surface_new(engine, NULL, width, height, scanline))) if (!(surface = rdtk_surface_new(engine, NULL, width, height, scanline)))
{ {
printf("%s: error creating auto-allocated surface (%" PRIu32 ")\n", __FUNCTION__, printf("%s: error creating auto-allocated surface (%" PRIu32 ")\n", __func__,
GetLastError()); GetLastError());
goto out; goto out;
} }
@ -40,13 +40,13 @@ int TestRdTkNinePatch(int argc, char* argv[])
/* test self-allocated buffer */ /* test self-allocated buffer */
if (!(data = calloc(height, scanline))) if (!(data = calloc(height, scanline)))
{ {
printf("%s: error allocating surface buffer (%" PRIu32 ")\n", __FUNCTION__, GetLastError()); printf("%s: error allocating surface buffer (%" PRIu32 ")\n", __func__, GetLastError());
goto out; goto out;
} }
if (!(surface = rdtk_surface_new(engine, data, width, height, scanline))) if (!(surface = rdtk_surface_new(engine, data, width, height, scanline)))
{ {
printf("%s: error creating self-allocated surface (%" PRIu32 ")\n", __FUNCTION__, printf("%s: error creating self-allocated surface (%" PRIu32 ")\n", __func__,
GetLastError()); GetLastError());
goto out; goto out;
} }

View File

@ -132,16 +132,16 @@ typedef struct
} \ } \
} while (0) } while (0)
#define Stream_CheckAndLogRequiredLengthSrv(log, s, len) \ #define Stream_CheckAndLogRequiredLengthSrv(log, s, len) \
Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \ Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \
proxy_client_rx " %s(%s:%" PRIuz ")", __FUNCTION__, \ proxy_client_rx " %s(%s:%" PRIuz ")", __func__, \
__FILE__, (size_t)__LINE__) __FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredLengthClient(log, s, len) \ #define Stream_CheckAndLogRequiredLengthClient(log, s, len) \
Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \ Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \
proxy_server_rx " %s(%s:%" PRIuz ")", __FUNCTION__, \ proxy_server_rx " %s(%s:%" PRIuz ")", __func__, \
__FILE__, (size_t)__LINE__) __FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredLengthRx(srv, log, s, len) \ #define Stream_CheckAndLogRequiredLengthRx(srv, log, s, len) \
Stream_CheckAndLogRequiredLengthRx_(srv, log, s, len, 1, __FUNCTION__, __FILE__, __LINE__) Stream_CheckAndLogRequiredLengthRx_(srv, log, s, len, 1, __func__, __FILE__, __LINE__)
static BOOL Stream_CheckAndLogRequiredLengthRx_(BOOL srv, wLog* log, wStream* s, size_t nmemb, static BOOL Stream_CheckAndLogRequiredLengthRx_(BOOL srv, wLog* log, wStream* s, size_t nmemb,
size_t size, const char* fkt, const char* file, size_t size, const char* fkt, const char* file,
size_t line) size_t line)
@ -517,7 +517,7 @@ static UINT rdpdr_send_client_name_request(pClientContext* pc, pf_channel_client
} }
#define rdpdr_ignore_capset(srv, log, s, header) \ #define rdpdr_ignore_capset(srv, log, s, header) \
rdpdr_ignore_capset_((srv), (log), (s), header, __FUNCTION__) rdpdr_ignore_capset_((srv), (log), (s), header, __func__)
static UINT rdpdr_ignore_capset_(BOOL srv, wLog* log, wStream* s, static UINT rdpdr_ignore_capset_(BOOL srv, wLog* log, wStream* s,
const RDPDR_CAPABILITY_HEADER* header, const char* fkt) const RDPDR_CAPABILITY_HEADER* header, const char* fkt)
{ {

View File

@ -333,7 +333,7 @@ static BOOL demo_dyn_channel_intercept_list(proxyPlugin* plugin, proxyData* pdat
WINPR_ASSERT(pdata); WINPR_ASSERT(pdata);
WINPR_ASSERT(data); WINPR_ASSERT(data);
WLog_INFO(TAG, "%s", __FUNCTION__); WLog_INFO(TAG, "%s", __func__);
return TRUE; return TRUE;
} }
@ -345,7 +345,7 @@ static BOOL demo_static_channel_intercept_list(proxyPlugin* plugin, proxyData* p
WINPR_ASSERT(pdata); WINPR_ASSERT(pdata);
WINPR_ASSERT(data); WINPR_ASSERT(data);
WLog_INFO(TAG, "%s", __FUNCTION__); WLog_INFO(TAG, "%s", __func__);
return TRUE; return TRUE;
} }
@ -357,7 +357,7 @@ static BOOL demo_dyn_channel_intercept(proxyPlugin* plugin, proxyData* pdata, vo
WINPR_ASSERT(pdata); WINPR_ASSERT(pdata);
WINPR_ASSERT(data); WINPR_ASSERT(data);
WLog_INFO(TAG, "%s", __FUNCTION__); WLog_INFO(TAG, "%s", __func__);
return TRUE; return TRUE;
} }

View File

@ -32,11 +32,11 @@
extern "C" extern "C"
{ {
#endif #endif
#define WINPR_ASSERT(cond) \ #define WINPR_ASSERT(cond) \
do \ do \
{ \ { \
if (!(cond)) \ if (!(cond)) \
winpr_int_assert(#cond, __FILE__, __FUNCTION__, __LINE__); \ winpr_int_assert(#cond, __FILE__, __func__, __LINE__); \
} while (0) } while (0)
static INLINE WINPR_NORETURN(void winpr_int_assert(const char* condstr, const char* file, static INLINE WINPR_NORETURN(void winpr_int_assert(const char* condstr, const char* file,

View File

@ -58,7 +58,7 @@ extern "C"
#define Stream_CheckAndLogRequiredCapacityOfSize(tag, s, nmemb, size) \ #define Stream_CheckAndLogRequiredCapacityOfSize(tag, s, nmemb, size) \
Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \ Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__FUNCTION__, __FILE__, (size_t)__LINE__) __func__, __FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredCapacity(tag, s, len) \ #define Stream_CheckAndLogRequiredCapacity(tag, s, len) \
Stream_CheckAndLogRequiredCapacityOfSize((tag), (s), (len), 1) Stream_CheckAndLogRequiredCapacityOfSize((tag), (s), (len), 1)
@ -71,7 +71,7 @@ extern "C"
#define Stream_CheckAndLogRequiredCapacityOfSizeWLog(log, s, nmemb, size) \ #define Stream_CheckAndLogRequiredCapacityOfSizeWLog(log, s, nmemb, size) \
Stream_CheckAndLogRequiredCapacityWLogEx(log, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \ Stream_CheckAndLogRequiredCapacityWLogEx(log, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__FUNCTION__, __FILE__, (size_t)__LINE__) __func__, __FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredCapacityWLog(log, s, len) \ #define Stream_CheckAndLogRequiredCapacityWLog(log, s, len) \
Stream_CheckAndLogRequiredCapacityOfSizeWLog((log), (s), (len), 1) Stream_CheckAndLogRequiredCapacityOfSizeWLog((log), (s), (len), 1)
@ -90,7 +90,7 @@ extern "C"
#define Stream_CheckAndLogRequiredLengthOfSize(tag, s, nmemb, size) \ #define Stream_CheckAndLogRequiredLengthOfSize(tag, s, nmemb, size) \
Stream_CheckAndLogRequiredLengthEx(tag, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \ Stream_CheckAndLogRequiredLengthEx(tag, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__FUNCTION__, __FILE__, (size_t)__LINE__) __func__, __FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredLength(tag, s, len) \ #define Stream_CheckAndLogRequiredLength(tag, s, len) \
Stream_CheckAndLogRequiredLengthOfSize(tag, s, len, 1) Stream_CheckAndLogRequiredLengthOfSize(tag, s, len, 1)
@ -103,7 +103,7 @@ extern "C"
#define Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, nmemb, size) \ #define Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, nmemb, size) \
Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \ Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__FUNCTION__, __FILE__, (size_t)__LINE__) __func__, __FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredLengthWLog(log, s, len) \ #define Stream_CheckAndLogRequiredLengthWLog(log, s, len) \
Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, len, 1) Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, len, 1)
@ -506,7 +506,7 @@ extern "C"
memset(_s->buffer, 0, _s->capacity); memset(_s->buffer, 0, _s->capacity);
} }
#define Stream_SafeSeek(s, size) Stream_SafeSeekEx(s, size, __FILE__, __LINE__, __FUNCTION__) #define Stream_SafeSeek(s, size) Stream_SafeSeekEx(s, size, __FILE__, __LINE__, __func__)
WINPR_API BOOL Stream_SafeSeekEx(wStream* s, size_t size, const char* file, size_t line, WINPR_API BOOL Stream_SafeSeekEx(wStream* s, size_t size, const char* file, size_t line,
const char* fkt); const char* fkt);

View File

@ -109,7 +109,7 @@ extern "C"
WINPR_API BOOL ResetEvent(HANDLE hEvent); WINPR_API BOOL ResetEvent(HANDLE hEvent);
#if defined(WITH_DEBUG_EVENTS) #if defined(WITH_DEBUG_EVENTS)
#define DumpEventHandles() DumpEventHandles_(__FUNCTION__, __FILE__, __LINE__) #define DumpEventHandles() DumpEventHandles_(__func__, __FILE__, __LINE__)
WINPR_API void DumpEventHandles_(const char* fkt, const char* file, size_t line); WINPR_API void DumpEventHandles_(const char* fkt, const char* file, size_t line);
#endif #endif
#ifdef UNICODE #ifdef UNICODE

View File

@ -78,7 +78,7 @@ extern "C"
size_t LineNumber; /* __LINE__ */ size_t LineNumber; /* __LINE__ */
LPCSTR FileName; /* __FILE__ */ LPCSTR FileName; /* __FILE__ */
LPCSTR FunctionName; /* __FUNCTION__ */ LPCSTR FunctionName; /* __func__ */
/* Data Message */ /* Data Message */
@ -127,14 +127,14 @@ extern "C"
*/ */
WINPR_API BOOL WLog_SetContext(wLog* log, const char* (*fkt)(void*), void* context); WINPR_API BOOL WLog_SetContext(wLog* log, const char* (*fkt)(void*), void* context);
#define WLog_Print(_log, _log_level, ...) \ #define WLog_Print(_log, _log_level, ...) \
do \ do \
{ \ { \
if (WLog_IsLevelActive(_log, _log_level)) \ if (WLog_IsLevelActive(_log, _log_level)) \
{ \ { \
WLog_PrintMessage(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, \ WLog_PrintMessage(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, __func__, \
__FUNCTION__, __VA_ARGS__); \ __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define WLog_Print_tag(_tag, _log_level, ...) \ #define WLog_Print_tag(_tag, _log_level, ...) \
@ -146,44 +146,44 @@ extern "C"
WLog_Print(_log_cached_ptr, _log_level, __VA_ARGS__); \ WLog_Print(_log_cached_ptr, _log_level, __VA_ARGS__); \
} while (0) } while (0)
#define WLog_PrintVA(_log, _log_level, _args) \ #define WLog_PrintVA(_log, _log_level, _args) \
do \ do \
{ \ { \
if (WLog_IsLevelActive(_log, _log_level)) \ if (WLog_IsLevelActive(_log, _log_level)) \
{ \ { \
WLog_PrintMessageVA(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, \ WLog_PrintMessageVA(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, __func__, \
__FUNCTION__, _args); \ _args); \
} \ } \
} while (0) } while (0)
#define WLog_Data(_log, _log_level, ...) \ #define WLog_Data(_log, _log_level, ...) \
do \ do \
{ \ { \
if (WLog_IsLevelActive(_log, _log_level)) \ if (WLog_IsLevelActive(_log, _log_level)) \
{ \ { \
WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, \ WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, __func__, \
__FUNCTION__, __VA_ARGS__); \ __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define WLog_Image(_log, _log_level, ...) \ #define WLog_Image(_log, _log_level, ...) \
do \ do \
{ \ { \
if (WLog_IsLevelActive(_log, _log_level)) \ if (WLog_IsLevelActive(_log, _log_level)) \
{ \ { \
WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, \ WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, __func__, \
__FUNCTION__, __VA_ARGS__); \ __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define WLog_Packet(_log, _log_level, ...) \ #define WLog_Packet(_log, _log_level, ...) \
do \ do \
{ \ { \
if (WLog_IsLevelActive(_log, _log_level)) \ if (WLog_IsLevelActive(_log, _log_level)) \
{ \ { \
WLog_PrintMessage(_log, WLOG_MESSAGE_PACKET, _log_level, __LINE__, __FILE__, \ WLog_PrintMessage(_log, WLOG_MESSAGE_PACKET, _log_level, __LINE__, __FILE__, __func__, \
__FUNCTION__, __VA_ARGS__); \ __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define WLog_LVL(tag, lvl, ...) WLog_Print_tag(tag, lvl, __VA_ARGS__) #define WLog_LVL(tag, lvl, ...) WLog_Print_tag(tag, lvl, __VA_ARGS__)

View File

@ -21,7 +21,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed size_t test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed size_t test: got [%s] instead of [%s]\n", __func__, fmt,
chk); chk);
errors++; errors++;
} }
@ -37,8 +37,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed INT8 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed INT8 test: got [%s] instead of [%s]\n", __func__, fmt, chk);
chk);
errors++; errors++;
} }
} }
@ -53,8 +52,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed UINT8 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed UINT8 test: got [%s] instead of [%s]\n", __func__, fmt, chk);
chk);
errors++; errors++;
} }
} }
@ -69,8 +67,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed INT16 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed INT16 test: got [%s] instead of [%s]\n", __func__, fmt, chk);
chk);
errors++; errors++;
} }
} }
@ -86,7 +83,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed UINT16 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed UINT16 test: got [%s] instead of [%s]\n", __func__, fmt,
chk); chk);
errors++; errors++;
} }
@ -102,8 +99,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed INT32 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed INT32 test: got [%s] instead of [%s]\n", __func__, fmt, chk);
chk);
errors++; errors++;
} }
} }
@ -119,7 +115,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed UINT16 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed UINT16 test: got [%s] instead of [%s]\n", __func__, fmt,
chk); chk);
errors++; errors++;
} }
@ -135,8 +131,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed INT64 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed INT64 test: got [%s] instead of [%s]\n", __func__, fmt, chk);
chk);
errors++; errors++;
} }
} }
@ -153,7 +148,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (strcmp(fmt, chk)) if (strcmp(fmt, chk))
{ {
fprintf(stderr, "%s failed UINT64 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, fprintf(stderr, "%s failed UINT64 test: got [%s] instead of [%s]\n", __func__, fmt,
chk); chk);
errors++; errors++;
} }
@ -161,7 +156,7 @@ int TestFormatSpecifiers(int argc, char* argv[])
if (errors) if (errors)
{ {
fprintf(stderr, "%s produced %u errors\n", __FUNCTION__, errors); fprintf(stderr, "%s produced %u errors\n", __func__, errors);
return -1; return -1;
} }

View File

@ -72,7 +72,7 @@ static BOOL check_short_buffer(const char* prefix, int rc, size_t buffersize,
} }
#define compare_utf16(what, buffersize, rc, inputlen, test) \ #define compare_utf16(what, buffersize, rc, inputlen, test) \
compare_utf16_int((what), (buffersize), (rc), (inputlen), (test), __FUNCTION__, __LINE__) compare_utf16_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)
static BOOL compare_utf16_int(const WCHAR* what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen, static BOOL compare_utf16_int(const WCHAR* what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen,
const testcase_t* test, const char* fkt, size_t line) const testcase_t* test, const char* fkt, size_t line)
{ {
@ -122,7 +122,7 @@ static BOOL compare_utf16_int(const WCHAR* what, size_t buffersize, SSIZE_T rc,
} }
#define compare_utf8(what, buffersize, rc, inputlen, test) \ #define compare_utf8(what, buffersize, rc, inputlen, test) \
compare_utf8_int((what), (buffersize), (rc), (inputlen), (test), __FUNCTION__, __LINE__) compare_utf8_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)
static BOOL compare_utf8_int(const char* what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen, static BOOL compare_utf8_int(const char* what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen,
const testcase_t* test, const char* fkt, size_t line) const testcase_t* test, const char* fkt, size_t line)
{ {
@ -181,7 +181,7 @@ static BOOL test_convert_to_utf16(const testcase_t* test)
if ((rc2 < 0) || ((size_t)rc2 != wlen)) if ((rc2 < 0) || ((size_t)rc2 != wlen))
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __FUNCTION__, __LINE__); create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __func__, __LINE__);
fprintf(stderr, "%s ConvertUtf8ToWChar(%s, NULL, 0) expected %" PRIuz ", got %" PRIdz "\n", fprintf(stderr, "%s ConvertUtf8ToWChar(%s, NULL, 0) expected %" PRIuz ", got %" PRIdz "\n",
prefix, test->utf8, wlen, rc2); prefix, test->utf8, wlen, rc2);
return FALSE; return FALSE;
@ -208,8 +208,7 @@ static BOOL test_convert_to_utf16_n(const testcase_t* test)
if ((rc2 < 0) || ((size_t)rc2 != wlen)) if ((rc2 < 0) || ((size_t)rc2 != wlen))
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __FUNCTION__, create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __func__, __LINE__);
__LINE__);
fprintf(stderr, fprintf(stderr,
"%s ConvertUtf8NToWChar(%s, %" PRIuz ", NULL, 0) expected %" PRIuz ", got %" PRIdz "%s ConvertUtf8NToWChar(%s, %" PRIuz ", NULL, 0) expected %" PRIuz ", got %" PRIdz
"\n", "\n",
@ -245,7 +244,7 @@ static BOOL test_convert_to_utf8(const testcase_t* test)
if ((rc2 < 0) || ((size_t)rc2 != wlen)) if ((rc2 < 0) || ((size_t)rc2 != wlen))
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __FUNCTION__, __LINE__); create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __func__, __LINE__);
fprintf(stderr, "%s ConvertWCharToUtf8(%s, NULL, 0) expected %" PRIuz ", got %" PRIdz "\n", fprintf(stderr, "%s ConvertWCharToUtf8(%s, NULL, 0) expected %" PRIuz ", got %" PRIdz "\n",
prefix, test->utf8, wlen, rc2); prefix, test->utf8, wlen, rc2);
return FALSE; return FALSE;
@ -273,8 +272,7 @@ static BOOL test_convert_to_utf8_n(const testcase_t* test)
if ((rc2 < 0) || ((size_t)rc2 != wlen)) if ((rc2 < 0) || ((size_t)rc2 != wlen))
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __FUNCTION__, create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __func__, __LINE__);
__LINE__);
fprintf(stderr, fprintf(stderr,
"%s ConvertWCharNToUtf8(%s, %" PRIuz ", NULL, 0) expected %" PRIuz ", got %" PRIdz "%s ConvertWCharNToUtf8(%s, %" PRIuz ", NULL, 0) expected %" PRIuz ", got %" PRIdz
"\n", "\n",
@ -323,7 +321,7 @@ static BOOL test_conversion(const testcase_t* testcases, size_t count)
#if defined(WITH_WINPR_DEPRECATED) #if defined(WITH_WINPR_DEPRECATED)
#define compare_win_utf16(what, buffersize, rc, inputlen, test) \ #define compare_win_utf16(what, buffersize, rc, inputlen, test) \
compare_win_utf16_int((what), (buffersize), (rc), (inputlen), (test), __FUNCTION__, __LINE__) compare_win_utf16_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)
static BOOL compare_win_utf16_int(const WCHAR* what, size_t buffersize, int rc, int inputlen, static BOOL compare_win_utf16_int(const WCHAR* what, size_t buffersize, int rc, int inputlen,
const testcase_t* test, const char* fkt, size_t line) const testcase_t* test, const char* fkt, size_t line)
{ {
@ -393,7 +391,7 @@ static BOOL compare_win_utf16_int(const WCHAR* what, size_t buffersize, int rc,
} }
#define compare_win_utf8(what, buffersize, rc, inputlen, test) \ #define compare_win_utf8(what, buffersize, rc, inputlen, test) \
compare_win_utf8_int((what), (buffersize), (rc), (inputlen), (test), __FUNCTION__, __LINE__) compare_win_utf8_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)
static BOOL compare_win_utf8_int(const char* what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen, static BOOL compare_win_utf8_int(const char* what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen,
const testcase_t* test, const char* fkt, size_t line) const testcase_t* test, const char* fkt, size_t line)
{ {
@ -471,7 +469,7 @@ static BOOL test_win_convert_to_utf16(const testcase_t* test)
if (rc2 != wlen + 1) if (rc2 != wlen + 1)
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __FUNCTION__, __LINE__); create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __func__, __LINE__);
fprintf(stderr, fprintf(stderr,
"%s MultiByteToWideChar(CP_UTF8, 0, %s, [-1], NULL, 0) expected %" PRIuz "%s MultiByteToWideChar(CP_UTF8, 0, %s, [-1], NULL, 0) expected %" PRIuz
", got %d\n", ", got %d\n",
@ -504,8 +502,7 @@ static BOOL test_win_convert_to_utf16_n(const testcase_t* test)
if (rc2 != wlen) if (rc2 != wlen)
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __FUNCTION__, create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __func__, __LINE__);
__LINE__);
fprintf(stderr, fprintf(stderr,
"%s MultiByteToWideChar(CP_UTF8, 0, %s, %" PRIuz ", NULL, 0) expected %" PRIuz "%s MultiByteToWideChar(CP_UTF8, 0, %s, %" PRIuz ", NULL, 0) expected %" PRIuz
", got %d\n", ", got %d\n",
@ -545,7 +542,7 @@ static BOOL test_win_convert_to_utf8(const testcase_t* test)
if (rc2 != wlen) if (rc2 != wlen)
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __FUNCTION__, __LINE__); create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, -1, test, __func__, __LINE__);
fprintf(stderr, fprintf(stderr,
"%s WideCharToMultiByte(CP_UTF8, 0, %s, -1, NULL, 0, NULL, NULL) expected %" PRIuz "%s WideCharToMultiByte(CP_UTF8, 0, %s, -1, NULL, 0, NULL, NULL) expected %" PRIuz
", got %d\n", ", got %d\n",
@ -580,8 +577,7 @@ static BOOL test_win_convert_to_utf8_n(const testcase_t* test)
if (rc2 != wlen) if (rc2 != wlen)
{ {
char prefix[8192] = { 0 }; char prefix[8192] = { 0 };
create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __FUNCTION__, create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __func__, __LINE__);
__LINE__);
fprintf(stderr, fprintf(stderr,
"%s WideCharToMultiByte(CP_UTF8, 0, %s, %" PRIuz "%s WideCharToMultiByte(CP_UTF8, 0, %s, %" PRIuz
", NULL, 0, NULL, NULL) expected %" PRIuz ", got %d\n", ", NULL, 0, NULL, NULL) expected %" PRIuz ", got %d\n",

View File

@ -22,7 +22,7 @@ static BOOL test_crypto_cipher_aes_128_cbc(void)
if (!(ctx = winpr_Cipher_New(WINPR_CIPHER_AES_128_CBC, WINPR_ENCRYPT, key, iv))) if (!(ctx = winpr_Cipher_New(WINPR_CIPHER_AES_128_CBC, WINPR_ENCRYPT, key, iv)))
{ {
fprintf(stderr, "%s: winpr_Cipher_New (encrypt) failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Cipher_New (encrypt) failed\n", __func__);
return FALSE; return FALSE;
} }
@ -35,22 +35,22 @@ static BOOL test_crypto_cipher_aes_128_cbc(void)
if (!winpr_Cipher_Update(ctx, ibuf, ilen, obuf, &olen)) if (!winpr_Cipher_Update(ctx, ibuf, ilen, obuf, &olen))
{ {
fprintf(stderr, "%s: winpr_Cipher_New (encrypt) failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Cipher_New (encrypt) failed\n", __func__);
goto out; goto out;
} }
xlen += olen; xlen += olen;
if (!winpr_Cipher_Final(ctx, obuf + xlen, &olen)) if (!winpr_Cipher_Final(ctx, obuf + xlen, &olen))
{ {
fprintf(stderr, "%s: winpr_Cipher_Final (encrypt) failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Cipher_Final (encrypt) failed\n", __func__);
goto out; goto out;
} }
xlen += olen; xlen += olen;
if (xlen != ilen) if (xlen != ilen)
{ {
fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (encrypt)\n", fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (encrypt)\n", __func__,
__FUNCTION__, xlen, ilen); xlen, ilen);
goto out; goto out;
} }
@ -60,7 +60,7 @@ static BOOL test_crypto_cipher_aes_128_cbc(void)
if (!(ctx = winpr_Cipher_New(WINPR_CIPHER_AES_128_CBC, WINPR_DECRYPT, key, iv))) if (!(ctx = winpr_Cipher_New(WINPR_CIPHER_AES_128_CBC, WINPR_DECRYPT, key, iv)))
{ {
fprintf(stderr, "%s: winpr_Cipher_New (decrypt) failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Cipher_New (decrypt) failed\n", __func__);
return FALSE; return FALSE;
} }
@ -74,28 +74,28 @@ static BOOL test_crypto_cipher_aes_128_cbc(void)
if (!winpr_Cipher_Update(ctx, ibuf, ilen, obuf, &olen)) if (!winpr_Cipher_Update(ctx, ibuf, ilen, obuf, &olen))
{ {
fprintf(stderr, "%s: winpr_Cipher_New (decrypt) failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Cipher_New (decrypt) failed\n", __func__);
goto out; goto out;
} }
xlen += olen; xlen += olen;
if (!winpr_Cipher_Final(ctx, obuf + xlen, &olen)) if (!winpr_Cipher_Final(ctx, obuf + xlen, &olen))
{ {
fprintf(stderr, "%s: winpr_Cipher_Final (decrypt) failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Cipher_Final (decrypt) failed\n", __func__);
goto out; goto out;
} }
xlen += olen; xlen += olen;
if (xlen != ilen) if (xlen != ilen)
{ {
fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (decrypt)\n", fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (decrypt)\n", __func__,
__FUNCTION__, xlen, ilen); xlen, ilen);
goto out; goto out;
} }
if (strcmp((const char*)obuf, plaintext)) if (strcmp((const char*)obuf, plaintext))
{ {
fprintf(stderr, "%s: error, decrypted data does not match plaintext\n", __FUNCTION__); fprintf(stderr, "%s: error, decrypted data does not match plaintext\n", __func__);
goto out; goto out;
} }
@ -121,21 +121,21 @@ static BOOL test_crypto_cipher_rc4(void)
if (!(text = (BYTE*)calloc(1, len))) if (!(text = (BYTE*)calloc(1, len)))
{ {
fprintf(stderr, "%s: failed to allocate text buffer (len=%" PRIuz ")\n", __FUNCTION__, len); fprintf(stderr, "%s: failed to allocate text buffer (len=%" PRIuz ")\n", __func__, len);
goto out; goto out;
} }
if ((ctx = winpr_RC4_New(TEST_RC4_KEY, if ((ctx = winpr_RC4_New(TEST_RC4_KEY,
strnlen((const char*)TEST_RC4_KEY, sizeof(TEST_RC4_KEY)))) == NULL) strnlen((const char*)TEST_RC4_KEY, sizeof(TEST_RC4_KEY)))) == NULL)
{ {
fprintf(stderr, "%s: winpr_RC4_New failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_RC4_New failed\n", __func__);
goto out; goto out;
} }
rc = winpr_RC4_Update(ctx, len, (const BYTE*)TEST_RC4_PLAINTEXT, text); rc = winpr_RC4_Update(ctx, len, (const BYTE*)TEST_RC4_PLAINTEXT, text);
winpr_RC4_Free(ctx); winpr_RC4_Free(ctx);
if (!rc) if (!rc)
{ {
fprintf(stderr, "%s: winpr_RC4_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_RC4_Update failed\n", __func__);
goto out; goto out;
} }
@ -147,7 +147,7 @@ static BOOL test_crypto_cipher_rc4(void)
actual = winpr_BinToHexString(text, len, FALSE); actual = winpr_BinToHexString(text, len, FALSE);
expected = winpr_BinToHexString(TEST_RC4_CIPHERTEXT, len, FALSE); expected = winpr_BinToHexString(TEST_RC4_CIPHERTEXT, len, FALSE);
fprintf(stderr, "%s: unexpected RC4 ciphertext: Actual: %s Expected: %s\n", __FUNCTION__, fprintf(stderr, "%s: unexpected RC4 ciphertext: Actual: %s Expected: %s\n", __func__,
actual, expected); actual, expected);
free(actual); free(actual);

View File

@ -16,23 +16,23 @@ static BOOL test_crypto_hash_md5(void)
if (!(ctx = winpr_Digest_New())) if (!(ctx = winpr_Digest_New()))
{ {
fprintf(stderr, "%s: winpr_Digest_New failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_New failed\n", __func__);
return FALSE; return FALSE;
} }
if (!winpr_Digest_Init(ctx, WINPR_MD_MD5)) if (!winpr_Digest_Init(ctx, WINPR_MD_MD5))
{ {
fprintf(stderr, "%s: winpr_Digest_Init failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Init failed\n", __func__);
goto out; goto out;
} }
if (!winpr_Digest_Update(ctx, (const BYTE*)TEST_MD5_DATA, if (!winpr_Digest_Update(ctx, (const BYTE*)TEST_MD5_DATA,
strnlen(TEST_MD5_DATA, sizeof(TEST_MD5_DATA)))) strnlen(TEST_MD5_DATA, sizeof(TEST_MD5_DATA))))
{ {
fprintf(stderr, "%s: winpr_Digest_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Update failed\n", __func__);
goto out; goto out;
} }
if (!winpr_Digest_Final(ctx, hash, sizeof(hash))) if (!winpr_Digest_Final(ctx, hash, sizeof(hash)))
{ {
fprintf(stderr, "%s: winpr_Digest_Final failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Final failed\n", __func__);
goto out; goto out;
} }
if (memcmp(hash, TEST_MD5_HASH, WINPR_MD5_DIGEST_LENGTH) != 0) if (memcmp(hash, TEST_MD5_HASH, WINPR_MD5_DIGEST_LENGTH) != 0)
@ -69,23 +69,23 @@ static BOOL test_crypto_hash_md4(void)
if (!(ctx = winpr_Digest_New())) if (!(ctx = winpr_Digest_New()))
{ {
fprintf(stderr, "%s: winpr_Digest_New failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_New failed\n", __func__);
return FALSE; return FALSE;
} }
if (!winpr_Digest_Init(ctx, WINPR_MD_MD4)) if (!winpr_Digest_Init(ctx, WINPR_MD_MD4))
{ {
fprintf(stderr, "%s: winpr_Digest_Init failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Init failed\n", __func__);
goto out; goto out;
} }
if (!winpr_Digest_Update(ctx, (const BYTE*)TEST_MD4_DATA, if (!winpr_Digest_Update(ctx, (const BYTE*)TEST_MD4_DATA,
strnlen(TEST_MD4_DATA, sizeof(TEST_MD4_DATA)))) strnlen(TEST_MD4_DATA, sizeof(TEST_MD4_DATA))))
{ {
fprintf(stderr, "%s: winpr_Digest_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Update failed\n", __func__);
goto out; goto out;
} }
if (!winpr_Digest_Final(ctx, hash, sizeof(hash))) if (!winpr_Digest_Final(ctx, hash, sizeof(hash)))
{ {
fprintf(stderr, "%s: winpr_Digest_Final failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Final failed\n", __func__);
goto out; goto out;
} }
if (memcmp(hash, TEST_MD4_HASH, WINPR_MD4_DIGEST_LENGTH) != 0) if (memcmp(hash, TEST_MD4_HASH, WINPR_MD4_DIGEST_LENGTH) != 0)
@ -122,23 +122,23 @@ static BOOL test_crypto_hash_sha1(void)
if (!(ctx = winpr_Digest_New())) if (!(ctx = winpr_Digest_New()))
{ {
fprintf(stderr, "%s: winpr_Digest_New failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_New failed\n", __func__);
return FALSE; return FALSE;
} }
if (!winpr_Digest_Init(ctx, WINPR_MD_SHA1)) if (!winpr_Digest_Init(ctx, WINPR_MD_SHA1))
{ {
fprintf(stderr, "%s: winpr_Digest_Init failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Init failed\n", __func__);
goto out; goto out;
} }
if (!winpr_Digest_Update(ctx, (const BYTE*)TEST_SHA1_DATA, if (!winpr_Digest_Update(ctx, (const BYTE*)TEST_SHA1_DATA,
strnlen(TEST_SHA1_DATA, sizeof(TEST_SHA1_DATA)))) strnlen(TEST_SHA1_DATA, sizeof(TEST_SHA1_DATA))))
{ {
fprintf(stderr, "%s: winpr_Digest_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Update failed\n", __func__);
goto out; goto out;
} }
if (!winpr_Digest_Final(ctx, hash, sizeof(hash))) if (!winpr_Digest_Final(ctx, hash, sizeof(hash)))
{ {
fprintf(stderr, "%s: winpr_Digest_Final failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_Digest_Final failed\n", __func__);
goto out; goto out;
} }
@ -178,30 +178,30 @@ static BOOL test_crypto_hash_hmac_md5(void)
if (!(ctx = winpr_HMAC_New())) if (!(ctx = winpr_HMAC_New()))
{ {
fprintf(stderr, "%s: winpr_HMAC_New failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_New failed\n", __func__);
return FALSE; return FALSE;
} }
if (!winpr_HMAC_Init(ctx, WINPR_MD_MD5, TEST_HMAC_MD5_KEY, WINPR_MD5_DIGEST_LENGTH)) if (!winpr_HMAC_Init(ctx, WINPR_MD_MD5, TEST_HMAC_MD5_KEY, WINPR_MD5_DIGEST_LENGTH))
{ {
fprintf(stderr, "%s: winpr_HMAC_Init failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Init failed\n", __func__);
goto out; goto out;
} }
if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_MD5_DATA, if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_MD5_DATA,
strnlen(TEST_HMAC_MD5_DATA, sizeof(TEST_HMAC_MD5_DATA)))) strnlen(TEST_HMAC_MD5_DATA, sizeof(TEST_HMAC_MD5_DATA))))
{ {
fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __func__);
goto out; goto out;
} }
if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_MD5_DATA, if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_MD5_DATA,
strnlen(TEST_HMAC_MD5_DATA, sizeof(TEST_HMAC_MD5_DATA)))) strnlen(TEST_HMAC_MD5_DATA, sizeof(TEST_HMAC_MD5_DATA))))
{ {
fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __func__);
goto out; goto out;
} }
if (!winpr_HMAC_Final(ctx, hash, sizeof(hash))) if (!winpr_HMAC_Final(ctx, hash, sizeof(hash)))
{ {
fprintf(stderr, "%s: winpr_HMAC_Final failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Final failed\n", __func__);
goto out; goto out;
} }
@ -241,30 +241,30 @@ static BOOL test_crypto_hash_hmac_sha1(void)
if (!(ctx = winpr_HMAC_New())) if (!(ctx = winpr_HMAC_New()))
{ {
fprintf(stderr, "%s: winpr_HMAC_New failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_New failed\n", __func__);
return FALSE; return FALSE;
} }
if (!winpr_HMAC_Init(ctx, WINPR_MD_SHA1, TEST_HMAC_SHA1_KEY, WINPR_SHA1_DIGEST_LENGTH)) if (!winpr_HMAC_Init(ctx, WINPR_MD_SHA1, TEST_HMAC_SHA1_KEY, WINPR_SHA1_DIGEST_LENGTH))
{ {
fprintf(stderr, "%s: winpr_HMAC_Init failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Init failed\n", __func__);
goto out; goto out;
} }
if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_SHA1_DATA, if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_SHA1_DATA,
strnlen(TEST_HMAC_SHA1_DATA, sizeof(TEST_HMAC_SHA1_DATA)))) strnlen(TEST_HMAC_SHA1_DATA, sizeof(TEST_HMAC_SHA1_DATA))))
{ {
fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __func__);
goto out; goto out;
} }
if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_SHA1_DATA, if (!winpr_HMAC_Update(ctx, (const BYTE*)TEST_HMAC_SHA1_DATA,
strnlen(TEST_HMAC_SHA1_DATA, sizeof(TEST_HMAC_SHA1_DATA)))) strnlen(TEST_HMAC_SHA1_DATA, sizeof(TEST_HMAC_SHA1_DATA))))
{ {
fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Update failed\n", __func__);
goto out; goto out;
} }
if (!winpr_HMAC_Final(ctx, hash, sizeof(hash))) if (!winpr_HMAC_Final(ctx, hash, sizeof(hash)))
{ {
fprintf(stderr, "%s: winpr_HMAC_Final failed\n", __FUNCTION__); fprintf(stderr, "%s: winpr_HMAC_Final failed\n", __func__);
goto out; goto out;
} }

View File

@ -17,15 +17,15 @@ int TestLibraryGetModuleFileName(int argc, char* argv[])
len = GetModuleFileNameA(NULL, ModuleFileName, 2); len = GetModuleFileNameA(NULL, ModuleFileName, 2);
if (len != 2) if (len != 2)
{ {
printf("%s: GetModuleFileNameA unexpectedly returned %" PRIu32 " instead of 2\n", printf("%s: GetModuleFileNameA unexpectedly returned %" PRIu32 " instead of 2\n", __func__,
__FUNCTION__, len); len);
return -1; return -1;
} }
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{ {
printf("%s: Invalid last error value: 0x%08" PRIX32 printf("%s: Invalid last error value: 0x%08" PRIX32
". Expected 0x%08X (ERROR_INSUFFICIENT_BUFFER)\n", ". Expected 0x%08X (ERROR_INSUFFICIENT_BUFFER)\n",
__FUNCTION__, GetLastError(), ERROR_INSUFFICIENT_BUFFER); __func__, GetLastError(), ERROR_INSUFFICIENT_BUFFER);
return -1; return -1;
} }
@ -34,19 +34,19 @@ int TestLibraryGetModuleFileName(int argc, char* argv[])
len = GetModuleFileNameA(NULL, ModuleFileName, sizeof(ModuleFileName)); len = GetModuleFileNameA(NULL, ModuleFileName, sizeof(ModuleFileName));
if (len == 0) if (len == 0)
{ {
printf("%s: GetModuleFileNameA failed with error 0x%08" PRIX32 "\n", __FUNCTION__, printf("%s: GetModuleFileNameA failed with error 0x%08" PRIX32 "\n", __func__,
GetLastError()); GetLastError());
return -1; return -1;
} }
if (len == sizeof(ModuleFileName)) if (len == sizeof(ModuleFileName))
{ {
printf("%s: GetModuleFileNameA unexpectedly returned nSize\n", __FUNCTION__); printf("%s: GetModuleFileNameA unexpectedly returned nSize\n", __func__);
return -1; return -1;
} }
if (GetLastError() != ERROR_SUCCESS) if (GetLastError() != ERROR_SUCCESS)
{ {
printf("%s: Invalid last error value: 0x%08" PRIX32 ". Expected 0x%08X (ERROR_SUCCESS)\n", printf("%s: Invalid last error value: 0x%08" PRIX32 ". Expected 0x%08X (ERROR_SUCCESS)\n",
__FUNCTION__, GetLastError(), ERROR_SUCCESS); __func__, GetLastError(), ERROR_SUCCESS);
return -1; return -1;
} }

View File

@ -21,7 +21,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
if (!GetModuleFileNameA(NULL, LibraryPath, PATHCCH_MAX_CCH)) if (!GetModuleFileNameA(NULL, LibraryPath, PATHCCH_MAX_CCH))
{ {
printf("%s: GetModuleFilenameA failed: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); printf("%s: GetModuleFilenameA failed: 0x%08" PRIX32 "\n", __func__, GetLastError());
return -1; return -1;
} }
@ -29,7 +29,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
if (!(p = strrchr(LibraryPath, PathGetSeparatorA(PATH_STYLE_NATIVE)))) if (!(p = strrchr(LibraryPath, PathGetSeparatorA(PATH_STYLE_NATIVE))))
{ {
printf("%s: Error identifying module directory path\n", __FUNCTION__); printf("%s: Error identifying module directory path\n", __func__);
return -1; return -1;
} }
@ -37,23 +37,23 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
NativePathCchAppendA(LibraryPath, PATHCCH_MAX_CCH, "TestLibraryA"); NativePathCchAppendA(LibraryPath, PATHCCH_MAX_CCH, "TestLibraryA");
SharedLibraryExtension = PathGetSharedLibraryExtensionA(PATH_SHARED_LIB_EXT_WITH_DOT); SharedLibraryExtension = PathGetSharedLibraryExtensionA(PATH_SHARED_LIB_EXT_WITH_DOT);
NativePathCchAddExtensionA(LibraryPath, PATHCCH_MAX_CCH, SharedLibraryExtension); NativePathCchAddExtensionA(LibraryPath, PATHCCH_MAX_CCH, SharedLibraryExtension);
printf("%s: Loading Library: '%s'\n", __FUNCTION__, LibraryPath); printf("%s: Loading Library: '%s'\n", __func__, LibraryPath);
if (!(library = LoadLibraryA(LibraryPath))) if (!(library = LoadLibraryA(LibraryPath)))
{ {
printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __func__, GetLastError());
return -1; return -1;
} }
if (!(pFunctionA = (TEST_AB_FN)GetProcAddress(library, "FunctionA"))) if (!(pFunctionA = (TEST_AB_FN)GetProcAddress(library, "FunctionA")))
{ {
printf("%s: GetProcAddress failure (FunctionA)\n", __FUNCTION__); printf("%s: GetProcAddress failure (FunctionA)\n", __func__);
return -1; return -1;
} }
if (!(pFunctionB = (TEST_AB_FN)GetProcAddress(library, "FunctionB"))) if (!(pFunctionB = (TEST_AB_FN)GetProcAddress(library, "FunctionB")))
{ {
printf("%s: GetProcAddress failure (FunctionB)\n", __FUNCTION__); printf("%s: GetProcAddress failure (FunctionB)\n", __func__);
return -1; return -1;
} }
@ -63,7 +63,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
if (c != (a * b)) if (c != (a * b))
{ {
printf("%s: pFunctionA call failed\n", __FUNCTION__); printf("%s: pFunctionA call failed\n", __func__);
return -1; return -1;
} }
@ -73,13 +73,13 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
if (c != (a / b)) if (c != (a / b))
{ {
printf("%s: pFunctionB call failed\n", __FUNCTION__); printf("%s: pFunctionB call failed\n", __func__);
return -1; return -1;
} }
if (!FreeLibrary(library)) if (!FreeLibrary(library))
{ {
printf("%s: FreeLibrary failure: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); printf("%s: FreeLibrary failure: 0x%08" PRIX32 "\n", __func__, GetLastError());
return -1; return -1;
} }

View File

@ -16,7 +16,7 @@ int TestLibraryLoadLibrary(int argc, char* argv[])
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
if (!GetModuleFileNameA(NULL, LibraryPath, PATHCCH_MAX_CCH)) if (!GetModuleFileNameA(NULL, LibraryPath, PATHCCH_MAX_CCH))
{ {
printf("%s: GetModuleFilenameA failed: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); printf("%s: GetModuleFilenameA failed: 0x%08" PRIX32 "\n", __func__, GetLastError());
return -1; return -1;
} }
@ -24,7 +24,7 @@ int TestLibraryLoadLibrary(int argc, char* argv[])
if (!(p = strrchr(LibraryPath, PathGetSeparatorA(PATH_STYLE_NATIVE)))) if (!(p = strrchr(LibraryPath, PathGetSeparatorA(PATH_STYLE_NATIVE))))
{ {
printf("%s: Error identifying module directory path\n", __FUNCTION__); printf("%s: Error identifying module directory path\n", __func__);
return -1; return -1;
} }
*p = 0; *p = 0;
@ -33,17 +33,17 @@ int TestLibraryLoadLibrary(int argc, char* argv[])
SharedLibraryExtension = PathGetSharedLibraryExtensionA(PATH_SHARED_LIB_EXT_WITH_DOT); SharedLibraryExtension = PathGetSharedLibraryExtensionA(PATH_SHARED_LIB_EXT_WITH_DOT);
NativePathCchAddExtensionA(LibraryPath, PATHCCH_MAX_CCH, SharedLibraryExtension); NativePathCchAddExtensionA(LibraryPath, PATHCCH_MAX_CCH, SharedLibraryExtension);
printf("%s: Loading Library: '%s'\n", __FUNCTION__, LibraryPath); printf("%s: Loading Library: '%s'\n", __func__, LibraryPath);
if (!(library = LoadLibraryA(LibraryPath))) if (!(library = LoadLibraryA(LibraryPath)))
{ {
printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __func__, GetLastError());
return -1; return -1;
} }
if (!FreeLibrary(library)) if (!FreeLibrary(library))
{ {
printf("%s: FreeLibrary failure: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); printf("%s: FreeLibrary failure: 0x%08" PRIX32 "\n", __func__, GetLastError());
return -1; return -1;
} }

View File

@ -7,6 +7,6 @@
int TestPathAllocCanonicalize(int argc, char* argv[]) int TestPathAllocCanonicalize(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchAppendEx(int argc, char* argv[]) int TestPathCchAppendEx(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchCanonicalize(int argc, char* argv[]) int TestPathCchCanonicalize(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchCanonicalizeEx(int argc, char* argv[]) int TestPathCchCanonicalizeEx(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchCombine(int argc, char* argv[]) int TestPathCchCombine(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchCombineEx(int argc, char* argv[]) int TestPathCchCombineEx(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchIsRoot(int argc, char* argv[]) int TestPathCchIsRoot(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchRemoveBackslash(int argc, char* argv[]) int TestPathCchRemoveBackslash(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchRemoveBackslashEx(int argc, char* argv[]) int TestPathCchRemoveBackslashEx(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchRemoveExtension(int argc, char* argv[]) int TestPathCchRemoveExtension(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchRemoveFileSpec(int argc, char* argv[]) int TestPathCchRemoveFileSpec(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchRenameExtension(int argc, char* argv[]) int TestPathCchRenameExtension(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchSkipRoot(int argc, char* argv[]) int TestPathCchSkipRoot(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -7,6 +7,6 @@
int TestPathCchStripToRoot(int argc, char* argv[]) int TestPathCchStripToRoot(int argc, char* argv[])
{ {
printf("Warning: %s is not implemented!\n", __FUNCTION__); printf("Warning: %s is not implemented!\n", __func__);
return 0; return 0;
} }

View File

@ -79,6 +79,6 @@ int TestPathMakePath(int argc, char* argv[])
} }
free(path); free(path);
printf("%s success!\n", __FUNCTION__); printf("%s success!\n", __func__);
return 0; return 0;
} }

View File

@ -39,19 +39,19 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg)
if (hNamedPipe == INVALID_HANDLE_VALUE) if (hNamedPipe == INVALID_HANDLE_VALUE)
{ {
printf("%s: Named Pipe CreateFile failure: INVALID_HANDLE_VALUE\n", __FUNCTION__); printf("%s: Named Pipe CreateFile failure: INVALID_HANDLE_VALUE\n", __func__);
goto out; goto out;
} }
if (!(lpReadBuffer = (BYTE*)malloc(PIPE_BUFFER_SIZE))) if (!(lpReadBuffer = (BYTE*)malloc(PIPE_BUFFER_SIZE)))
{ {
printf("%s: Error allocating read buffer\n", __FUNCTION__); printf("%s: Error allocating read buffer\n", __func__);
goto out; goto out;
} }
if (!(lpWriteBuffer = (BYTE*)malloc(PIPE_BUFFER_SIZE))) if (!(lpWriteBuffer = (BYTE*)malloc(PIPE_BUFFER_SIZE)))
{ {
printf("%s: Error allocating write buffer\n", __FUNCTION__); printf("%s: Error allocating write buffer\n", __func__);
goto out; goto out;
} }
@ -63,7 +63,7 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg)
NULL) || NULL) ||
lpNumberOfBytesWritten != nNumberOfBytesToWrite) lpNumberOfBytesWritten != nNumberOfBytesToWrite)
{ {
printf("%s: Client NamedPipe WriteFile failure\n", __FUNCTION__); printf("%s: Client NamedPipe WriteFile failure\n", __func__);
goto out; goto out;
} }
@ -74,7 +74,7 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg)
if (!ReadFile(hNamedPipe, lpReadBuffer, nNumberOfBytesToRead, &lpNumberOfBytesRead, NULL) || if (!ReadFile(hNamedPipe, lpReadBuffer, nNumberOfBytesToRead, &lpNumberOfBytesRead, NULL) ||
lpNumberOfBytesRead != nNumberOfBytesToRead) lpNumberOfBytesRead != nNumberOfBytesToRead)
{ {
printf("%s: Client NamedPipe ReadFile failure\n", __FUNCTION__); printf("%s: Client NamedPipe ReadFile failure\n", __func__);
goto out; goto out;
} }
@ -110,13 +110,13 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg)
if (!hNamedPipe) if (!hNamedPipe)
{ {
printf("%s: CreateNamedPipe failure: NULL handle\n", __FUNCTION__); printf("%s: CreateNamedPipe failure: NULL handle\n", __func__);
goto out; goto out;
} }
if (hNamedPipe == INVALID_HANDLE_VALUE) if (hNamedPipe == INVALID_HANDLE_VALUE)
{ {
printf("%s: CreateNamedPipe failure: INVALID_HANDLE_VALUE\n", __FUNCTION__); printf("%s: CreateNamedPipe failure: INVALID_HANDLE_VALUE\n", __func__);
goto out; goto out;
} }
@ -135,19 +135,19 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg)
if (!fConnected) if (!fConnected)
{ {
printf("%s: ConnectNamedPipe failure\n", __FUNCTION__); printf("%s: ConnectNamedPipe failure\n", __func__);
goto out; goto out;
} }
if (!(lpReadBuffer = (BYTE*)calloc(1, PIPE_BUFFER_SIZE))) if (!(lpReadBuffer = (BYTE*)calloc(1, PIPE_BUFFER_SIZE)))
{ {
printf("%s: Error allocating read buffer\n", __FUNCTION__); printf("%s: Error allocating read buffer\n", __func__);
goto out; goto out;
} }
if (!(lpWriteBuffer = (BYTE*)malloc(PIPE_BUFFER_SIZE))) if (!(lpWriteBuffer = (BYTE*)malloc(PIPE_BUFFER_SIZE)))
{ {
printf("%s: Error allocating write buffer\n", __FUNCTION__); printf("%s: Error allocating write buffer\n", __func__);
goto out; goto out;
} }
@ -157,7 +157,7 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg)
if (!ReadFile(hNamedPipe, lpReadBuffer, nNumberOfBytesToRead, &lpNumberOfBytesRead, NULL) || if (!ReadFile(hNamedPipe, lpReadBuffer, nNumberOfBytesToRead, &lpNumberOfBytesRead, NULL) ||
lpNumberOfBytesRead != nNumberOfBytesToRead) lpNumberOfBytesRead != nNumberOfBytesToRead)
{ {
printf("%s: Server NamedPipe ReadFile failure\n", __FUNCTION__); printf("%s: Server NamedPipe ReadFile failure\n", __func__);
goto out; goto out;
} }
@ -171,7 +171,7 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg)
NULL) || NULL) ||
lpNumberOfBytesWritten != nNumberOfBytesToWrite) lpNumberOfBytesWritten != nNumberOfBytesToWrite)
{ {
printf("%s: Server NamedPipe WriteFile failure\n", __FUNCTION__); printf("%s: Server NamedPipe WriteFile failure\n", __func__);
goto out; goto out;
} }
@ -208,7 +208,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE,
PIPE_BUFFER_SIZE, 0, NULL))) PIPE_BUFFER_SIZE, 0, NULL)))
{ {
printf("%s: CreateNamedPipe #%d failed\n", __FUNCTION__, i); printf("%s: CreateNamedPipe #%d failed\n", __func__, i);
goto out; goto out;
} }
} }
@ -221,29 +221,28 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
if (strcmp(lpszPipeNameSt, p->name)) if (strcmp(lpszPipeNameSt, p->name))
{ {
printf("%s: Pipe name mismatch for pipe #%d ([%s] instead of [%s])\n", __FUNCTION__, i, printf("%s: Pipe name mismatch for pipe #%d ([%s] instead of [%s])\n", __func__, i,
p->name, lpszPipeNameSt); p->name, lpszPipeNameSt);
goto out; goto out;
} }
if (p->clientfd != -1) if (p->clientfd != -1)
{ {
printf("%s: Unexpected client fd value for pipe #%d (%d instead of -1)\n", __FUNCTION__, printf("%s: Unexpected client fd value for pipe #%d (%d instead of -1)\n", __func__, i,
i, p->clientfd); p->clientfd);
goto out; goto out;
} }
if (p->serverfd < 1) if (p->serverfd < 1)
{ {
printf("%s: Unexpected server fd value for pipe #%d (%d is not > 0)\n", __FUNCTION__, i, printf("%s: Unexpected server fd value for pipe #%d (%d is not > 0)\n", __func__, i,
p->serverfd); p->serverfd);
goto out; goto out;
} }
if (p->ServerMode == FALSE) if (p->ServerMode == FALSE)
{ {
printf("%s: Unexpected ServerMode value for pipe #%d (0 instead of 1)\n", __FUNCTION__, printf("%s: Unexpected ServerMode value for pipe #%d (0 instead of 1)\n", __func__, i);
i);
goto out; goto out;
} }
} }
@ -256,7 +255,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
if ((clients[i] = CreateFile(lpszPipeNameSt, GENERIC_READ | GENERIC_WRITE, 0, NULL, if ((clients[i] = CreateFile(lpszPipeNameSt, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
{ {
printf("%s: CreateFile #%d failed\n", __FUNCTION__, i); printf("%s: CreateFile #%d failed\n", __func__, i);
goto out; goto out;
} }
@ -273,8 +272,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
if (!fConnected) if (!fConnected)
{ {
printf("%s: ConnectNamedPipe #%d failed. (%" PRIu32 ")\n", __FUNCTION__, i, printf("%s: ConnectNamedPipe #%d failed. (%" PRIu32 ")\n", __func__, i, GetLastError());
GetLastError());
goto out; goto out;
} }
} }
@ -287,15 +285,14 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
if (p->clientfd < 1) if (p->clientfd < 1)
{ {
printf("%s: Unexpected client fd value for pipe #%d (%d is not > 0)\n", __FUNCTION__, i, printf("%s: Unexpected client fd value for pipe #%d (%d is not > 0)\n", __func__, i,
p->clientfd); p->clientfd);
goto out; goto out;
} }
if (p->ServerMode) if (p->ServerMode)
{ {
printf("%s: Unexpected ServerMode value for pipe #%d (1 instead of 0)\n", __FUNCTION__, printf("%s: Unexpected ServerMode value for pipe #%d (1 instead of 0)\n", __func__, i);
i);
goto out; goto out;
} }
} }
@ -311,20 +308,19 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
if (!WriteFile(clients[i], sndbuf, sizeof(sndbuf), &dwWritten, NULL) || if (!WriteFile(clients[i], sndbuf, sizeof(sndbuf), &dwWritten, NULL) ||
dwWritten != sizeof(sndbuf)) dwWritten != sizeof(sndbuf))
{ {
printf("%s: Error writing to client end of pipe #%d\n", __FUNCTION__, i); printf("%s: Error writing to client end of pipe #%d\n", __func__, i);
goto out; goto out;
} }
if (!ReadFile(servers[i], rcvbuf, dwWritten, &dwRead, NULL) || dwRead != dwWritten) if (!ReadFile(servers[i], rcvbuf, dwWritten, &dwRead, NULL) || dwRead != dwWritten)
{ {
printf("%s: Error reading on server end of pipe #%d\n", __FUNCTION__, i); printf("%s: Error reading on server end of pipe #%d\n", __func__, i);
goto out; goto out;
} }
if (memcmp(sndbuf, rcvbuf, sizeof(sndbuf))) if (memcmp(sndbuf, rcvbuf, sizeof(sndbuf)))
{ {
printf("%s: Error data read on server end of pipe #%d is corrupted\n", __FUNCTION__, printf("%s: Error data read on server end of pipe #%d is corrupted\n", __func__, i);
i);
goto out; goto out;
} }
} }
@ -339,20 +335,19 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
if (!WriteFile(servers[i], sndbuf, sizeof(sndbuf), &dwWritten, NULL) || if (!WriteFile(servers[i], sndbuf, sizeof(sndbuf), &dwWritten, NULL) ||
dwWritten != sizeof(sndbuf)) dwWritten != sizeof(sndbuf))
{ {
printf("%s: Error writing to server end of pipe #%d\n", __FUNCTION__, i); printf("%s: Error writing to server end of pipe #%d\n", __func__, i);
goto out; goto out;
} }
if (!ReadFile(clients[i], rcvbuf, dwWritten, &dwRead, NULL) || dwRead != dwWritten) if (!ReadFile(clients[i], rcvbuf, dwWritten, &dwRead, NULL) || dwRead != dwWritten)
{ {
printf("%s: Error reading on client end of pipe #%d\n", __FUNCTION__, i); printf("%s: Error reading on client end of pipe #%d\n", __func__, i);
goto out; goto out;
} }
if (memcmp(sndbuf, rcvbuf, sizeof(sndbuf))) if (memcmp(sndbuf, rcvbuf, sizeof(sndbuf)))
{ {
printf("%s: Error data read on client end of pipe #%d is corrupted\n", __FUNCTION__, printf("%s: Error data read on client end of pipe #%d is corrupted\n", __func__, i);
i);
goto out; goto out;
} }
} }
@ -372,7 +367,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
{ {
printf("%s: Error ReadFile on client should have failed after DisconnectNamedPipe on " printf("%s: Error ReadFile on client should have failed after DisconnectNamedPipe on "
"server\n", "server\n",
__FUNCTION__); __func__);
goto out; goto out;
} }
@ -381,7 +376,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
printf( printf(
"%s: Error WriteFile on client end should have failed after DisconnectNamedPipe on " "%s: Error WriteFile on client end should have failed after DisconnectNamedPipe on "
"server\n", "server\n",
__FUNCTION__); __func__);
goto out; goto out;
} }
} }
@ -403,7 +398,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
{ {
printf( printf(
"%s: Error ReadFile on client end should have failed after CloseHandle on server\n", "%s: Error ReadFile on client end should have failed after CloseHandle on server\n",
__FUNCTION__); __func__);
goto out; goto out;
} }
@ -411,7 +406,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
{ {
printf("%s: Error WriteFile on client end should have failed after CloseHandle on " printf("%s: Error WriteFile on client end should have failed after CloseHandle on "
"server\n", "server\n",
__FUNCTION__); __func__);
goto out; goto out;
} }
} }
@ -432,7 +427,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
{ {
printf( printf(
"%s: Error ReadFile on server end should have failed after CloseHandle on client\n", "%s: Error ReadFile on server end should have failed after CloseHandle on client\n",
__FUNCTION__); __func__);
goto out; goto out;
} }
@ -440,7 +435,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg)
{ {
printf("%s: Error WriteFile on server end should have failed after CloseHandle on " printf("%s: Error WriteFile on server end should have failed after CloseHandle on "
"client\n", "client\n",
__FUNCTION__); __func__);
goto out; goto out;
} }
} }

View File

@ -358,12 +358,12 @@ int TestPipeCreateNamedPipeOverlapped(int argc, char* argv[])
if (WAIT_OBJECT_0 != WaitForSingleObject(ClientThread, INFINITE)) if (WAIT_OBJECT_0 != WaitForSingleObject(ClientThread, INFINITE))
{ {
printf("%s: Failed to wait for client thread: %" PRIu32 "\n", __FUNCTION__, GetLastError()); printf("%s: Failed to wait for client thread: %" PRIu32 "\n", __func__, GetLastError());
goto out; goto out;
} }
if (WAIT_OBJECT_0 != WaitForSingleObject(ServerThread, INFINITE)) if (WAIT_OBJECT_0 != WaitForSingleObject(ServerThread, INFINITE))
{ {
printf("%s: Failed to wait for server thread: %" PRIu32 "\n", __FUNCTION__, GetLastError()); printf("%s: Failed to wait for server thread: %" PRIu32 "\n", __func__, GetLastError());
goto out; goto out;
} }
@ -383,12 +383,12 @@ out:
if (result == 0) if (result == 0)
{ {
printf("%s: Error, this test is currently expected not to succeed on this platform.\n", printf("%s: Error, this test is currently expected not to succeed on this platform.\n",
__FUNCTION__); __func__);
result = -1; result = -1;
} }
else else
{ {
printf("%s: This test is currently expected to fail on this platform.\n", __FUNCTION__); printf("%s: This test is currently expected to fail on this platform.\n", __func__);
result = 0; result = 0;
} }
#endif #endif

View File

@ -43,7 +43,7 @@
static char* NTLM_PACKAGE_NAME = "NTLM"; static char* NTLM_PACKAGE_NAME = "NTLM";
#define check_context(ctx) check_context_((ctx), __FILE__, __FUNCTION__, __LINE__) #define check_context(ctx) check_context_((ctx), __FILE__, __func__, __LINE__)
static BOOL check_context_(NTLM_CONTEXT* context, const char* file, const char* fkt, size_t line) static BOOL check_context_(NTLM_CONTEXT* context, const char* file, const char* fkt, size_t line)
{ {
BOOL rc = TRUE; BOOL rc = TRUE;

View File

@ -38,7 +38,7 @@
#define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, what) \ #define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, what) \
Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, 1, "%s(%s:%" PRIuz ") " what, \ Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, 1, "%s(%s:%" PRIuz ") " what, \
__FUNCTION__, __FILE__, (size_t)__LINE__) __func__, __FILE__, (size_t)__LINE__)
static char NTLM_CLIENT_SIGN_MAGIC[] = "session key to client-to-server signing key magic constant"; static char NTLM_CLIENT_SIGN_MAGIC[] = "session key to client-to-server signing key magic constant";
static char NTLM_SERVER_SIGN_MAGIC[] = "session key to server-to-client signing key magic constant"; static char NTLM_SERVER_SIGN_MAGIC[] = "session key to server-to-client signing key magic constant";
@ -111,7 +111,7 @@ BOOL ntlm_write_version_info(wStream* s, const NTLM_VERSION_INFO* versionInfo)
if (!Stream_CheckAndLogRequiredCapacityEx( if (!Stream_CheckAndLogRequiredCapacityEx(
TAG, WLOG_WARN, s, 5ull + sizeof(versionInfo->Reserved), 1ull, TAG, WLOG_WARN, s, 5ull + sizeof(versionInfo->Reserved), 1ull,
"%s(%s:%" PRIuz ") NTLM_VERSION_INFO", __FUNCTION__, __FILE__, (size_t)__LINE__)) "%s(%s:%" PRIuz ") NTLM_VERSION_INFO", __func__, __FILE__, (size_t)__LINE__))
return FALSE; return FALSE;
Stream_Write_UINT8(s, versionInfo->ProductMajorVersion); /* ProductMajorVersion (1 byte) */ Stream_Write_UINT8(s, versionInfo->ProductMajorVersion); /* ProductMajorVersion (1 byte) */

View File

@ -37,7 +37,7 @@
#define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, what) \ #define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, what) \
Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, 1, "%s(%s:%" PRIuz ") " what, \ Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, 1, "%s(%s:%" PRIuz ") " what, \
__FUNCTION__, __FILE__, (size_t)__LINE__) __func__, __FILE__, (size_t)__LINE__)
static const char NTLM_SIGNATURE[8] = { 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' }; static const char NTLM_SIGNATURE[8] = { 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' };
@ -436,7 +436,7 @@ static BOOL ntlm_write_negotiate_flags(wStream* s, UINT32 flags, const char* nam
WINPR_ASSERT(name); WINPR_ASSERT(name);
if (!Stream_CheckAndLogRequiredCapacityEx(TAG, WLOG_WARN, s, 4ull, 1ull, if (!Stream_CheckAndLogRequiredCapacityEx(TAG, WLOG_WARN, s, 4ull, 1ull,
"%s(%s:%" PRIuz ") %s::NegotiateFlags", __FUNCTION__, "%s(%s:%" PRIuz ") %s::NegotiateFlags", __func__,
__FILE__, (size_t)__LINE__, name)) __FILE__, (size_t)__LINE__, name))
return FALSE; return FALSE;

View File

@ -74,17 +74,17 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo
expectedFalseCount = dwLoops * (dwThreads - 1); expectedFalseCount = dwLoops * (dwThreads - 1);
printf("%s: >> Testing with flags 0x%08" PRIx32 ". Using %" PRIu32 printf("%s: >> Testing with flags 0x%08" PRIx32 ". Using %" PRIu32
" threads performing %" PRIu32 " loops\n", " threads performing %" PRIu32 " loops\n",
__FUNCTION__, dwFlags, dwThreads, dwLoops); __func__, dwFlags, dwThreads, dwLoops);
if (!(threads = calloc(dwThreads, sizeof(HANDLE)))) if (!(threads = calloc(dwThreads, sizeof(HANDLE))))
{ {
printf("%s: error allocatin thread array memory\n", __FUNCTION__); printf("%s: error allocatin thread array memory\n", __func__);
return FALSE; return FALSE;
} }
if (!InitializeSynchronizationBarrier(&gBarrier, dwThreads, -1)) if (!InitializeSynchronizationBarrier(&gBarrier, dwThreads, -1))
{ {
printf("%s: InitializeSynchronizationBarrier failed. GetLastError() = 0x%08x", __FUNCTION__, printf("%s: InitializeSynchronizationBarrier failed. GetLastError() = 0x%08x", __func__,
GetLastError()); GetLastError());
free(threads); free(threads);
DeleteSynchronizationBarrier(&gBarrier); DeleteSynchronizationBarrier(&gBarrier);
@ -93,7 +93,7 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo
if (!(gStartEvent = CreateEvent(NULL, TRUE, FALSE, NULL))) if (!(gStartEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{ {
printf("%s: CreateEvent failed with error 0x%08x", __FUNCTION__, GetLastError()); printf("%s: CreateEvent failed with error 0x%08x", __func__, GetLastError());
free(threads); free(threads);
DeleteSynchronizationBarrier(&gBarrier); DeleteSynchronizationBarrier(&gBarrier);
return FALSE; return FALSE;
@ -103,8 +103,8 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo
{ {
if (!(threads[i] = CreateThread(NULL, 0, test_synch_barrier_thread, &p, 0, NULL))) if (!(threads[i] = CreateThread(NULL, 0, test_synch_barrier_thread, &p, 0, NULL)))
{ {
printf("%s: CreateThread failed for thread #%" PRIu32 " with error 0x%08x\n", printf("%s: CreateThread failed for thread #%" PRIu32 " with error 0x%08x\n", __func__,
__FUNCTION__, i, GetLastError()); i, GetLastError());
InterlockedIncrement(&gErrorCount); InterlockedIncrement(&gErrorCount);
break; break;
} }
@ -114,7 +114,7 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo
{ {
if (!SetEvent(gStartEvent)) if (!SetEvent(gStartEvent))
{ {
printf("%s: SetEvent(gStartEvent) failed with error = 0x%08x)\n", __FUNCTION__, printf("%s: SetEvent(gStartEvent) failed with error = 0x%08x)\n", __func__,
GetLastError()); GetLastError());
InterlockedIncrement(&gErrorCount); InterlockedIncrement(&gErrorCount);
} }
@ -125,14 +125,14 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo
{ {
printf("%s: WaitForSingleObject(thread[%" PRIu32 "] unexpectedly returned %" PRIu32 printf("%s: WaitForSingleObject(thread[%" PRIu32 "] unexpectedly returned %" PRIu32
" (error = 0x%08x)\n", " (error = 0x%08x)\n",
__FUNCTION__, i, dwStatus, GetLastError()); __func__, i, dwStatus, GetLastError());
InterlockedIncrement(&gErrorCount); InterlockedIncrement(&gErrorCount);
} }
if (!CloseHandle(threads[i])) if (!CloseHandle(threads[i]))
{ {
printf("%s: CloseHandle(thread[%" PRIu32 "]) failed with error = 0x%08x)\n", printf("%s: CloseHandle(thread[%" PRIu32 "]) failed with error = 0x%08x)\n",
__FUNCTION__, i, GetLastError()); __func__, i, GetLastError());
InterlockedIncrement(&gErrorCount); InterlockedIncrement(&gErrorCount);
} }
} }
@ -142,7 +142,7 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo
if (!CloseHandle(gStartEvent)) if (!CloseHandle(gStartEvent))
{ {
printf("%s: CloseHandle(gStartEvent) failed with error = 0x%08x)\n", __FUNCTION__, printf("%s: CloseHandle(gStartEvent) failed with error = 0x%08x)\n", __func__,
GetLastError()); GetLastError());
InterlockedIncrement(&gErrorCount); InterlockedIncrement(&gErrorCount);
} }
@ -158,18 +158,17 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo
if (p.falseCount != (INT64)expectedFalseCount) if (p.falseCount != (INT64)expectedFalseCount)
InterlockedIncrement(&gErrorCount); InterlockedIncrement(&gErrorCount);
printf("%s: error count: %" PRId32 "\n", __FUNCTION__, gErrorCount); printf("%s: error count: %" PRId32 "\n", __func__, gErrorCount);
printf("%s: thread count: %" PRId32 " (expected %" PRIu32 ")\n", __FUNCTION__, p.threadCount, printf("%s: thread count: %" PRId32 " (expected %" PRIu32 ")\n", __func__, p.threadCount,
dwThreads); dwThreads);
printf("%s: true count: %" PRId32 " (expected %" PRIu32 ")\n", __FUNCTION__, p.trueCount, printf("%s: true count: %" PRId32 " (expected %" PRIu32 ")\n", __func__, p.trueCount,
expectedTrueCount); expectedTrueCount);
printf("%s: false count: %" PRId32 " (expected %" PRIu32 ")\n", __FUNCTION__, p.falseCount, printf("%s: false count: %" PRId32 " (expected %" PRIu32 ")\n", __func__, p.falseCount,
expectedFalseCount); expectedFalseCount);
if (gErrorCount > 0) if (gErrorCount > 0)
{ {
printf("%s: Error test failed with %" PRId32 " reported errors\n", __FUNCTION__, printf("%s: Error test failed with %" PRId32 " reported errors\n", __func__, gErrorCount);
gErrorCount);
return FALSE; return FALSE;
} }
@ -187,7 +186,7 @@ int TestSynchBarrier(int argc, char* argv[])
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
GetNativeSystemInfo(&sysinfo); GetNativeSystemInfo(&sysinfo);
printf("%s: Number of processors: %" PRIu32 "\n", __FUNCTION__, sysinfo.dwNumberOfProcessors); printf("%s: Number of processors: %" PRIu32 "\n", __func__, sysinfo.dwNumberOfProcessors);
dwMinThreads = sysinfo.dwNumberOfProcessors; dwMinThreads = sysinfo.dwNumberOfProcessors;
dwMaxThreads = sysinfo.dwNumberOfProcessors * 4; dwMaxThreads = sysinfo.dwNumberOfProcessors * 4;
@ -200,7 +199,7 @@ int TestSynchBarrier(int argc, char* argv[])
fprintf( fprintf(
stderr, stderr,
"%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = 0\n", "%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = 0\n",
__FUNCTION__); __func__);
return -1; return -1;
} }
@ -209,7 +208,7 @@ int TestSynchBarrier(int argc, char* argv[])
fprintf( fprintf(
stderr, stderr,
"%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = -1\n", "%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__); __func__);
return -1; return -1;
} }
@ -218,7 +217,7 @@ int TestSynchBarrier(int argc, char* argv[])
fprintf( fprintf(
stderr, stderr,
"%s: InitializeSynchronizationBarrier unecpectedly succeeded with lSpinCount = -2\n", "%s: InitializeSynchronizationBarrier unecpectedly succeeded with lSpinCount = -2\n",
__FUNCTION__); __func__);
return -1; return -1;
} }
@ -228,7 +227,7 @@ int TestSynchBarrier(int argc, char* argv[])
{ {
fprintf(stderr, fprintf(stderr,
"%s: TestSynchBarrierWithFlags(0) unecpectedly succeeded with lTotalThreads = -1\n", "%s: TestSynchBarrierWithFlags(0) unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__); __func__);
return -1; return -1;
} }
@ -238,7 +237,7 @@ int TestSynchBarrier(int argc, char* argv[])
fprintf(stderr, fprintf(stderr,
"%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY) " "%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY) "
"unecpectedly succeeded with lTotalThreads = -1\n", "unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__); __func__);
return -1; return -1;
} }
@ -248,10 +247,10 @@ int TestSynchBarrier(int argc, char* argv[])
fprintf(stderr, fprintf(stderr,
"%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY) " "%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY) "
"unecpectedly succeeded with lTotalThreads = -1\n", "unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__); __func__);
return -1; return -1;
} }
printf("%s: Test successfully completed\n", __FUNCTION__); printf("%s: Test successfully completed\n", __func__);
return 0; return 0;
} }

View File

@ -35,7 +35,7 @@ static BOOL CALLBACK TestOnceFunction(PINIT_ONCE once, PVOID param, PVOID* conte
{ {
return TRUE; return TRUE;
} }
fprintf(stderr, "%s: error: called again after success\n", __FUNCTION__); fprintf(stderr, "%s: error: called again after success\n", __func__);
InterlockedIncrement(pErrors); InterlockedIncrement(pErrors);
return FALSE; return FALSE;
} }
@ -50,7 +50,7 @@ static DWORD WINAPI TestThreadFunction(LPVOID lpParam)
InterlockedIncrement(pTestThreadFunctionCalls); InterlockedIncrement(pTestThreadFunctionCalls);
if (WaitForSingleObject(hStartEvent, INFINITE) != WAIT_OBJECT_0) if (WaitForSingleObject(hStartEvent, INFINITE) != WAIT_OBJECT_0)
{ {
fprintf(stderr, "%s: error: failed to wait for start event\n", __FUNCTION__); fprintf(stderr, "%s: error: failed to wait for start event\n", __func__);
InterlockedIncrement(pErrors); InterlockedIncrement(pErrors);
return 0; return 0;
} }
@ -59,7 +59,7 @@ static DWORD WINAPI TestThreadFunction(LPVOID lpParam)
calls = InterlockedIncrement(pInitOnceExecuteOnceCalls); calls = InterlockedIncrement(pInitOnceExecuteOnceCalls);
if (!ok && calls > TEST_NUM_FAILURES) if (!ok && calls > TEST_NUM_FAILURES)
{ {
fprintf(stderr, "%s: InitOnceExecuteOnce failed unexpectedly\n", __FUNCTION__); fprintf(stderr, "%s: InitOnceExecuteOnce failed unexpectedly\n", __func__);
InterlockedIncrement(pErrors); InterlockedIncrement(pErrors);
} }
return 0; return 0;

View File

@ -26,7 +26,7 @@ static int start_threads(DWORD count, HANDLE* threads)
if (!threads[i]) if (!threads[i])
{ {
fprintf(stderr, "%s: CreateThread [%" PRIu32 "] failure\n", __FUNCTION__, i); fprintf(stderr, "%s: CreateThread [%" PRIu32 "] failure\n", __func__, i);
return -1; return -1;
} }
} }
@ -48,7 +48,7 @@ static int close_threads(DWORD count, HANDLE* threads)
if (!CloseHandle(threads[i])) if (!CloseHandle(threads[i]))
{ {
fprintf(stderr, "%s: CloseHandle [%" PRIu32 "] failure\n", __FUNCTION__, i); fprintf(stderr, "%s: CloseHandle [%" PRIu32 "] failure\n", __func__, i);
rc = -1; rc = -1;
} }
threads[i] = NULL; threads[i] = NULL;
@ -65,7 +65,7 @@ static BOOL TestWaitForAll(void)
/* WaitForAll, timeout */ /* WaitForAll, timeout */
if (start_threads(THREADS, threads)) if (start_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail; goto fail;
} }
@ -73,13 +73,13 @@ static BOOL TestWaitForAll(void)
if (ret != WAIT_TIMEOUT) if (ret != WAIT_TIMEOUT)
{ {
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 50 failed, ret=%d\n", fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 50 failed, ret=%d\n",
__FUNCTION__, ret); __func__, ret);
goto fail; goto fail;
} }
if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0) if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{ {
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __FUNCTION__); fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail; goto fail;
} }
@ -87,7 +87,7 @@ static BOOL TestWaitForAll(void)
fail: fail:
if (close_threads(THREADS, threads)) if (close_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE; return FALSE;
} }
@ -102,20 +102,20 @@ static BOOL TestWaitOne(void)
/* WaitForAll, timeout */ /* WaitForAll, timeout */
if (start_threads(THREADS, threads)) if (start_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail; goto fail;
} }
ret = WaitForMultipleObjects(THREADS, threads, FALSE, INFINITE); ret = WaitForMultipleObjects(THREADS, threads, FALSE, INFINITE);
if (ret > (WAIT_OBJECT_0 + THREADS)) if (ret > (WAIT_OBJECT_0 + THREADS))
{ {
fprintf(stderr, "%s: WaitForMultipleObjects INFINITE failed\n", __FUNCTION__); fprintf(stderr, "%s: WaitForMultipleObjects INFINITE failed\n", __func__);
goto fail; goto fail;
} }
if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0) if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{ {
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __FUNCTION__); fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail; goto fail;
} }
@ -123,7 +123,7 @@ static BOOL TestWaitOne(void)
fail: fail:
if (close_threads(THREADS, threads)) if (close_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE; return FALSE;
} }
@ -138,28 +138,27 @@ static BOOL TestWaitOneTimeout(void)
/* WaitForAll, timeout */ /* WaitForAll, timeout */
if (start_threads(THREADS, threads)) if (start_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail; goto fail;
} }
ret = WaitForMultipleObjects(THREADS, threads, FALSE, 1); ret = WaitForMultipleObjects(THREADS, threads, FALSE, 1);
if (ret != WAIT_TIMEOUT) if (ret != WAIT_TIMEOUT)
{ {
fprintf(stderr, "%s: WaitForMultipleObjects timeout 50 failed, ret=%d\n", __FUNCTION__, fprintf(stderr, "%s: WaitForMultipleObjects timeout 50 failed, ret=%d\n", __func__, ret);
ret);
goto fail; goto fail;
} }
if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0) if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{ {
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __FUNCTION__); fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail; goto fail;
} }
rc = TRUE; rc = TRUE;
fail: fail:
if (close_threads(THREADS, threads)) if (close_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE; return FALSE;
} }
@ -174,7 +173,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
/* WaitForAll, timeout */ /* WaitForAll, timeout */
if (start_threads(THREADS, threads)) if (start_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail; goto fail;
} }
@ -183,15 +182,14 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
ret = WaitForMultipleObjects(THREADS, threads, FALSE, 0); ret = WaitForMultipleObjects(THREADS, threads, FALSE, 0);
if (ret != WAIT_TIMEOUT) if (ret != WAIT_TIMEOUT)
{ {
fprintf(stderr, "%s: WaitForMultipleObjects timeout 0 failed, ret=%d\n", __FUNCTION__, fprintf(stderr, "%s: WaitForMultipleObjects timeout 0 failed, ret=%d\n", __func__, ret);
ret);
goto fail; goto fail;
} }
} }
if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0) if (WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE) != WAIT_OBJECT_0)
{ {
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __FUNCTION__); fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, INFINITE failed\n", __func__);
goto fail; goto fail;
} }
@ -199,7 +197,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void)
fail: fail:
if (close_threads(THREADS, threads)) if (close_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE; return FALSE;
} }
@ -213,7 +211,7 @@ static BOOL TestDetach(void)
/* WaitForAll, timeout */ /* WaitForAll, timeout */
if (start_threads(THREADS, threads)) if (start_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: start_threads failed\n", __func__);
goto fail; goto fail;
} }
@ -221,7 +219,7 @@ static BOOL TestDetach(void)
fail: fail:
if (close_threads(THREADS, threads)) if (close_threads(THREADS, threads))
{ {
fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); fprintf(stderr, "%s: close_threads failed\n", __func__);
return FALSE; return FALSE;
} }

View File

@ -10,7 +10,7 @@ static BOOL test_mutex_basic(void)
if (!(mutex = CreateMutex(NULL, FALSE, NULL))) if (!(mutex = CreateMutex(NULL, FALSE, NULL)))
{ {
printf("%s: CreateMutex failed\n", __FUNCTION__); printf("%s: CreateMutex failed\n", __func__);
return FALSE; return FALSE;
} }
@ -18,25 +18,25 @@ static BOOL test_mutex_basic(void)
if (rc != WAIT_OBJECT_0) if (rc != WAIT_OBJECT_0)
{ {
printf("%s: WaitForSingleObject on mutex failed with %" PRIu32 "\n", __FUNCTION__, rc); printf("%s: WaitForSingleObject on mutex failed with %" PRIu32 "\n", __func__, rc);
return FALSE; return FALSE;
} }
if (!ReleaseMutex(mutex)) if (!ReleaseMutex(mutex))
{ {
printf("%s: ReleaseMutex failed\n", __FUNCTION__); printf("%s: ReleaseMutex failed\n", __func__);
return FALSE; return FALSE;
} }
if (ReleaseMutex(mutex)) if (ReleaseMutex(mutex))
{ {
printf("%s: ReleaseMutex unexpectedly succeeded on released mutex\n", __FUNCTION__); printf("%s: ReleaseMutex unexpectedly succeeded on released mutex\n", __func__);
return FALSE; return FALSE;
} }
if (!CloseHandle(mutex)) if (!CloseHandle(mutex))
{ {
printf("%s: CloseHandle on mutex failed\n", __FUNCTION__); printf("%s: CloseHandle on mutex failed\n", __func__);
return FALSE; return FALSE;
} }
@ -50,7 +50,7 @@ static BOOL test_mutex_recursive(void)
if (!(mutex = CreateMutex(NULL, TRUE, NULL))) if (!(mutex = CreateMutex(NULL, TRUE, NULL)))
{ {
printf("%s: CreateMutex failed\n", __FUNCTION__); printf("%s: CreateMutex failed\n", __func__);
return FALSE; return FALSE;
} }
@ -61,7 +61,7 @@ static BOOL test_mutex_recursive(void)
if (rc != WAIT_OBJECT_0) if (rc != WAIT_OBJECT_0)
{ {
printf("%s: WaitForSingleObject #%" PRIu32 " on mutex failed with %" PRIu32 "\n", printf("%s: WaitForSingleObject #%" PRIu32 " on mutex failed with %" PRIu32 "\n",
__FUNCTION__, i, rc); __func__, i, rc);
return FALSE; return FALSE;
} }
} }
@ -70,7 +70,7 @@ static BOOL test_mutex_recursive(void)
{ {
if (!ReleaseMutex(mutex)) if (!ReleaseMutex(mutex))
{ {
printf("%s: ReleaseMutex #%" PRIu32 " failed\n", __FUNCTION__, i); printf("%s: ReleaseMutex #%" PRIu32 " failed\n", __func__, i);
return FALSE; return FALSE;
} }
} }
@ -78,19 +78,19 @@ static BOOL test_mutex_recursive(void)
if (!ReleaseMutex(mutex)) if (!ReleaseMutex(mutex))
{ {
/* Note: The mutex was initially owned ! */ /* Note: The mutex was initially owned ! */
printf("%s: Final ReleaseMutex failed\n", __FUNCTION__); printf("%s: Final ReleaseMutex failed\n", __func__);
return FALSE; return FALSE;
} }
if (ReleaseMutex(mutex)) if (ReleaseMutex(mutex))
{ {
printf("%s: ReleaseMutex unexpectedly succeeded on released mutex\n", __FUNCTION__); printf("%s: ReleaseMutex unexpectedly succeeded on released mutex\n", __func__);
return FALSE; return FALSE;
} }
if (!CloseHandle(mutex)) if (!CloseHandle(mutex))
{ {
printf("%s: CloseHandle on mutex failed\n", __FUNCTION__); printf("%s: CloseHandle on mutex failed\n", __func__);
return FALSE; return FALSE;
} }
@ -108,7 +108,7 @@ static DWORD WINAPI test_mutex_thread1(LPVOID lpParam)
if (WaitForSingleObject(hStartEvent, INFINITE) != WAIT_OBJECT_0) if (WaitForSingleObject(hStartEvent, INFINITE) != WAIT_OBJECT_0)
{ {
fprintf(stderr, "%s: failed to wait for start event\n", __FUNCTION__); fprintf(stderr, "%s: failed to wait for start event\n", __func__);
return 0; return 0;
} }
@ -127,7 +127,7 @@ static DWORD WINAPI test_mutex_thread1(LPVOID lpParam)
fprintf(stderr, fprintf(stderr,
"%s: WaitForSingleObject on thread1_mutex1 unexpectedly returned %" PRIu32 "%s: WaitForSingleObject on thread1_mutex1 unexpectedly returned %" PRIu32
" instead of WAIT_TIMEOUT (%u)\n", " instead of WAIT_TIMEOUT (%u)\n",
__FUNCTION__, rc, WAIT_TIMEOUT); __func__, rc, WAIT_TIMEOUT);
return 0; return 0;
} }
@ -138,13 +138,13 @@ static DWORD WINAPI test_mutex_thread1(LPVOID lpParam)
fprintf(stderr, fprintf(stderr,
"%s: WaitForSingleObject on thread1_mutex2 unexpectedly returned %" PRIu32 "%s: WaitForSingleObject on thread1_mutex2 unexpectedly returned %" PRIu32
" instead of WAIT_OBJECT_0\n", " instead of WAIT_OBJECT_0\n",
__FUNCTION__, rc); __func__, rc);
return 0; return 0;
} }
if (!ReleaseMutex(thread1_mutex2)) if (!ReleaseMutex(thread1_mutex2))
{ {
fprintf(stderr, "%s: ReleaseMutex failed on thread1_mutex2\n", __FUNCTION__); fprintf(stderr, "%s: ReleaseMutex failed on thread1_mutex2\n", __func__);
return 0; return 0;
} }
@ -159,19 +159,19 @@ static BOOL test_mutex_threading(void)
if (!(thread1_mutex1 = CreateMutex(NULL, TRUE, NULL))) if (!(thread1_mutex1 = CreateMutex(NULL, TRUE, NULL)))
{ {
printf("%s: CreateMutex thread1_mutex1 failed\n", __FUNCTION__); printf("%s: CreateMutex thread1_mutex1 failed\n", __func__);
goto fail; goto fail;
} }
if (!(thread1_mutex2 = CreateMutex(NULL, FALSE, NULL))) if (!(thread1_mutex2 = CreateMutex(NULL, FALSE, NULL)))
{ {
printf("%s: CreateMutex thread1_mutex2 failed\n", __FUNCTION__); printf("%s: CreateMutex thread1_mutex2 failed\n", __func__);
goto fail; goto fail;
} }
if (!(hStartEvent = CreateEvent(NULL, TRUE, FALSE, NULL))) if (!(hStartEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{ {
fprintf(stderr, "%s: error creating start event\n", __FUNCTION__); fprintf(stderr, "%s: error creating start event\n", __func__);
goto fail; goto fail;
} }
@ -179,7 +179,7 @@ static BOOL test_mutex_threading(void)
if (!(hThread = CreateThread(NULL, 0, test_mutex_thread1, (LPVOID)hStartEvent, 0, NULL))) if (!(hThread = CreateThread(NULL, 0, test_mutex_thread1, (LPVOID)hStartEvent, 0, NULL)))
{ {
fprintf(stderr, "%s: error creating test_mutex_thread_1\n", __FUNCTION__); fprintf(stderr, "%s: error creating test_mutex_thread_1\n", __func__);
goto fail; goto fail;
} }
@ -187,7 +187,7 @@ static BOOL test_mutex_threading(void)
if (!thread1_failed) if (!thread1_failed)
{ {
fprintf(stderr, "%s: thread1 premature success\n", __FUNCTION__); fprintf(stderr, "%s: thread1 premature success\n", __func__);
goto fail; goto fail;
} }
@ -195,13 +195,13 @@ static BOOL test_mutex_threading(void)
if (WaitForSingleObject(hThread, 2000) != WAIT_OBJECT_0) if (WaitForSingleObject(hThread, 2000) != WAIT_OBJECT_0)
{ {
fprintf(stderr, "%s: thread1 premature success\n", __FUNCTION__); fprintf(stderr, "%s: thread1 premature success\n", __func__);
goto fail; goto fail;
} }
if (thread1_failed) if (thread1_failed)
{ {
fprintf(stderr, "%s: thread1 has not reported success\n", __FUNCTION__); fprintf(stderr, "%s: thread1 has not reported success\n", __func__);
goto fail; goto fail;
} }
@ -212,13 +212,13 @@ static BOOL test_mutex_threading(void)
if (!ReleaseMutex(thread1_mutex1)) if (!ReleaseMutex(thread1_mutex1))
{ {
printf("%s: ReleaseMutex unexpectedly failed on thread1_mutex1\n", __FUNCTION__); printf("%s: ReleaseMutex unexpectedly failed on thread1_mutex1\n", __func__);
goto fail; goto fail;
} }
if (ReleaseMutex(thread1_mutex2)) if (ReleaseMutex(thread1_mutex2))
{ {
printf("%s: ReleaseMutex unexpectedly succeeded on thread1_mutex2\n", __FUNCTION__); printf("%s: ReleaseMutex unexpectedly succeeded on thread1_mutex2\n", __func__);
goto fail; goto fail;
} }

View File

@ -39,14 +39,14 @@ static BOOL Test_GetComputerName(void)
if (GetComputerNameA(NULL, &dwSize) == TRUE) if (GetComputerNameA(NULL, &dwSize) == TRUE)
{ {
fprintf(stderr, "%s: (1) GetComputerNameA unexpectedly succeeded with null buffer\n", fprintf(stderr, "%s: (1) GetComputerNameA unexpectedly succeeded with null buffer\n",
__FUNCTION__); __func__);
return FALSE; return FALSE;
} }
if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW) if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (2) GetLastError returned 0x%08" PRIX32 " (expected ERROR_BUFFER_OVERFLOW)\n", "%s: (2) GetLastError returned 0x%08" PRIX32 " (expected ERROR_BUFFER_OVERFLOW)\n",
__FUNCTION__, dwError); __func__, dwError);
return FALSE; return FALSE;
} }
@ -56,14 +56,14 @@ static BOOL Test_GetComputerName(void)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (3) GetComputerNameA unexpectedly succeeded with zero size parameter\n", "%s: (3) GetComputerNameA unexpectedly succeeded with zero size parameter\n",
__FUNCTION__); __func__);
return FALSE; return FALSE;
} }
if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW) if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (4) GetLastError returned 0x%08" PRIX32 " (expected ERROR_BUFFER_OVERFLOW)\n", "%s: (4) GetLastError returned 0x%08" PRIX32 " (expected ERROR_BUFFER_OVERFLOW)\n",
__FUNCTION__, dwError); __func__, dwError);
return FALSE; return FALSE;
} }
/* check if returned size is valid: must be the size of the buffer required, including the /* check if returned size is valid: must be the size of the buffer required, including the
@ -73,7 +73,7 @@ static BOOL Test_GetComputerName(void)
fprintf(stderr, fprintf(stderr,
"%s: (5) GetComputerNameA returned wrong size %" PRIu32 "%s: (5) GetComputerNameA returned wrong size %" PRIu32
" (expected something in the range from 2 to %" PRIu32 ")\n", " (expected something in the range from 2 to %" PRIu32 ")\n",
__FUNCTION__, dwSize, netbiosBufferSize); __func__, dwSize, netbiosBufferSize);
return FALSE; return FALSE;
} }
dwNameLength = dwSize - 1; dwNameLength = dwSize - 1;
@ -81,8 +81,8 @@ static BOOL Test_GetComputerName(void)
/* test with returned size */ /* test with returned size */
if (GetComputerNameA(netbiosName1, &dwSize) == FALSE) if (GetComputerNameA(netbiosName1, &dwSize) == FALSE)
{ {
fprintf(stderr, "%s: (6) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", fprintf(stderr, "%s: (6) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", __func__,
__FUNCTION__, GetLastError()); GetLastError());
return FALSE; return FALSE;
} }
/* check if returned size is valid */ /* check if returned size is valid */
@ -90,13 +90,13 @@ static BOOL Test_GetComputerName(void)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (7) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n", "%s: (7) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n",
__FUNCTION__, dwSize, dwNameLength); __func__, dwSize, dwNameLength);
return FALSE; return FALSE;
} }
/* check if string is correctly terminated */ /* check if string is correctly terminated */
if (netbiosName1[dwSize] != 0) if (netbiosName1[dwSize] != 0)
{ {
fprintf(stderr, "%s: (8) string termination error\n", __FUNCTION__); fprintf(stderr, "%s: (8) string termination error\n", __func__);
return FALSE; return FALSE;
} }
@ -104,8 +104,8 @@ static BOOL Test_GetComputerName(void)
dwSize = netbiosBufferSize; dwSize = netbiosBufferSize;
if (GetComputerNameA(netbiosName2, &dwSize) == FALSE) if (GetComputerNameA(netbiosName2, &dwSize) == FALSE)
{ {
fprintf(stderr, "%s: (9) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", fprintf(stderr, "%s: (9) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", __func__,
__FUNCTION__, GetLastError()); GetLastError());
return FALSE; return FALSE;
} }
/* check if returned size is valid */ /* check if returned size is valid */
@ -114,20 +114,20 @@ static BOOL Test_GetComputerName(void)
fprintf(stderr, fprintf(stderr,
"%s: (10) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32 "%s: (10) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32
")\n", ")\n",
__FUNCTION__, dwSize, dwNameLength); __func__, dwSize, dwNameLength);
return FALSE; return FALSE;
} }
/* check if string is correctly terminated */ /* check if string is correctly terminated */
if (netbiosName2[dwSize] != 0) if (netbiosName2[dwSize] != 0)
{ {
fprintf(stderr, "%s: (11) string termination error\n", __FUNCTION__); fprintf(stderr, "%s: (11) string termination error\n", __func__);
return FALSE; return FALSE;
} }
/* compare the results */ /* compare the results */
if (strcmp(netbiosName1, netbiosName2)) if (strcmp(netbiosName1, netbiosName2))
{ {
fprintf(stderr, "%s: (12) string compare mismatch\n", __FUNCTION__); fprintf(stderr, "%s: (12) string compare mismatch\n", __func__);
return FALSE; return FALSE;
} }
@ -137,7 +137,7 @@ static BOOL Test_GetComputerName(void)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (13) GetComputerNameA unexpectedly succeeded with limited buffer size\n", "%s: (13) GetComputerNameA unexpectedly succeeded with limited buffer size\n",
__FUNCTION__); __func__);
return FALSE; return FALSE;
} }
/* check if returned size is valid */ /* check if returned size is valid */
@ -146,7 +146,7 @@ static BOOL Test_GetComputerName(void)
fprintf(stderr, fprintf(stderr,
"%s: (14) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32 "%s: (14) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32
")\n", ")\n",
__FUNCTION__, dwSize, dwNameLength + 1); __func__, dwSize, dwNameLength + 1);
return FALSE; return FALSE;
} }
@ -214,14 +214,14 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
if (GetComputerNameExA(format, NULL, &dwSize) == TRUE) if (GetComputerNameExA(format, NULL, &dwSize) == TRUE)
{ {
fprintf(stderr, "%s: (1/%d) GetComputerNameExA unexpectedly succeeded with null buffer\n", fprintf(stderr, "%s: (1/%d) GetComputerNameExA unexpectedly succeeded with null buffer\n",
__FUNCTION__, format); __func__, format);
return FALSE; return FALSE;
} }
if ((dwError = GetLastError()) != ERROR_MORE_DATA) if ((dwError = GetLastError()) != ERROR_MORE_DATA)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (2/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n", "%s: (2/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n",
__FUNCTION__, format, dwError); __func__, format, dwError);
return FALSE; return FALSE;
} }
@ -231,14 +231,14 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (3/%d) GetComputerNameExA unexpectedly succeeded with zero size parameter\n", "%s: (3/%d) GetComputerNameExA unexpectedly succeeded with zero size parameter\n",
__FUNCTION__, format); __func__, format);
return FALSE; return FALSE;
} }
if ((dwError = GetLastError()) != ERROR_MORE_DATA) if ((dwError = GetLastError()) != ERROR_MORE_DATA)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (4/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n", "%s: (4/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n",
__FUNCTION__, format, dwError); __func__, format, dwError);
return FALSE; return FALSE;
} }
/* check if returned size is valid: must be the size of the buffer required, including the /* check if returned size is valid: must be the size of the buffer required, including the
@ -248,7 +248,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
fprintf(stderr, fprintf(stderr,
"%s: (5/%d) GetComputerNameExA returned wrong size %" PRIu32 "%s: (5/%d) GetComputerNameExA returned wrong size %" PRIu32
" (expected something in the range from %" PRIu32 " to %" PRIu32 ")\n", " (expected something in the range from %" PRIu32 " to %" PRIu32 ")\n",
__FUNCTION__, format, dwSize, dwMinSize, nameBufferSize); __func__, format, dwSize, dwMinSize, nameBufferSize);
return FALSE; return FALSE;
} }
dwNameLength = dwSize - 1; dwNameLength = dwSize - 1;
@ -257,7 +257,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
if (GetComputerNameExA(format, computerName1, &dwSize) == FALSE) if (GetComputerNameExA(format, computerName1, &dwSize) == FALSE)
{ {
fprintf(stderr, "%s: (6/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n", fprintf(stderr, "%s: (6/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n",
__FUNCTION__, format, GetLastError()); __func__, format, GetLastError());
return FALSE; return FALSE;
} }
/* check if returned size is valid */ /* check if returned size is valid */
@ -266,13 +266,13 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
fprintf(stderr, fprintf(stderr,
"%s: (7/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32 "%s: (7/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32
")\n", ")\n",
__FUNCTION__, format, dwSize, dwNameLength); __func__, format, dwSize, dwNameLength);
return FALSE; return FALSE;
} }
/* check if string is correctly terminated */ /* check if string is correctly terminated */
if (computerName1[dwSize] != 0) if (computerName1[dwSize] != 0)
{ {
fprintf(stderr, "%s: (8/%d) string termination error\n", __FUNCTION__, format); fprintf(stderr, "%s: (8/%d) string termination error\n", __func__, format);
return FALSE; return FALSE;
} }
@ -281,7 +281,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
if (GetComputerNameExA(format, computerName2, &dwSize) == FALSE) if (GetComputerNameExA(format, computerName2, &dwSize) == FALSE)
{ {
fprintf(stderr, "%s: (9/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n", fprintf(stderr, "%s: (9/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n",
__FUNCTION__, format, GetLastError()); __func__, format, GetLastError());
return FALSE; return FALSE;
} }
/* check if returned size is valid */ /* check if returned size is valid */
@ -290,20 +290,20 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
fprintf(stderr, fprintf(stderr,
"%s: (10/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32 "%s: (10/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32
")\n", ")\n",
__FUNCTION__, format, dwSize, dwNameLength); __func__, format, dwSize, dwNameLength);
return FALSE; return FALSE;
} }
/* check if string is correctly terminated */ /* check if string is correctly terminated */
if (computerName2[dwSize] != 0) if (computerName2[dwSize] != 0)
{ {
fprintf(stderr, "%s: (11/%d) string termination error\n", __FUNCTION__, format); fprintf(stderr, "%s: (11/%d) string termination error\n", __func__, format);
return FALSE; return FALSE;
} }
/* compare the results */ /* compare the results */
if (strcmp(computerName1, computerName2)) if (strcmp(computerName1, computerName2))
{ {
fprintf(stderr, "%s: (12/%d) string compare mismatch\n", __FUNCTION__, format); fprintf(stderr, "%s: (12/%d) string compare mismatch\n", __func__, format);
return FALSE; return FALSE;
} }
@ -313,7 +313,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
{ {
fprintf(stderr, fprintf(stderr,
"%s: (13/%d) GetComputerNameExA unexpectedly succeeded with limited buffer size\n", "%s: (13/%d) GetComputerNameExA unexpectedly succeeded with limited buffer size\n",
__FUNCTION__, format); __func__, format);
return FALSE; return FALSE;
} }
/* check if returned size is valid */ /* check if returned size is valid */
@ -322,7 +322,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
fprintf(stderr, fprintf(stderr,
"%s: (14/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32 "%s: (14/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32
")\n", ")\n",
__FUNCTION__, format, dwSize, dwNameLength + 1); __func__, format, dwSize, dwNameLength + 1);
return FALSE; return FALSE;
} }

View File

@ -29,16 +29,16 @@
#define STREAM_TAG WINPR_TAG("wStream") #define STREAM_TAG WINPR_TAG("wStream")
#define STREAM_ASSERT(cond) \ #define STREAM_ASSERT(cond) \
do \ do \
{ \ { \
if (!(cond)) \ if (!(cond)) \
{ \ { \
WLog_FATAL(STREAM_TAG, "%s [%s:%s:%" PRIuz "]", #cond, __FILE__, __FUNCTION__, \ WLog_FATAL(STREAM_TAG, "%s [%s:%s:%" PRIuz "]", #cond, __FILE__, __func__, \
(size_t)__LINE__); \ (size_t)__LINE__); \
winpr_log_backtrace(STREAM_TAG, WLOG_FATAL, 20); \ winpr_log_backtrace(STREAM_TAG, WLOG_FATAL, 20); \
abort(); \ abort(); \
} \ } \
} while (0) } while (0)
BOOL Stream_EnsureCapacity(wStream* s, size_t size) BOOL Stream_EnsureCapacity(wStream* s, size_t size)

View File

@ -66,22 +66,22 @@ int TestBitStream(int argc, char* argv[])
BitStream_Write_Bits(bs, 0xF, 4); /* 1111 */ BitStream_Write_Bits(bs, 0xF, 4); /* 1111 */
BitStream_Write_Bits(bs, 0xA, 4); /* 0101 */ BitStream_Write_Bits(bs, 0xA, 4); /* 0101 */
BitStream_Flush(bs); BitStream_Flush(bs);
BitDump(__FUNCTION__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST); BitDump(__func__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST);
BitStream_Write_Bits(bs, 3, 2); /* 11 */ BitStream_Write_Bits(bs, 3, 2); /* 11 */
BitStream_Write_Bits(bs, 0, 3); /* 000 */ BitStream_Write_Bits(bs, 0, 3); /* 000 */
BitStream_Write_Bits(bs, 0x2D, 6); /* 101101 */ BitStream_Write_Bits(bs, 0x2D, 6); /* 101101 */
BitStream_Write_Bits(bs, 0x19, 5); /* 11001 */ BitStream_Write_Bits(bs, 0x19, 5); /* 11001 */
// BitStream_Flush(bs); /* flush should be done automatically here (32 bits written) */ // BitStream_Flush(bs); /* flush should be done automatically here (32 bits written) */
BitDump(__FUNCTION__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST); BitDump(__func__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST);
BitStream_Write_Bits(bs, 3, 2); /* 11 */ BitStream_Write_Bits(bs, 3, 2); /* 11 */
BitStream_Flush(bs); BitStream_Flush(bs);
BitDump(__FUNCTION__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST); BitDump(__func__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST);
BitStream_Write_Bits(bs, 00, 2); /* 00 */ BitStream_Write_Bits(bs, 00, 2); /* 00 */
BitStream_Write_Bits(bs, 0xF, 4); /* 1111 */ BitStream_Write_Bits(bs, 0xF, 4); /* 1111 */
BitStream_Write_Bits(bs, 0, 20); BitStream_Write_Bits(bs, 0, 20);
BitStream_Write_Bits(bs, 0xAFF, 12); /* 111111110101 */ BitStream_Write_Bits(bs, 0xAFF, 12); /* 111111110101 */
BitStream_Flush(bs); BitStream_Flush(bs);
BitDump(__FUNCTION__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST); BitDump(__func__, WLOG_INFO, buffer, bs->position, BITDUMP_MSB_FIRST);
BitStream_Free(bs); BitStream_Free(bs);
return 0; return 0;
} }

View File

@ -142,14 +142,14 @@ static BOOL TestStream_Create(size_t count, BOOL selfAlloc)
{ {
if (!(buffer = malloc(cap))) if (!(buffer = malloc(cap)))
{ {
printf("%s: failed to allocate buffer of size %" PRIuz "\n", __FUNCTION__, cap); printf("%s: failed to allocate buffer of size %" PRIuz "\n", __func__, cap);
goto fail; goto fail;
} }
} }
if (!(s = Stream_New(selfAlloc ? buffer : NULL, len))) if (!(s = Stream_New(selfAlloc ? buffer : NULL, len)))
{ {
printf("%s: Stream_New failed for stream #%" PRIuz "\n", __FUNCTION__, i); printf("%s: Stream_New failed for stream #%" PRIuz "\n", __func__, i);
goto fail; goto fail;
} }
@ -175,7 +175,7 @@ static BOOL TestStream_Create(size_t count, BOOL selfAlloc)
if (memcmp(buffer, Stream_Buffer(s), cap)) if (memcmp(buffer, Stream_Buffer(s), cap))
{ {
printf("%s: buffer memory corruption\n", __FUNCTION__); printf("%s: buffer memory corruption\n", __func__);
goto fail; goto fail;
} }
} }
@ -204,7 +204,7 @@ static BOOL TestStream_Extent(UINT32 maxSize)
if (!(s = Stream_New(NULL, 1))) if (!(s = Stream_New(NULL, 1)))
{ {
printf("%s: Stream_New failed\n", __FUNCTION__); printf("%s: Stream_New failed\n", __func__);
return FALSE; return FALSE;
} }
@ -226,7 +226,7 @@ static BOOL TestStream_Extent(UINT32 maxSize)
if (!TestStream_Verify(s, i, i, i)) if (!TestStream_Verify(s, i, i, i))
{ {
printf("%s: failed to verify stream in iteration %" PRIu32 "\n", __FUNCTION__, i); printf("%s: failed to verify stream in iteration %" PRIu32 "\n", __func__, i);
goto fail; goto fail;
} }
} }
@ -247,48 +247,48 @@ fail:
#define Stream_Peek_INT8_BE Stream_Peek_INT8 #define Stream_Peek_INT8_BE Stream_Peek_INT8
#define Stream_Read_INT8_BE Stream_Read_INT8 #define Stream_Read_INT8_BE Stream_Read_INT8
#define TestStream_PeekAndRead(_s, _r, _t) \ #define TestStream_PeekAndRead(_s, _r, _t) \
do \ do \
{ \ { \
_t _a, _b; \ _t _a, _b; \
size_t _i; \ size_t _i; \
BYTE* _p = Stream_Buffer(_s); \ BYTE* _p = Stream_Buffer(_s); \
Stream_SetPosition(_s, 0); \ Stream_SetPosition(_s, 0); \
Stream_Peek_##_t(_s, _a); \ Stream_Peek_##_t(_s, _a); \
Stream_Read_##_t(_s, _b); \ Stream_Read_##_t(_s, _b); \
if (_a != _b) \ if (_a != _b) \
{ \ { \
printf("%s: test1 " #_t "_LE failed\n", __FUNCTION__); \ printf("%s: test1 " #_t "_LE failed\n", __func__); \
_r = FALSE; \ _r = FALSE; \
} \ } \
for (_i = 0; _i < sizeof(_t); _i++) \ for (_i = 0; _i < sizeof(_t); _i++) \
{ \ { \
if (((_a >> (_i * 8)) & 0xFF) != _p[_i]) \ if (((_a >> (_i * 8)) & 0xFF) != _p[_i]) \
{ \ { \
printf("%s: test2 " #_t "_LE failed\n", __FUNCTION__); \ printf("%s: test2 " #_t "_LE failed\n", __func__); \
_r = FALSE; \ _r = FALSE; \
break; \ break; \
} \ } \
} \ } \
/* printf("a: 0x%016llX\n", a); */ \ /* printf("a: 0x%016llX\n", a); */ \
Stream_SetPosition(_s, 0); \ Stream_SetPosition(_s, 0); \
Stream_Peek_##_t##_BE(_s, _a); \ Stream_Peek_##_t##_BE(_s, _a); \
Stream_Read_##_t##_BE(_s, _b); \ Stream_Read_##_t##_BE(_s, _b); \
if (_a != _b) \ if (_a != _b) \
{ \ { \
printf("%s: test1 " #_t "_BE failed\n", __FUNCTION__); \ printf("%s: test1 " #_t "_BE failed\n", __func__); \
_r = FALSE; \ _r = FALSE; \
} \ } \
for (_i = 0; _i < sizeof(_t); _i++) \ for (_i = 0; _i < sizeof(_t); _i++) \
{ \ { \
if (((_a >> (_i * 8)) & 0xFF) != _p[sizeof(_t) - _i - 1]) \ if (((_a >> (_i * 8)) & 0xFF) != _p[sizeof(_t) - _i - 1]) \
{ \ { \
printf("%s: test2 " #_t "_BE failed\n", __FUNCTION__); \ printf("%s: test2 " #_t "_BE failed\n", __func__); \
_r = FALSE; \ _r = FALSE; \
break; \ break; \
} \ } \
} \ } \
/* printf("a: 0x%016llX\n", a); */ \ /* printf("a: 0x%016llX\n", a); */ \
} while (0) } while (0)
static BOOL TestStream_Reading(void) static BOOL TestStream_Reading(void)
@ -299,7 +299,7 @@ static BOOL TestStream_Reading(void)
if (!(s = Stream_New(src, sizeof(src)))) if (!(s = Stream_New(src, sizeof(src))))
{ {
printf("%s: Stream_New failed\n", __FUNCTION__); printf("%s: Stream_New failed\n", __func__);
return FALSE; return FALSE;
} }

View File

@ -58,19 +58,19 @@ static BOOL CallbackAppenderMessage(const wLogMessage* msg)
static BOOL CallbackAppenderData(const wLogMessage* msg) static BOOL CallbackAppenderData(const wLogMessage* msg)
{ {
fprintf(stdout, "%s\n", __FUNCTION__); fprintf(stdout, "%s\n", __func__);
return TRUE; return TRUE;
} }
static BOOL CallbackAppenderImage(const wLogMessage* msg) static BOOL CallbackAppenderImage(const wLogMessage* msg)
{ {
fprintf(stdout, "%s\n", __FUNCTION__); fprintf(stdout, "%s\n", __func__);
return TRUE; return TRUE;
} }
static BOOL CallbackAppenderPackage(const wLogMessage* msg) static BOOL CallbackAppenderPackage(const wLogMessage* msg)
{ {
fprintf(stdout, "%s\n", __FUNCTION__); fprintf(stdout, "%s\n", __func__);
return TRUE; return TRUE;
} }
@ -86,7 +86,7 @@ int TestWLogCallback(int argc, char* argv[])
WINPR_UNUSED(argc); WINPR_UNUSED(argc);
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
function = __FUNCTION__; function = __func__;
root = WLog_GetRoot(); root = WLog_GetRoot();

View File

@ -126,8 +126,7 @@ static wLogAppender* WLog_Appender_New(wLog* log, DWORD logAppenderType)
appender = (wLogAppender*)WLog_UdpAppender_New(log); appender = (wLogAppender*)WLog_UdpAppender_New(log);
break; break;
default: default:
fprintf(stderr, "%s: unknown handler type %" PRIu32 "\n", __FUNCTION__, fprintf(stderr, "%s: unknown handler type %" PRIu32 "\n", __func__, logAppenderType);
logAppenderType);
appender = NULL; appender = NULL;
break; break;
} }

View File

@ -104,7 +104,7 @@ static BOOL WLog_JournaldAppender_WriteMessage(wLog* log, wLogAppender* appender
case WLOG_OFF: case WLOG_OFF:
return TRUE; return TRUE;
default: default:
fprintf(stderr, "%s: unknown level %" PRIu32 "\n", __FUNCTION__, message->Level); fprintf(stderr, "%s: unknown level %" PRIu32 "\n", __func__, message->Level);
return FALSE; return FALSE;
} }

View File

@ -17,7 +17,7 @@ int TestWtsApiEnumerateProcesses(int argc, char* argv[])
#ifndef _WIN32 #ifndef _WIN32
if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0)) if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0))
{ {
printf("%s: No RDS environment detected, skipping test\n", __FUNCTION__); printf("%s: No RDS environment detected, skipping test\n", __func__);
return 0; return 0;
} }
#endif #endif

View File

@ -18,7 +18,7 @@ int TestWtsApiEnumerateSessions(int argc, char* argv[])
#ifndef _WIN32 #ifndef _WIN32
if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0)) if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0))
{ {
printf("%s: No RDS environment detected, skipping test\n", __FUNCTION__); printf("%s: No RDS environment detected, skipping test\n", __func__);
return 0; return 0;
} }
#endif #endif

View File

@ -21,7 +21,7 @@ int TestWtsApiQuerySessionInformation(int argc, char* argv[])
#ifndef _WIN32 #ifndef _WIN32
if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0)) if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0))
{ {
printf("%s: No RDS environment detected, skipping test\n", __FUNCTION__); printf("%s: No RDS environment detected, skipping test\n", __func__);
return 0; return 0;
} }
#endif #endif

View File

@ -16,7 +16,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[])
#ifndef _WIN32 #ifndef _WIN32
if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0)) if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0))
{ {
printf("%s: No RDS environment detected, skipping test\n", __FUNCTION__); printf("%s: No RDS environment detected, skipping test\n", __func__);
return 0; return 0;
} }
#else #else
@ -25,8 +25,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[])
NULL, NULL, NULL); NULL, NULL, NULL);
if (!hWnd) if (!hWnd)
{ {
printf("%s: error creating message-only window: %" PRIu32 "\n", __FUNCTION__, printf("%s: error creating message-only window: %" PRIu32 "\n", __func__, GetLastError());
GetLastError());
return -1; return -1;
} }
#endif #endif
@ -37,7 +36,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[])
if (!bSuccess) if (!bSuccess)
{ {
printf("%s: WTSRegisterSessionNotification failed: %" PRIu32 "\n", __FUNCTION__, printf("%s: WTSRegisterSessionNotification failed: %" PRIu32 "\n", __func__,
GetLastError()); GetLastError());
return -1; return -1;
} }
@ -54,7 +53,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[])
if (!bSuccess) if (!bSuccess)
{ {
printf("%s: WTSUnRegisterSessionNotification failed: %" PRIu32 "\n", __FUNCTION__, printf("%s: WTSUnRegisterSessionNotification failed: %" PRIu32 "\n", __func__,
GetLastError()); GetLastError());
return -1; return -1;
} }

View File

@ -15,7 +15,7 @@ int TestWtsApiShutdownSystem(int argc, char* argv[])
#ifndef _WIN32 #ifndef _WIN32
if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0)) if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0))
{ {
printf("%s: No RDS environment detected, skipping test\n", __FUNCTION__); printf("%s: No RDS environment detected, skipping test\n", __func__);
return 0; return 0;
} }
#endif #endif

View File

@ -17,7 +17,7 @@ int TestWtsApiWaitSystemEvent(int argc, char* argv[])
#ifndef _WIN32 #ifndef _WIN32
if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0)) if (!GetEnvironmentVariableA("WTSAPI_LIBRARY", NULL, 0))
{ {
printf("%s: No RDS environment detected, skipping test\n", __FUNCTION__); printf("%s: No RDS environment detected, skipping test\n", __func__);
return 0; return 0;
} }
#endif #endif