diff --git a/channels/smartcard/client/smartcard_main.c b/channels/smartcard/client/smartcard_main.c index 2bb67300c..55d5482fa 100644 --- a/channels/smartcard/client/smartcard_main.c +++ b/channels/smartcard/client/smartcard_main.c @@ -37,7 +37,7 @@ #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 { diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c index 754ef7b3e..e1e558e71 100644 --- a/channels/urbdrc/client/libusb/libusb_udevice.c +++ b/channels/urbdrc/client/libusb/libusb_udevice.c @@ -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, ...) \ - 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) { diff --git a/client/SDL/dialogs/sdl_widget.hpp b/client/SDL/dialogs/sdl_widget.hpp index 44ea594cd..b4f1db3af 100644 --- a/client/SDL/dialogs/sdl_widget.hpp +++ b/client/SDL/dialogs/sdl_widget.hpp @@ -63,7 +63,7 @@ class SdlWidget const SDL_Rect& rect() const; 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, const char* fkt); diff --git a/client/SDL/sdl_utils.hpp b/client/SDL/sdl_utils.hpp index 98f29727a..c064452f7 100644 --- a/client/SDL/sdl_utils.hpp +++ b/client/SDL/sdl_utils.hpp @@ -92,7 +92,6 @@ BOOL sdl_push_user_event(Uint32 type, ...); const char* sdl_event_type_str(Uint32 type); const char* sdl_error_string(Uint32 res); -#define sdl_log_error(res, log, what) \ - sdl_log_error_ex(res, log, what, __FILE__, __LINE__, __FUNCTION__) +#define sdl_log_error(res, log, what) sdl_log_error_ex(res, log, what, __FILE__, __LINE__, __func__) BOOL sdl_log_error_ex(Uint32 res, wLog* log, const char* what, const char* file, size_t line, const char* fkt); diff --git a/client/X11/xf_utils.h b/client/X11/xf_utils.h index adaef0519..f94655467 100644 --- a/client/X11/xf_utils.h +++ b/client/X11/xf_utils.h @@ -28,7 +28,7 @@ char* Safe_XGetAtomName(Display* display, Atom atom); #define LogTagAndXGetWindowProperty(tag, display, w, property, long_offset, long_length, delete, \ req_type, actual_type_return, actual_format_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), \ (actual_type_return), (actual_format_return), (nitems_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, \ req_type, actual_type_return, actual_format_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), \ (actual_type_return), (actual_format_return), (nitems_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); #define LogTagAndXChangeProperty(tag, display, w, property, type, format, mode, data, nelements) \ - LogTagAndXChangeProperty_ex((tag), __FILE__, __FUNCTION__, __LINE__, (display), (w), \ - (property), (type), (format), (mode), (data), (nelements)) + LogTagAndXChangeProperty_ex((tag), __FILE__, __func__, __LINE__, (display), (w), (property), \ + (type), (format), (mode), (data), (nelements)) 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, int mode, _Xconst unsigned char* data, int nelements); #define LogDynAndXChangeProperty(log, display, w, property, type, format, mode, data, nelements) \ - LogDynAndXChangeProperty_ex((log), __FILE__, __FUNCTION__, __LINE__, (display), (w), \ - (property), (type), (format), (mode), (data), (nelements)) + LogDynAndXChangeProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property), \ + (type), (format), (mode), (data), (nelements)) int LogDynAndXChangeProperty_ex(wLog* log, const char* file, const char* fkt, size_t line, Display* display, Window w, Atom property, Atom type, int format, int mode, _Xconst unsigned char* data, int nelements); #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, Display* display, Window w, Atom 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, Display* display, Window w, Atom property); diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index c4f7555fa..45be34242 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -370,8 +370,8 @@ enum XF_EXIT_CODE XF_EXIT_UNKNOWN = 255, }; -#define xf_lock_x11(xfc) xf_lock_x11_(xfc, __FUNCTION__) -#define xf_unlock_x11(xfc) xf_unlock_x11_(xfc, __FUNCTION__) +#define xf_lock_x11(xfc) xf_lock_x11_(xfc, __func__) +#define xf_unlock_x11(xfc) xf_unlock_x11_(xfc, __func__) void xf_lock_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); #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, int line); diff --git a/client/common/client_cliprdr_file.c b/client/common/client_cliprdr_file.c index 719ed3584..63795276d 100644 --- a/client/common/client_cliprdr_file.c +++ b/client/common/client_cliprdr_file.c @@ -1276,7 +1276,7 @@ static UINT cliprdr_file_context_send_file_contents_failure( const UINT64 offset = (((UINT64)fileContentsRequest->nPositionHigh) << 32) | ((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 ", index %" PRIu32 "] offset %" PRIu64 ", size %" PRIu32 " failed", fileContentsRequest->clipDataId, fileContentsRequest->streamId, @@ -1315,14 +1315,14 @@ static BOOL dump_streams(const void* key, void* value, void* arg) const UINT32* ukey = key; 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, cur->lockId, cur->count, cur->locked); for (size_t x = 0; x < cur->count; x++) { const CliprdrLocalFile* file = &cur->files[x]; - writelog(cur->context->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, - "file [%" PRIuz "] ", x, file->name, file->size); + writelog(cur->context->log, WLOG_WARN, __FILE__, __func__, __LINE__, "file [%" PRIuz "] ", + x, file->name, file->size); } return TRUE; } @@ -1342,7 +1342,7 @@ static CliprdrLocalFile* file_info_for_request(CliprdrFileContext* file, UINT32 } 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 "] [locked %d]", lockId, listIndex, cur->count, cur->locked); @@ -1350,7 +1350,7 @@ static CliprdrLocalFile* file_info_for_request(CliprdrFileContext* file, UINT32 } 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); HashTable_Foreach(file->local_streams, dump_streams, file); } @@ -1370,7 +1370,7 @@ static CliprdrLocalFile* file_for_request(CliprdrFileContext* file, UINT32 lockI } if (!f->fp) { - writelog(file->log, WLOG_WARN, __FILE__, __FUNCTION__, __LINE__, + writelog(file->log, WLOG_WARN, __FILE__, __func__, __LINE__, "[lockID %" PRIu32 ", index %" PRIu32 "] failed to open file '%s' [size %" PRId64 "] %s [%d]", lockId, listIndex, f->name, f->size, strerror(errno), errno); diff --git a/client/common/test/TestClientCmdLine.c b/client/common/test/TestClientCmdLine.c index e99bef582..ce3a70824 100644 --- a/client/common/test/TestClientCmdLine.c +++ b/client/common/test/TestClientCmdLine.c @@ -8,7 +8,7 @@ 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, ...) \ do \ @@ -244,8 +244,7 @@ int TestClientCmdLine(int argc, char* argv[]) int failure = 0; char** command_line = string_list_copy(current->command_line); - if (!testcase(__FUNCTION__, command_line, - string_list_length((const char* const*)command_line), + if (!testcase(__func__, command_line, string_list_length((const char* const*)command_line), current->expected_status, current->validate_settings)) { TEST_FAILURE("parsing arguments.\n"); diff --git a/include/freerdp/api.h b/include/freerdp/api.h index 04d9ac2ad..331eab8ef 100644 --- a/include/freerdp/api.h +++ b/include/freerdp/api.h @@ -30,7 +30,7 @@ #endif #ifdef _WIN32 -#define __func__ __FUNCTION__ +#define __func__ __func__ #endif #if defined _WIN32 || defined __CYGWIN__ diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index dbbb84edf..a6d567bf0 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -611,7 +611,7 @@ owned by rdpRdp */ FREERDP_API const char* freerdp_get_last_error_category(UINT32 error); #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) \ do \ @@ -621,7 +621,7 @@ owned by rdpRdp */ } while (0) #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, const char* fkt, const char* file, int line); diff --git a/libfreerdp/codec/interleaved.c b/libfreerdp/codec/interleaved.c index c90f48964..d89ab754d 100644 --- a/libfreerdp/codec/interleaved.c +++ b/libfreerdp/codec/interleaved.c @@ -153,7 +153,7 @@ static const char* rle_code_str_buffer(UINT32 code, char* buffer, size_t size) } #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, 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) \ - 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, const char* fkt, const char* file, size_t line) { diff --git a/libfreerdp/codec/test/TestFreeRDPCodecMppc.c b/libfreerdp/codec/test/TestFreeRDPCodecMppc.c index 6c213d4b0..9c2df9496 100644 --- a/libfreerdp/codec/test/TestFreeRDPCodecMppc.c +++ b/libfreerdp/codec/test/TestFreeRDPCodecMppc.c @@ -771,9 +771,9 @@ static int test_MppcCompressBellsRdp5(void) { printf("MppcCompressBellsRdp5: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } @@ -818,9 +818,9 @@ static int test_MppcCompressBellsRdp4(void) { printf("MppcCompressBellsRdp4: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } @@ -959,9 +959,9 @@ static int test_MppcCompressIslandRdp5(void) { printf("MppcCompressIslandRdp5: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } diff --git a/libfreerdp/codec/test/TestFreeRDPCodecNCrush.c b/libfreerdp/codec/test/TestFreeRDPCodecNCrush.c index bba4c2a05..68995a501 100644 --- a/libfreerdp/codec/test/TestFreeRDPCodecNCrush.c +++ b/libfreerdp/codec/test/TestFreeRDPCodecNCrush.c @@ -39,9 +39,9 @@ static BOOL test_NCrushCompressBells(void) "\n", DstSize, expectedSize); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } @@ -49,9 +49,9 @@ static BOOL test_NCrushCompressBells(void) { printf("NCrushCompressBells: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } diff --git a/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c b/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c index f63541ac7..5c4e283a1 100644 --- a/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c +++ b/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c @@ -5503,7 +5503,7 @@ static BOOL RunTestPlanar(BITMAP_PLANAR_CONTEXT* planar, const BYTE* srcBitmap, BYTE* compressedBitmap = freerdp_bitmap_compress_planar(planar, srcBitmap, srcFormat, width, height, 0, NULL, &dstSize); BYTE* decompressedBitmap = (BYTE*)calloc(height, width * FreeRDPGetBytesPerPixel(dstFormat)); - printf("%s [%s] --> [%s]: ", __FUNCTION__, FreeRDPGetColorFormatName(srcFormat), + printf("%s [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat), FreeRDPGetColorFormatName(dstFormat)); fflush(stdout); printf("TODO: Skipping unfinished test!"); @@ -5543,7 +5543,7 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, const UINT32 { UINT32 i, j, x, y; BOOL rc = FALSE; - printf("%s: [%s] --> [%s]: ", __FUNCTION__, FreeRDPGetColorFormatName(srcFormat), + printf("%s: [%s] --> [%s]: ", __func__, FreeRDPGetColorFormatName(srcFormat), FreeRDPGetColorFormatName(dstFormat)); fflush(stdout); diff --git a/libfreerdp/codec/test/TestFreeRDPCodecZGfx.c b/libfreerdp/codec/test/TestFreeRDPCodecZGfx.c index 65c6a1536..9733a09dc 100644 --- a/libfreerdp/codec/test/TestFreeRDPCodecZGfx.c +++ b/libfreerdp/codec/test/TestFreeRDPCodecZGfx.c @@ -62,9 +62,9 @@ static int test_ZGfxCompressFox(void) { printf("test_ZGfxCompressFox: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } @@ -114,9 +114,9 @@ static int test_ZGfxDecompressFoxSingle(void) { printf("test_ZGfxDecompressFoxSingle: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } @@ -166,9 +166,9 @@ static int test_ZGfxDecompressFoxMultipart(void) { printf("test_ZGfxDecompressFoxSingle: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, DstSize * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, DstSize * 8, 0); 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; } @@ -231,17 +231,17 @@ static int test_ZGfxCompressConsistent(void) { printf("test_ZGfxDecompressFoxSingle: output mismatch\n"); printf("Actual\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData, 64 * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData, 64 * 8, 0); 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"); - BitDump(__FUNCTION__, WLOG_INFO, BigBuffer, 64 * 8, 0); + BitDump(__func__, WLOG_INFO, BigBuffer, 64 * 8, 0); 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"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData2, 64 * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData2, 64 * 8, 0); printf("...\n"); - BitDump(__FUNCTION__, WLOG_INFO, pDstData2 + DstSize2 - 64, 64 * 8, 0); + BitDump(__func__, WLOG_INFO, pDstData2 + DstSize2 - 64, 64 * 8, 0); goto fail; } diff --git a/libfreerdp/codec/test/TestFreeRDPRegion.c b/libfreerdp/codec/test/TestFreeRDPRegion.c index 6ac72d667..1e427e016 100644 --- a/libfreerdp/codec/test/TestFreeRDPRegion.c +++ b/libfreerdp/codec/test/TestFreeRDPRegion.c @@ -708,57 +708,57 @@ static int test_norbert2_case(void) if (!region16_union_rect(®ion, ®ion, &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; } if (!(rects = region16_rects(®ion, &nbRects))) { - fprintf(stderr, "%s: Error 2 - region16_rects failed\n", __FUNCTION__); + fprintf(stderr, "%s: Error 2 - region16_rects failed\n", __func__); goto out; } 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); goto out; } 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; } if (!region16_union_rect(®ion, ®ion, &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; } if (!(rects = region16_rects(®ion, &nbRects))) { - fprintf(stderr, "%s: Error 6 - region16_rects failed\n", __FUNCTION__); + fprintf(stderr, "%s: Error 6 - region16_rects failed\n", __func__); goto out; } 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); goto out; } 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; } 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; } diff --git a/libfreerdp/common/test/TestAddinArgv.c b/libfreerdp/common/test/TestAddinArgv.c index 1ac94ad44..a4c70b8b3 100644 --- a/libfreerdp/common/test/TestAddinArgv.c +++ b/libfreerdp/common/test/TestAddinArgv.c @@ -52,7 +52,7 @@ fail: freerdp_addin_argv_free(arg2); freerdp_addin_argv_free(arg3); freerdp_addin_argv_free(arg4); - printf("%s: %d\n", __FUNCTION__, rc); + printf("%s: %d\n", __func__, rc); return rc; } @@ -88,7 +88,7 @@ fail: freerdp_addin_argv_free(arg); freerdp_addin_argv_free(clone); freerdp_addin_argv_free(clone2); - printf("%s: %d\n", __FUNCTION__, rc); + printf("%s: %d\n", __func__, rc); return rc; } @@ -142,7 +142,7 @@ static BOOL test_add_remove(void) rc = TRUE; fail: freerdp_addin_argv_free(arg); - printf("%s: %d\n", __FUNCTION__, rc); + printf("%s: %d\n", __func__, rc); return rc; } @@ -180,7 +180,7 @@ static BOOL test_set_argument(void) rc = TRUE; fail: freerdp_addin_argv_free(arg); - printf("%s: %d\n", __FUNCTION__, rc); + printf("%s: %d\n", __func__, rc); return rc; } @@ -221,7 +221,7 @@ static BOOL test_replace_argument(void) rc = TRUE; fail: freerdp_addin_argv_free(arg); - printf("%s: %d\n", __FUNCTION__, rc); + printf("%s: %d\n", __func__, rc); return rc; } @@ -269,7 +269,7 @@ static BOOL test_set_argument_value(void) rc = TRUE; fail: freerdp_addin_argv_free(arg); - printf("%s: %d\n", __FUNCTION__, rc); + printf("%s: %d\n", __func__, rc); return rc; } @@ -320,7 +320,7 @@ static BOOL test_replace_argument_value(void) rc = TRUE; fail: freerdp_addin_argv_free(arg); - printf("%s: %d\n", __FUNCTION__, rc); + printf("%s: %d\n", __func__, rc); return rc; } diff --git a/libfreerdp/common/test/TestCommonAssistance.c b/libfreerdp/common/test/TestCommonAssistance.c index 4e04f5820..befe91305 100644 --- a/libfreerdp/common/test/TestCommonAssistance.c +++ b/libfreerdp/common/test/TestCommonAssistance.c @@ -214,7 +214,7 @@ int TestCommonAssistance(int argc, char* argv[]) wLog* log; WINPR_UNUSED(argc); WINPR_UNUSED(argv); - log = WLog_Get(__FUNCTION__); + log = WLog_Get(__func__); winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT); for (size_t x = 0; x < ARRAYSIZE(fail_tests); x++) diff --git a/libfreerdp/core/activation.c b/libfreerdp/core/activation.c index 66ce9f7bf..3658954de 100644 --- a/libfreerdp/core/activation.c +++ b/libfreerdp/core/activation.c @@ -47,7 +47,7 @@ static BOOL rdp_recv_sync_pdu(rdpRdp* rdp, wStream* s, const char* what) WINPR_UNUSED(rdp); 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; Stream_Read_UINT16(s, msgType); if (msgType != SYNCMSGTYPE_SYNC) diff --git a/libfreerdp/core/license.c b/libfreerdp/core/license.c index 893c3f147..dd5d52649 100644 --- a/libfreerdp/core/license.c +++ b/libfreerdp/core/license.c @@ -463,7 +463,7 @@ static BOOL license_check_stream_capacity(wStream* s, size_t expect, const char* WINPR_ASSERT(where); 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 TRUE; diff --git a/libfreerdp/core/rdstls.c b/libfreerdp/core/rdstls.c index 4fa6189b1..91a7246c6 100644 --- a/libfreerdp/core/rdstls.c +++ b/libfreerdp/core/rdstls.c @@ -639,7 +639,7 @@ static int rdstls_recv(rdpTransport* transport, wStream* s, void* extra) } #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, const char* file, const char* fkt, size_t line) { diff --git a/libfreerdp/core/redirection.c b/libfreerdp/core/redirection.c index a7c973925..8f86e6780 100644 --- a/libfreerdp/core/redirection.c +++ b/libfreerdp/core/redirection.c @@ -1181,7 +1181,7 @@ BOOL redirection_set_byte_option(rdpRedirection* redirection, UINT32 flag, const case LB_TARGET_CERTIFICATE: return rdp_redirection_read_target_cert(redirection, data, length); default: - return redirection_unsupported(__FUNCTION__, flag, + return redirection_unsupported(__func__, flag, LB_CLIENT_TSV_URL | LB_PASSWORD | LB_LOAD_BALANCE_INFO | 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: return redirection_copy_string(&redirection->TargetNetAddress, str); default: - return redirection_unsupported(__FUNCTION__, flag, + return redirection_unsupported(__func__, flag, LB_USERNAME | LB_DOMAIN | LB_TARGET_FQDN | 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, &redirection->TargetNetAddressesCount, str, count); default: - return redirection_unsupported(__FUNCTION__, flag, LB_TARGET_NET_ADDRESSES); + return redirection_unsupported(__func__, flag, LB_TARGET_NET_ADDRESSES); } } diff --git a/libfreerdp/core/test/TestConnect.c b/libfreerdp/core/test/TestConnect.c index 694d39628..01ef3dbea 100644 --- a/libfreerdp/core/test/TestConnect.c +++ b/libfreerdp/core/test/TestConnect.c @@ -93,7 +93,7 @@ static int testTimeout(int port) if (diff < timeout) return -1; - printf("%s: Success!\n", __FUNCTION__); + printf("%s: Success!\n", __func__); return 0; } @@ -168,14 +168,14 @@ static int testAbort(int port) 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; } if (WAIT_OBJECT_0 != status) return -1; - printf("%s: Success!\n", __FUNCTION__); + printf("%s: Success!\n", __func__); return 0; } @@ -297,11 +297,11 @@ static int testSuccess(int port) WaitForSingleObject(process.hProcess, INFINITE); CloseHandle(process.hProcess); CloseHandle(process.hThread); - printf("%s: returned %d!\n", __FUNCTION__, r); + printf("%s: returned %d!\n", __func__, r); rc = r; if (rc == 0) - printf("%s: Success!\n", __FUNCTION__); + printf("%s: Success!\n", __func__); fail: free(exe); diff --git a/libfreerdp/core/test/TestSettings.c b/libfreerdp/core/test/TestSettings.c index 8476d4a67..4b2257307 100644 --- a/libfreerdp/core/test/TestSettings.c +++ b/libfreerdp/core/test/TestSettings.c @@ -235,7 +235,7 @@ fail: static BOOL test_copy(void) { BOOL rc = FALSE; - wLog* log = WLog_Get(__FUNCTION__); + wLog* log = WLog_Get(__func__); rdpSettings* settings = freerdp_settings_new(0); rdpSettings* copy = freerdp_settings_clone(settings); rdpSettings* modified = freerdp_settings_clone(settings); diff --git a/libfreerdp/core/test/TestStreamDump.c b/libfreerdp/core/test/TestStreamDump.c index e058c3aec..17dc15328 100644 --- a/libfreerdp/core/test/TestStreamDump.c +++ b/libfreerdp/core/test/TestStreamDump.c @@ -30,7 +30,7 @@ static BOOL test_entry_read_write(void) name = GetKnownSubPath(KNOWN_PATH_TEMP, tmp2); if (!name) { - fprintf(stderr, "[%s] Could not create temporary path\n", __FUNCTION__); + fprintf(stderr, "[%s] Could not create temporary path\n", __func__); goto fail; } @@ -38,7 +38,7 @@ static BOOL test_entry_read_write(void) sr = Stream_New(NULL, 1024); 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); goto fail; } @@ -62,21 +62,21 @@ static BOOL test_entry_read_write(void) 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); goto fail; } 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)); goto fail; } 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; } rc = TRUE; diff --git a/libfreerdp/core/tpkt.h b/libfreerdp/core/tpkt.h index 17fa756f5..d7408b696 100644 --- a/libfreerdp/core/tpkt.h +++ b/libfreerdp/core/tpkt.h @@ -31,8 +31,7 @@ FREERDP_LOCAL int tpkt_verify_header(wStream* s); FREERDP_LOCAL BOOL tpkt_read_header(wStream* s, UINT16* length); FREERDP_LOCAL BOOL tpkt_write_header(wStream* s, UINT16 length); -#define tpkt_ensure_stream_consumed(s, length) \ - tpkt_ensure_stream_consumed_((s), (length), __FUNCTION__) +#define tpkt_ensure_stream_consumed(s, length) tpkt_ensure_stream_consumed_((s), (length), __func__) FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_(wStream* s, UINT16 length, const char* fkt); #endif /* FREERDP_LIB_CORE_TPKT_H */ diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index e96226122..dd82257ee 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -696,7 +696,7 @@ fail: } #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, LPCSTR func, DWORD line) diff --git a/libfreerdp/crypto/test/TestKnownHosts.c b/libfreerdp/crypto/test/TestKnownHosts.c index c718144ca..c93970284 100644 --- a/libfreerdp/crypto/test/TestKnownHosts.c +++ b/libfreerdp/crypto/test/TestKnownHosts.c @@ -260,7 +260,7 @@ static BOOL test_certs_dir(void) rdpCertificateData* data3 = NULL; rdpCertificateData* data4 = NULL; - printf("%s\n", __FUNCTION__); + printf("%s\n", __func__); if (!setup_config(&settings)) goto fail; diff --git a/libfreerdp/crypto/test/Test_x509_utils.c b/libfreerdp/crypto/test/Test_x509_utils.c index 4e6a63fb7..31d2c78d0 100644 --- a/libfreerdp/crypto/test/Test_x509_utils.c +++ b/libfreerdp/crypto/test/Test_x509_utils.c @@ -94,7 +94,7 @@ static int TestCertificateFile(const char* certificate_path, 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; goto fail; } @@ -113,12 +113,11 @@ static int TestCertificateFile(const char* certificate_path, if (result) { - printf("%s: crypto got %-40s -> \"%s\"\n", __FUNCTION__, test->field_description, - result); + printf("%s: crypto got %-40s -> \"%s\"\n", __func__, test->field_description, 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); success = -1; } @@ -127,7 +126,7 @@ static int TestCertificateFile(const char* certificate_path, } else { - printf("%s: failure: cannot get %s\n", __FUNCTION__, test->field_description); + printf("%s: failure: cannot get %s\n", __func__, test->field_description); } } diff --git a/libfreerdp/gdi/test/TestGdiBitBlt.c b/libfreerdp/gdi/test/TestGdiBitBlt.c index 94a27c30b..bb4d56ace 100644 --- a/libfreerdp/gdi/test/TestGdiBitBlt.c +++ b/libfreerdp/gdi/test/TestGdiBitBlt.c @@ -531,7 +531,7 @@ fail: gdi_DeleteObject((HGDIOBJECT)hBmpDstOriginal); gdi_DeleteDC(hdcSrc); gdi_DeleteDC(hdcDst); - fprintf(stderr, "%s: TODO Test not implemented!!!\n", __FUNCTION__); + fprintf(stderr, "%s: TODO Test not implemented!!!\n", __func__); return TRUE; // rc; } diff --git a/libfreerdp/utils/http.c b/libfreerdp/utils/http.c index 9a8b6c3f9..24de3fb96 100644 --- a/libfreerdp/utils/http.c +++ b/libfreerdp/utils/http.c @@ -40,7 +40,7 @@ static const char post_header_fmt[] = "POST %s HTTP/1.1\r\n" "Content-Length: %lu\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) { const DWORD level = WLOG_ERROR; diff --git a/libfreerdp/utils/smartcard_pack.c b/libfreerdp/utils/smartcard_pack.c index d234ed463..b052a5c1b 100644 --- a/libfreerdp/utils/smartcard_pack.c +++ b/libfreerdp/utils/smartcard_pack.c @@ -35,9 +35,9 @@ static const DWORD g_LogLevel = WLOG_DEBUG; #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) \ - 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, 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 * addressing */ #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, 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) 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; } @@ -1465,7 +1465,7 @@ static LONG smartcard_unpack_common_context_and_string_w(wStream* s, REDIR_SCARD if (status != SCARD_S_SUCCESS) 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; } diff --git a/rdtk/librdtk/test/TestRdTkNinePatch.c b/rdtk/librdtk/test/TestRdTkNinePatch.c index 0bd230362..99de4979e 100644 --- a/rdtk/librdtk/test/TestRdTkNinePatch.c +++ b/rdtk/librdtk/test/TestRdTkNinePatch.c @@ -19,7 +19,7 @@ int TestRdTkNinePatch(int argc, char* argv[]) 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; } @@ -30,7 +30,7 @@ int TestRdTkNinePatch(int argc, char* argv[]) /* let rdtk allocate the surface buffer */ 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()); goto out; } @@ -40,13 +40,13 @@ int TestRdTkNinePatch(int argc, char* argv[]) /* test self-allocated buffer */ 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; } 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()); goto out; } diff --git a/server/proxy/channels/pf_channel_rdpdr.c b/server/proxy/channels/pf_channel_rdpdr.c index a9aa06697..263b5db50 100644 --- a/server/proxy/channels/pf_channel_rdpdr.c +++ b/server/proxy/channels/pf_channel_rdpdr.c @@ -132,16 +132,16 @@ typedef struct } \ } while (0) -#define Stream_CheckAndLogRequiredLengthSrv(log, s, len) \ - Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \ - proxy_client_rx " %s(%s:%" PRIuz ")", __FUNCTION__, \ +#define Stream_CheckAndLogRequiredLengthSrv(log, s, len) \ + Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \ + proxy_client_rx " %s(%s:%" PRIuz ")", __func__, \ __FILE__, (size_t)__LINE__) -#define Stream_CheckAndLogRequiredLengthClient(log, s, len) \ - Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \ - proxy_server_rx " %s(%s:%" PRIuz ")", __FUNCTION__, \ +#define Stream_CheckAndLogRequiredLengthClient(log, s, len) \ + Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, 1, \ + proxy_server_rx " %s(%s:%" PRIuz ")", __func__, \ __FILE__, (size_t)__LINE__) #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, size_t size, const char* fkt, const char* file, 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) \ - 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, const RDPDR_CAPABILITY_HEADER* header, const char* fkt) { diff --git a/server/proxy/modules/demo/demo.cpp b/server/proxy/modules/demo/demo.cpp index dd308ce5b..a6d89ce36 100644 --- a/server/proxy/modules/demo/demo.cpp +++ b/server/proxy/modules/demo/demo.cpp @@ -333,7 +333,7 @@ static BOOL demo_dyn_channel_intercept_list(proxyPlugin* plugin, proxyData* pdat WINPR_ASSERT(pdata); WINPR_ASSERT(data); - WLog_INFO(TAG, "%s", __FUNCTION__); + WLog_INFO(TAG, "%s", __func__); return TRUE; } @@ -345,7 +345,7 @@ static BOOL demo_static_channel_intercept_list(proxyPlugin* plugin, proxyData* p WINPR_ASSERT(pdata); WINPR_ASSERT(data); - WLog_INFO(TAG, "%s", __FUNCTION__); + WLog_INFO(TAG, "%s", __func__); return TRUE; } @@ -357,7 +357,7 @@ static BOOL demo_dyn_channel_intercept(proxyPlugin* plugin, proxyData* pdata, vo WINPR_ASSERT(pdata); WINPR_ASSERT(data); - WLog_INFO(TAG, "%s", __FUNCTION__); + WLog_INFO(TAG, "%s", __func__); return TRUE; } diff --git a/winpr/include/winpr/assert.h b/winpr/include/winpr/assert.h index 341f27b6c..059cdeb61 100644 --- a/winpr/include/winpr/assert.h +++ b/winpr/include/winpr/assert.h @@ -32,11 +32,11 @@ extern "C" { #endif -#define WINPR_ASSERT(cond) \ - do \ - { \ - if (!(cond)) \ - winpr_int_assert(#cond, __FILE__, __FUNCTION__, __LINE__); \ +#define WINPR_ASSERT(cond) \ + do \ + { \ + if (!(cond)) \ + winpr_int_assert(#cond, __FILE__, __func__, __LINE__); \ } while (0) static INLINE WINPR_NORETURN(void winpr_int_assert(const char* condstr, const char* file, diff --git a/winpr/include/winpr/stream.h b/winpr/include/winpr/stream.h index ca8996d97..d27f531c2 100644 --- a/winpr/include/winpr/stream.h +++ b/winpr/include/winpr/stream.h @@ -58,7 +58,7 @@ extern "C" #define Stream_CheckAndLogRequiredCapacityOfSize(tag, s, nmemb, size) \ 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) \ Stream_CheckAndLogRequiredCapacityOfSize((tag), (s), (len), 1) @@ -71,7 +71,7 @@ extern "C" #define Stream_CheckAndLogRequiredCapacityOfSizeWLog(log, s, nmemb, size) \ 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) \ Stream_CheckAndLogRequiredCapacityOfSizeWLog((log), (s), (len), 1) @@ -90,7 +90,7 @@ extern "C" #define Stream_CheckAndLogRequiredLengthOfSize(tag, s, nmemb, size) \ 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) \ Stream_CheckAndLogRequiredLengthOfSize(tag, s, len, 1) @@ -103,7 +103,7 @@ extern "C" #define Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, nmemb, size) \ 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) \ Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, len, 1) @@ -506,7 +506,7 @@ extern "C" 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, const char* fkt); diff --git a/winpr/include/winpr/synch.h b/winpr/include/winpr/synch.h index 9e8751004..01be2f373 100644 --- a/winpr/include/winpr/synch.h +++ b/winpr/include/winpr/synch.h @@ -109,7 +109,7 @@ extern "C" WINPR_API BOOL ResetEvent(HANDLE hEvent); #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); #endif #ifdef UNICODE diff --git a/winpr/include/winpr/wlog.h b/winpr/include/winpr/wlog.h index 2b91d3190..8f2760cb5 100644 --- a/winpr/include/winpr/wlog.h +++ b/winpr/include/winpr/wlog.h @@ -78,7 +78,7 @@ extern "C" size_t LineNumber; /* __LINE__ */ LPCSTR FileName; /* __FILE__ */ - LPCSTR FunctionName; /* __FUNCTION__ */ + LPCSTR FunctionName; /* __func__ */ /* Data Message */ @@ -127,14 +127,14 @@ extern "C" */ WINPR_API BOOL WLog_SetContext(wLog* log, const char* (*fkt)(void*), void* context); -#define WLog_Print(_log, _log_level, ...) \ - do \ - { \ - if (WLog_IsLevelActive(_log, _log_level)) \ - { \ - WLog_PrintMessage(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, \ - __FUNCTION__, __VA_ARGS__); \ - } \ +#define WLog_Print(_log, _log_level, ...) \ + do \ + { \ + if (WLog_IsLevelActive(_log, _log_level)) \ + { \ + WLog_PrintMessage(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, __func__, \ + __VA_ARGS__); \ + } \ } while (0) #define WLog_Print_tag(_tag, _log_level, ...) \ @@ -146,44 +146,44 @@ extern "C" WLog_Print(_log_cached_ptr, _log_level, __VA_ARGS__); \ } while (0) -#define WLog_PrintVA(_log, _log_level, _args) \ - do \ - { \ - if (WLog_IsLevelActive(_log, _log_level)) \ - { \ - WLog_PrintMessageVA(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, \ - __FUNCTION__, _args); \ - } \ +#define WLog_PrintVA(_log, _log_level, _args) \ + do \ + { \ + if (WLog_IsLevelActive(_log, _log_level)) \ + { \ + WLog_PrintMessageVA(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, __func__, \ + _args); \ + } \ } while (0) -#define WLog_Data(_log, _log_level, ...) \ - do \ - { \ - if (WLog_IsLevelActive(_log, _log_level)) \ - { \ - WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, \ - __FUNCTION__, __VA_ARGS__); \ - } \ +#define WLog_Data(_log, _log_level, ...) \ + do \ + { \ + if (WLog_IsLevelActive(_log, _log_level)) \ + { \ + WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, __func__, \ + __VA_ARGS__); \ + } \ } while (0) -#define WLog_Image(_log, _log_level, ...) \ - do \ - { \ - if (WLog_IsLevelActive(_log, _log_level)) \ - { \ - WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, \ - __FUNCTION__, __VA_ARGS__); \ - } \ +#define WLog_Image(_log, _log_level, ...) \ + do \ + { \ + if (WLog_IsLevelActive(_log, _log_level)) \ + { \ + WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, __func__, \ + __VA_ARGS__); \ + } \ } while (0) -#define WLog_Packet(_log, _log_level, ...) \ - do \ - { \ - if (WLog_IsLevelActive(_log, _log_level)) \ - { \ - WLog_PrintMessage(_log, WLOG_MESSAGE_PACKET, _log_level, __LINE__, __FILE__, \ - __FUNCTION__, __VA_ARGS__); \ - } \ +#define WLog_Packet(_log, _log_level, ...) \ + do \ + { \ + if (WLog_IsLevelActive(_log, _log_level)) \ + { \ + WLog_PrintMessage(_log, WLOG_MESSAGE_PACKET, _log_level, __LINE__, __FILE__, __func__, \ + __VA_ARGS__); \ + } \ } while (0) #define WLog_LVL(tag, lvl, ...) WLog_Print_tag(tag, lvl, __VA_ARGS__) diff --git a/winpr/libwinpr/crt/test/TestFormatSpecifiers.c b/winpr/libwinpr/crt/test/TestFormatSpecifiers.c index 0e2b68abc..5ae6a40a6 100644 --- a/winpr/libwinpr/crt/test/TestFormatSpecifiers.c +++ b/winpr/libwinpr/crt/test/TestFormatSpecifiers.c @@ -21,7 +21,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) 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); errors++; } @@ -37,8 +37,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) if (strcmp(fmt, chk)) { - fprintf(stderr, "%s failed INT8 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, - chk); + fprintf(stderr, "%s failed INT8 test: got [%s] instead of [%s]\n", __func__, fmt, chk); errors++; } } @@ -53,8 +52,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) if (strcmp(fmt, chk)) { - fprintf(stderr, "%s failed UINT8 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, - chk); + fprintf(stderr, "%s failed UINT8 test: got [%s] instead of [%s]\n", __func__, fmt, chk); errors++; } } @@ -69,8 +67,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) if (strcmp(fmt, chk)) { - fprintf(stderr, "%s failed INT16 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, - chk); + fprintf(stderr, "%s failed INT16 test: got [%s] instead of [%s]\n", __func__, fmt, chk); errors++; } } @@ -86,7 +83,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) 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); errors++; } @@ -102,8 +99,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) if (strcmp(fmt, chk)) { - fprintf(stderr, "%s failed INT32 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, - chk); + fprintf(stderr, "%s failed INT32 test: got [%s] instead of [%s]\n", __func__, fmt, chk); errors++; } } @@ -119,7 +115,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) 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); errors++; } @@ -135,8 +131,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) if (strcmp(fmt, chk)) { - fprintf(stderr, "%s failed INT64 test: got [%s] instead of [%s]\n", __FUNCTION__, fmt, - chk); + fprintf(stderr, "%s failed INT64 test: got [%s] instead of [%s]\n", __func__, fmt, chk); errors++; } } @@ -153,7 +148,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) 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); errors++; } @@ -161,7 +156,7 @@ int TestFormatSpecifiers(int argc, char* argv[]) if (errors) { - fprintf(stderr, "%s produced %u errors\n", __FUNCTION__, errors); + fprintf(stderr, "%s produced %u errors\n", __func__, errors); return -1; } diff --git a/winpr/libwinpr/crt/test/TestUnicodeConversion.c b/winpr/libwinpr/crt/test/TestUnicodeConversion.c index c3db0809a..d8e3c4b9d 100644 --- a/winpr/libwinpr/crt/test/TestUnicodeConversion.c +++ b/winpr/libwinpr/crt/test/TestUnicodeConversion.c @@ -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) \ - 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, 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) \ - 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, 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)) { 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", prefix, test->utf8, wlen, rc2); return FALSE; @@ -208,8 +208,7 @@ static BOOL test_convert_to_utf16_n(const testcase_t* test) if ((rc2 < 0) || ((size_t)rc2 != wlen)) { char prefix[8192] = { 0 }; - create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __FUNCTION__, - __LINE__); + create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __func__, __LINE__); fprintf(stderr, "%s ConvertUtf8NToWChar(%s, %" PRIuz ", NULL, 0) expected %" PRIuz ", got %" PRIdz "\n", @@ -245,7 +244,7 @@ static BOOL test_convert_to_utf8(const testcase_t* test) if ((rc2 < 0) || ((size_t)rc2 != wlen)) { 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", prefix, test->utf8, wlen, rc2); return FALSE; @@ -273,8 +272,7 @@ static BOOL test_convert_to_utf8_n(const testcase_t* test) if ((rc2 < 0) || ((size_t)rc2 != wlen)) { char prefix[8192] = { 0 }; - create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __FUNCTION__, - __LINE__); + create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __func__, __LINE__); fprintf(stderr, "%s ConvertWCharNToUtf8(%s, %" PRIuz ", NULL, 0) expected %" PRIuz ", got %" PRIdz "\n", @@ -323,7 +321,7 @@ static BOOL test_conversion(const testcase_t* testcases, size_t count) #if defined(WITH_WINPR_DEPRECATED) #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, 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) \ - 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, 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) { 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 MultiByteToWideChar(CP_UTF8, 0, %s, [-1], NULL, 0) expected %" PRIuz ", got %d\n", @@ -504,8 +502,7 @@ static BOOL test_win_convert_to_utf16_n(const testcase_t* test) if (rc2 != wlen) { char prefix[8192] = { 0 }; - create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __FUNCTION__, - __LINE__); + create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf8len, test, __func__, __LINE__); fprintf(stderr, "%s MultiByteToWideChar(CP_UTF8, 0, %s, %" PRIuz ", NULL, 0) expected %" PRIuz ", got %d\n", @@ -545,7 +542,7 @@ static BOOL test_win_convert_to_utf8(const testcase_t* test) if (rc2 != wlen) { 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 WideCharToMultiByte(CP_UTF8, 0, %s, -1, NULL, 0, NULL, NULL) expected %" PRIuz ", got %d\n", @@ -580,8 +577,7 @@ static BOOL test_win_convert_to_utf8_n(const testcase_t* test) if (rc2 != wlen) { char prefix[8192] = { 0 }; - create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __FUNCTION__, - __LINE__); + create_prefix(prefix, ARRAYSIZE(prefix), 0, rc2, test->utf16len, test, __func__, __LINE__); fprintf(stderr, "%s WideCharToMultiByte(CP_UTF8, 0, %s, %" PRIuz ", NULL, 0, NULL, NULL) expected %" PRIuz ", got %d\n", diff --git a/winpr/libwinpr/crypto/test/TestCryptoCipher.c b/winpr/libwinpr/crypto/test/TestCryptoCipher.c index bf11db30a..51e0e5450 100644 --- a/winpr/libwinpr/crypto/test/TestCryptoCipher.c +++ b/winpr/libwinpr/crypto/test/TestCryptoCipher.c @@ -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))) { - fprintf(stderr, "%s: winpr_Cipher_New (encrypt) failed\n", __FUNCTION__); + fprintf(stderr, "%s: winpr_Cipher_New (encrypt) failed\n", __func__); return FALSE; } @@ -35,22 +35,22 @@ static BOOL test_crypto_cipher_aes_128_cbc(void) 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; } 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; } xlen += olen; if (xlen != ilen) { - fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (encrypt)\n", - __FUNCTION__, xlen, ilen); + fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (encrypt)\n", __func__, + xlen, ilen); 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))) { - fprintf(stderr, "%s: winpr_Cipher_New (decrypt) failed\n", __FUNCTION__); + fprintf(stderr, "%s: winpr_Cipher_New (decrypt) failed\n", __func__); return FALSE; } @@ -74,28 +74,28 @@ static BOOL test_crypto_cipher_aes_128_cbc(void) 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; } 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; } xlen += olen; if (xlen != ilen) { - fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (decrypt)\n", - __FUNCTION__, xlen, ilen); + fprintf(stderr, "%s: error, xlen (%" PRIuz ") != ilen (%" PRIuz ") (decrypt)\n", __func__, + xlen, ilen); goto out; } 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; } @@ -121,21 +121,21 @@ static BOOL test_crypto_cipher_rc4(void) 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; } if ((ctx = winpr_RC4_New(TEST_RC4_KEY, 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; } rc = winpr_RC4_Update(ctx, len, (const BYTE*)TEST_RC4_PLAINTEXT, text); winpr_RC4_Free(ctx); if (!rc) { - fprintf(stderr, "%s: winpr_RC4_Update failed\n", __FUNCTION__); + fprintf(stderr, "%s: winpr_RC4_Update failed\n", __func__); goto out; } @@ -147,7 +147,7 @@ static BOOL test_crypto_cipher_rc4(void) actual = winpr_BinToHexString(text, 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); free(actual); diff --git a/winpr/libwinpr/crypto/test/TestCryptoHash.c b/winpr/libwinpr/crypto/test/TestCryptoHash.c index 761d72d77..b7f567b4c 100644 --- a/winpr/libwinpr/crypto/test/TestCryptoHash.c +++ b/winpr/libwinpr/crypto/test/TestCryptoHash.c @@ -16,23 +16,23 @@ static BOOL test_crypto_hash_md5(void) 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; } 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; } if (!winpr_Digest_Update(ctx, (const BYTE*)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; } 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; } 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())) { - fprintf(stderr, "%s: winpr_Digest_New failed\n", __FUNCTION__); + fprintf(stderr, "%s: winpr_Digest_New failed\n", __func__); return FALSE; } 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; } if (!winpr_Digest_Update(ctx, (const BYTE*)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; } 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; } 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())) { - fprintf(stderr, "%s: winpr_Digest_New failed\n", __FUNCTION__); + fprintf(stderr, "%s: winpr_Digest_New failed\n", __func__); return FALSE; } 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; } if (!winpr_Digest_Update(ctx, (const BYTE*)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; } 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; } @@ -178,30 +178,30 @@ static BOOL test_crypto_hash_hmac_md5(void) 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; } 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; } if (!winpr_HMAC_Update(ctx, (const BYTE*)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; } if (!winpr_HMAC_Update(ctx, (const BYTE*)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; } 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; } @@ -241,30 +241,30 @@ static BOOL test_crypto_hash_hmac_sha1(void) 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; } 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; } if (!winpr_HMAC_Update(ctx, (const BYTE*)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; } if (!winpr_HMAC_Update(ctx, (const BYTE*)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; } 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; } diff --git a/winpr/libwinpr/library/test/TestLibraryGetModuleFileName.c b/winpr/libwinpr/library/test/TestLibraryGetModuleFileName.c index abf92cc1b..01c6f4663 100644 --- a/winpr/libwinpr/library/test/TestLibraryGetModuleFileName.c +++ b/winpr/libwinpr/library/test/TestLibraryGetModuleFileName.c @@ -17,15 +17,15 @@ int TestLibraryGetModuleFileName(int argc, char* argv[]) len = GetModuleFileNameA(NULL, ModuleFileName, 2); if (len != 2) { - printf("%s: GetModuleFileNameA unexpectedly returned %" PRIu32 " instead of 2\n", - __FUNCTION__, len); + printf("%s: GetModuleFileNameA unexpectedly returned %" PRIu32 " instead of 2\n", __func__, + len); return -1; } if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { printf("%s: Invalid last error value: 0x%08" PRIX32 ". Expected 0x%08X (ERROR_INSUFFICIENT_BUFFER)\n", - __FUNCTION__, GetLastError(), ERROR_INSUFFICIENT_BUFFER); + __func__, GetLastError(), ERROR_INSUFFICIENT_BUFFER); return -1; } @@ -34,19 +34,19 @@ int TestLibraryGetModuleFileName(int argc, char* argv[]) len = GetModuleFileNameA(NULL, ModuleFileName, sizeof(ModuleFileName)); 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()); return -1; } if (len == sizeof(ModuleFileName)) { - printf("%s: GetModuleFileNameA unexpectedly returned nSize\n", __FUNCTION__); + printf("%s: GetModuleFileNameA unexpectedly returned nSize\n", __func__); return -1; } if (GetLastError() != ERROR_SUCCESS) { 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; } diff --git a/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c b/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c index 0a7f43e52..f8117983c 100644 --- a/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c +++ b/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c @@ -21,7 +21,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[]) WINPR_UNUSED(argv); 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; } @@ -29,7 +29,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[]) 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; } @@ -37,23 +37,23 @@ int TestLibraryGetProcAddress(int argc, char* argv[]) NativePathCchAppendA(LibraryPath, PATHCCH_MAX_CCH, "TestLibraryA"); SharedLibraryExtension = PathGetSharedLibraryExtensionA(PATH_SHARED_LIB_EXT_WITH_DOT); 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))) { - printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); + printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __func__, GetLastError()); return -1; } if (!(pFunctionA = (TEST_AB_FN)GetProcAddress(library, "FunctionA"))) { - printf("%s: GetProcAddress failure (FunctionA)\n", __FUNCTION__); + printf("%s: GetProcAddress failure (FunctionA)\n", __func__); return -1; } if (!(pFunctionB = (TEST_AB_FN)GetProcAddress(library, "FunctionB"))) { - printf("%s: GetProcAddress failure (FunctionB)\n", __FUNCTION__); + printf("%s: GetProcAddress failure (FunctionB)\n", __func__); return -1; } @@ -63,7 +63,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[]) if (c != (a * b)) { - printf("%s: pFunctionA call failed\n", __FUNCTION__); + printf("%s: pFunctionA call failed\n", __func__); return -1; } @@ -73,13 +73,13 @@ int TestLibraryGetProcAddress(int argc, char* argv[]) if (c != (a / b)) { - printf("%s: pFunctionB call failed\n", __FUNCTION__); + printf("%s: pFunctionB call failed\n", __func__); return -1; } 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; } diff --git a/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c b/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c index cf60f4d35..b12c72bcb 100644 --- a/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c +++ b/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c @@ -16,7 +16,7 @@ int TestLibraryLoadLibrary(int argc, char* argv[]) WINPR_UNUSED(argv); 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; } @@ -24,7 +24,7 @@ int TestLibraryLoadLibrary(int argc, char* argv[]) 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; } *p = 0; @@ -33,17 +33,17 @@ int TestLibraryLoadLibrary(int argc, char* argv[]) SharedLibraryExtension = PathGetSharedLibraryExtensionA(PATH_SHARED_LIB_EXT_WITH_DOT); 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))) { - printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __FUNCTION__, GetLastError()); + printf("%s: LoadLibraryA failure: 0x%08" PRIX32 "\n", __func__, GetLastError()); return -1; } 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; } diff --git a/winpr/libwinpr/path/test/TestPathAllocCanonicalize.c b/winpr/libwinpr/path/test/TestPathAllocCanonicalize.c index a451c3fa6..d04fff1eb 100644 --- a/winpr/libwinpr/path/test/TestPathAllocCanonicalize.c +++ b/winpr/libwinpr/path/test/TestPathAllocCanonicalize.c @@ -7,6 +7,6 @@ int TestPathAllocCanonicalize(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchAppendEx.c b/winpr/libwinpr/path/test/TestPathCchAppendEx.c index 1e8c1a709..b6d83f5b7 100644 --- a/winpr/libwinpr/path/test/TestPathCchAppendEx.c +++ b/winpr/libwinpr/path/test/TestPathCchAppendEx.c @@ -7,6 +7,6 @@ int TestPathCchAppendEx(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchCanonicalize.c b/winpr/libwinpr/path/test/TestPathCchCanonicalize.c index 6a8114b06..a7fa4ce4d 100644 --- a/winpr/libwinpr/path/test/TestPathCchCanonicalize.c +++ b/winpr/libwinpr/path/test/TestPathCchCanonicalize.c @@ -7,6 +7,6 @@ int TestPathCchCanonicalize(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchCanonicalizeEx.c b/winpr/libwinpr/path/test/TestPathCchCanonicalizeEx.c index c3500cd8b..2d670eb0b 100644 --- a/winpr/libwinpr/path/test/TestPathCchCanonicalizeEx.c +++ b/winpr/libwinpr/path/test/TestPathCchCanonicalizeEx.c @@ -7,6 +7,6 @@ int TestPathCchCanonicalizeEx(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchCombine.c b/winpr/libwinpr/path/test/TestPathCchCombine.c index bd01fa0a8..4b6f4e487 100644 --- a/winpr/libwinpr/path/test/TestPathCchCombine.c +++ b/winpr/libwinpr/path/test/TestPathCchCombine.c @@ -7,6 +7,6 @@ int TestPathCchCombine(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchCombineEx.c b/winpr/libwinpr/path/test/TestPathCchCombineEx.c index 050e36798..89b794f6f 100644 --- a/winpr/libwinpr/path/test/TestPathCchCombineEx.c +++ b/winpr/libwinpr/path/test/TestPathCchCombineEx.c @@ -7,6 +7,6 @@ int TestPathCchCombineEx(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchIsRoot.c b/winpr/libwinpr/path/test/TestPathCchIsRoot.c index 156c7dbc9..1ffda378b 100644 --- a/winpr/libwinpr/path/test/TestPathCchIsRoot.c +++ b/winpr/libwinpr/path/test/TestPathCchIsRoot.c @@ -7,6 +7,6 @@ int TestPathCchIsRoot(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchRemoveBackslash.c b/winpr/libwinpr/path/test/TestPathCchRemoveBackslash.c index 41972c22b..f23e72b98 100644 --- a/winpr/libwinpr/path/test/TestPathCchRemoveBackslash.c +++ b/winpr/libwinpr/path/test/TestPathCchRemoveBackslash.c @@ -7,6 +7,6 @@ int TestPathCchRemoveBackslash(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchRemoveBackslashEx.c b/winpr/libwinpr/path/test/TestPathCchRemoveBackslashEx.c index bfa305f31..80eb1aadf 100644 --- a/winpr/libwinpr/path/test/TestPathCchRemoveBackslashEx.c +++ b/winpr/libwinpr/path/test/TestPathCchRemoveBackslashEx.c @@ -7,6 +7,6 @@ int TestPathCchRemoveBackslashEx(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchRemoveExtension.c b/winpr/libwinpr/path/test/TestPathCchRemoveExtension.c index c96f41ab7..bd315cbd4 100644 --- a/winpr/libwinpr/path/test/TestPathCchRemoveExtension.c +++ b/winpr/libwinpr/path/test/TestPathCchRemoveExtension.c @@ -7,6 +7,6 @@ int TestPathCchRemoveExtension(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchRemoveFileSpec.c b/winpr/libwinpr/path/test/TestPathCchRemoveFileSpec.c index a2484e0e0..686e36750 100644 --- a/winpr/libwinpr/path/test/TestPathCchRemoveFileSpec.c +++ b/winpr/libwinpr/path/test/TestPathCchRemoveFileSpec.c @@ -7,6 +7,6 @@ int TestPathCchRemoveFileSpec(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchRenameExtension.c b/winpr/libwinpr/path/test/TestPathCchRenameExtension.c index d83ef67be..cf021b134 100644 --- a/winpr/libwinpr/path/test/TestPathCchRenameExtension.c +++ b/winpr/libwinpr/path/test/TestPathCchRenameExtension.c @@ -7,6 +7,6 @@ int TestPathCchRenameExtension(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchSkipRoot.c b/winpr/libwinpr/path/test/TestPathCchSkipRoot.c index 24782055f..dca5ad971 100644 --- a/winpr/libwinpr/path/test/TestPathCchSkipRoot.c +++ b/winpr/libwinpr/path/test/TestPathCchSkipRoot.c @@ -7,6 +7,6 @@ int TestPathCchSkipRoot(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathCchStripToRoot.c b/winpr/libwinpr/path/test/TestPathCchStripToRoot.c index dea70c204..3b96e5c16 100644 --- a/winpr/libwinpr/path/test/TestPathCchStripToRoot.c +++ b/winpr/libwinpr/path/test/TestPathCchStripToRoot.c @@ -7,6 +7,6 @@ int TestPathCchStripToRoot(int argc, char* argv[]) { - printf("Warning: %s is not implemented!\n", __FUNCTION__); + printf("Warning: %s is not implemented!\n", __func__); return 0; } diff --git a/winpr/libwinpr/path/test/TestPathMakePath.c b/winpr/libwinpr/path/test/TestPathMakePath.c index 7475329e3..0309b9a94 100644 --- a/winpr/libwinpr/path/test/TestPathMakePath.c +++ b/winpr/libwinpr/path/test/TestPathMakePath.c @@ -79,6 +79,6 @@ int TestPathMakePath(int argc, char* argv[]) } free(path); - printf("%s success!\n", __FUNCTION__); + printf("%s success!\n", __func__); return 0; } diff --git a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c index bff822015..68e044338 100644 --- a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c +++ b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c @@ -39,19 +39,19 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg) 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; } 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; } 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; } @@ -63,7 +63,7 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg) NULL) || lpNumberOfBytesWritten != nNumberOfBytesToWrite) { - printf("%s: Client NamedPipe WriteFile failure\n", __FUNCTION__); + printf("%s: Client NamedPipe WriteFile failure\n", __func__); goto out; } @@ -74,7 +74,7 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg) if (!ReadFile(hNamedPipe, lpReadBuffer, nNumberOfBytesToRead, &lpNumberOfBytesRead, NULL) || lpNumberOfBytesRead != nNumberOfBytesToRead) { - printf("%s: Client NamedPipe ReadFile failure\n", __FUNCTION__); + printf("%s: Client NamedPipe ReadFile failure\n", __func__); goto out; } @@ -110,13 +110,13 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg) if (!hNamedPipe) { - printf("%s: CreateNamedPipe failure: NULL handle\n", __FUNCTION__); + printf("%s: CreateNamedPipe failure: NULL handle\n", __func__); goto out; } 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; } @@ -135,19 +135,19 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg) if (!fConnected) { - printf("%s: ConnectNamedPipe failure\n", __FUNCTION__); + printf("%s: ConnectNamedPipe failure\n", __func__); goto out; } 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; } 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; } @@ -157,7 +157,7 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg) if (!ReadFile(hNamedPipe, lpReadBuffer, nNumberOfBytesToRead, &lpNumberOfBytesRead, NULL) || lpNumberOfBytesRead != nNumberOfBytesToRead) { - printf("%s: Server NamedPipe ReadFile failure\n", __FUNCTION__); + printf("%s: Server NamedPipe ReadFile failure\n", __func__); goto out; } @@ -171,7 +171,7 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg) NULL) || lpNumberOfBytesWritten != nNumberOfBytesToWrite) { - printf("%s: Server NamedPipe WriteFile failure\n", __FUNCTION__); + printf("%s: Server NamedPipe WriteFile failure\n", __func__); goto out; } @@ -208,7 +208,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, 0, NULL))) { - printf("%s: CreateNamedPipe #%d failed\n", __FUNCTION__, i); + printf("%s: CreateNamedPipe #%d failed\n", __func__, i); goto out; } } @@ -221,29 +221,28 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) 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); goto out; } if (p->clientfd != -1) { - printf("%s: Unexpected client fd value for pipe #%d (%d instead of -1)\n", __FUNCTION__, - i, p->clientfd); + printf("%s: Unexpected client fd value for pipe #%d (%d instead of -1)\n", __func__, i, + p->clientfd); goto out; } 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); goto out; } if (p->ServerMode == FALSE) { - printf("%s: Unexpected ServerMode value for pipe #%d (0 instead of 1)\n", __FUNCTION__, - i); + printf("%s: Unexpected ServerMode value for pipe #%d (0 instead of 1)\n", __func__, i); 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, 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; } @@ -273,8 +272,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) if (!fConnected) { - printf("%s: ConnectNamedPipe #%d failed. (%" PRIu32 ")\n", __FUNCTION__, i, - GetLastError()); + printf("%s: ConnectNamedPipe #%d failed. (%" PRIu32 ")\n", __func__, i, GetLastError()); goto out; } } @@ -287,15 +285,14 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) 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); goto out; } if (p->ServerMode) { - printf("%s: Unexpected ServerMode value for pipe #%d (1 instead of 0)\n", __FUNCTION__, - i); + printf("%s: Unexpected ServerMode value for pipe #%d (1 instead of 0)\n", __func__, i); goto out; } } @@ -311,20 +308,19 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) if (!WriteFile(clients[i], sndbuf, sizeof(sndbuf), &dwWritten, NULL) || 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; } 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; } if (memcmp(sndbuf, rcvbuf, sizeof(sndbuf))) { - printf("%s: Error data read on server end of pipe #%d is corrupted\n", __FUNCTION__, - i); + printf("%s: Error data read on server end of pipe #%d is corrupted\n", __func__, i); goto out; } } @@ -339,20 +335,19 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) if (!WriteFile(servers[i], sndbuf, sizeof(sndbuf), &dwWritten, NULL) || 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; } 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; } if (memcmp(sndbuf, rcvbuf, sizeof(sndbuf))) { - printf("%s: Error data read on client end of pipe #%d is corrupted\n", __FUNCTION__, - i); + printf("%s: Error data read on client end of pipe #%d is corrupted\n", __func__, i); 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 " "server\n", - __FUNCTION__); + __func__); goto out; } @@ -381,7 +376,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) printf( "%s: Error WriteFile on client end should have failed after DisconnectNamedPipe on " "server\n", - __FUNCTION__); + __func__); goto out; } } @@ -403,7 +398,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) { printf( "%s: Error ReadFile on client end should have failed after CloseHandle on server\n", - __FUNCTION__); + __func__); 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 " "server\n", - __FUNCTION__); + __func__); goto out; } } @@ -432,7 +427,7 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) { printf( "%s: Error ReadFile on server end should have failed after CloseHandle on client\n", - __FUNCTION__); + __func__); 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 " "client\n", - __FUNCTION__); + __func__); goto out; } } diff --git a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c index 0fa21630e..511e4eedb 100644 --- a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c +++ b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c @@ -358,12 +358,12 @@ int TestPipeCreateNamedPipeOverlapped(int argc, char* argv[]) 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; } 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; } @@ -383,12 +383,12 @@ out: if (result == 0) { printf("%s: Error, this test is currently expected not to succeed on this platform.\n", - __FUNCTION__); + __func__); result = -1; } 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; } #endif diff --git a/winpr/libwinpr/sspi/NTLM/ntlm.c b/winpr/libwinpr/sspi/NTLM/ntlm.c index 4b10316e6..7ebe85285 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm.c @@ -43,7 +43,7 @@ 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) { BOOL rc = TRUE; diff --git a/winpr/libwinpr/sspi/NTLM/ntlm_compute.c b/winpr/libwinpr/sspi/NTLM/ntlm_compute.c index b91b84cec..9d33c178f 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm_compute.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm_compute.c @@ -38,7 +38,7 @@ #define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, 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_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( 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; Stream_Write_UINT8(s, versionInfo->ProductMajorVersion); /* ProductMajorVersion (1 byte) */ diff --git a/winpr/libwinpr/sspi/NTLM/ntlm_message.c b/winpr/libwinpr/sspi/NTLM/ntlm_message.c index 21f08dac9..47be964e7 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm_message.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm_message.c @@ -37,7 +37,7 @@ #define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, 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' }; @@ -436,7 +436,7 @@ static BOOL ntlm_write_negotiate_flags(wStream* s, UINT32 flags, const char* nam WINPR_ASSERT(name); 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)) return FALSE; diff --git a/winpr/libwinpr/synch/test/TestSynchBarrier.c b/winpr/libwinpr/synch/test/TestSynchBarrier.c index 316906328..67a661229 100644 --- a/winpr/libwinpr/synch/test/TestSynchBarrier.c +++ b/winpr/libwinpr/synch/test/TestSynchBarrier.c @@ -74,17 +74,17 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo expectedFalseCount = dwLoops * (dwThreads - 1); printf("%s: >> Testing with flags 0x%08" PRIx32 ". Using %" PRIu32 " threads performing %" PRIu32 " loops\n", - __FUNCTION__, dwFlags, dwThreads, dwLoops); + __func__, dwFlags, dwThreads, dwLoops); 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; } if (!InitializeSynchronizationBarrier(&gBarrier, dwThreads, -1)) { - printf("%s: InitializeSynchronizationBarrier failed. GetLastError() = 0x%08x", __FUNCTION__, + printf("%s: InitializeSynchronizationBarrier failed. GetLastError() = 0x%08x", __func__, GetLastError()); free(threads); DeleteSynchronizationBarrier(&gBarrier); @@ -93,7 +93,7 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo 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); DeleteSynchronizationBarrier(&gBarrier); 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))) { - printf("%s: CreateThread failed for thread #%" PRIu32 " with error 0x%08x\n", - __FUNCTION__, i, GetLastError()); + printf("%s: CreateThread failed for thread #%" PRIu32 " with error 0x%08x\n", __func__, + i, GetLastError()); InterlockedIncrement(&gErrorCount); break; } @@ -114,7 +114,7 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo { 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()); InterlockedIncrement(&gErrorCount); } @@ -125,14 +125,14 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo { printf("%s: WaitForSingleObject(thread[%" PRIu32 "] unexpectedly returned %" PRIu32 " (error = 0x%08x)\n", - __FUNCTION__, i, dwStatus, GetLastError()); + __func__, i, dwStatus, GetLastError()); InterlockedIncrement(&gErrorCount); } if (!CloseHandle(threads[i])) { printf("%s: CloseHandle(thread[%" PRIu32 "]) failed with error = 0x%08x)\n", - __FUNCTION__, i, GetLastError()); + __func__, i, GetLastError()); InterlockedIncrement(&gErrorCount); } } @@ -142,7 +142,7 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo 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()); InterlockedIncrement(&gErrorCount); } @@ -158,18 +158,17 @@ static BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLo if (p.falseCount != (INT64)expectedFalseCount) InterlockedIncrement(&gErrorCount); - printf("%s: error count: %" PRId32 "\n", __FUNCTION__, gErrorCount); - printf("%s: thread count: %" PRId32 " (expected %" PRIu32 ")\n", __FUNCTION__, p.threadCount, + printf("%s: error count: %" PRId32 "\n", __func__, gErrorCount); + printf("%s: thread count: %" PRId32 " (expected %" PRIu32 ")\n", __func__, p.threadCount, dwThreads); - printf("%s: true count: %" PRId32 " (expected %" PRIu32 ")\n", __FUNCTION__, p.trueCount, + printf("%s: true count: %" PRId32 " (expected %" PRIu32 ")\n", __func__, p.trueCount, expectedTrueCount); - printf("%s: false count: %" PRId32 " (expected %" PRIu32 ")\n", __FUNCTION__, p.falseCount, + printf("%s: false count: %" PRId32 " (expected %" PRIu32 ")\n", __func__, p.falseCount, expectedFalseCount); if (gErrorCount > 0) { - printf("%s: Error test failed with %" PRId32 " reported errors\n", __FUNCTION__, - gErrorCount); + printf("%s: Error test failed with %" PRId32 " reported errors\n", __func__, gErrorCount); return FALSE; } @@ -187,7 +186,7 @@ int TestSynchBarrier(int argc, char* argv[]) WINPR_UNUSED(argv); 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; dwMaxThreads = sysinfo.dwNumberOfProcessors * 4; @@ -200,7 +199,7 @@ int TestSynchBarrier(int argc, char* argv[]) fprintf( stderr, "%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = 0\n", - __FUNCTION__); + __func__); return -1; } @@ -209,7 +208,7 @@ int TestSynchBarrier(int argc, char* argv[]) fprintf( stderr, "%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = -1\n", - __FUNCTION__); + __func__); return -1; } @@ -218,7 +217,7 @@ int TestSynchBarrier(int argc, char* argv[]) fprintf( stderr, "%s: InitializeSynchronizationBarrier unecpectedly succeeded with lSpinCount = -2\n", - __FUNCTION__); + __func__); return -1; } @@ -228,7 +227,7 @@ int TestSynchBarrier(int argc, char* argv[]) { fprintf(stderr, "%s: TestSynchBarrierWithFlags(0) unecpectedly succeeded with lTotalThreads = -1\n", - __FUNCTION__); + __func__); return -1; } @@ -238,7 +237,7 @@ int TestSynchBarrier(int argc, char* argv[]) fprintf(stderr, "%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY) " "unecpectedly succeeded with lTotalThreads = -1\n", - __FUNCTION__); + __func__); return -1; } @@ -248,10 +247,10 @@ int TestSynchBarrier(int argc, char* argv[]) fprintf(stderr, "%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY) " "unecpectedly succeeded with lTotalThreads = -1\n", - __FUNCTION__); + __func__); return -1; } - printf("%s: Test successfully completed\n", __FUNCTION__); + printf("%s: Test successfully completed\n", __func__); return 0; } diff --git a/winpr/libwinpr/synch/test/TestSynchInit.c b/winpr/libwinpr/synch/test/TestSynchInit.c index c7b0cd3ca..8f460ae51 100644 --- a/winpr/libwinpr/synch/test/TestSynchInit.c +++ b/winpr/libwinpr/synch/test/TestSynchInit.c @@ -35,7 +35,7 @@ static BOOL CALLBACK TestOnceFunction(PINIT_ONCE once, PVOID param, PVOID* conte { return TRUE; } - fprintf(stderr, "%s: error: called again after success\n", __FUNCTION__); + fprintf(stderr, "%s: error: called again after success\n", __func__); InterlockedIncrement(pErrors); return FALSE; } @@ -50,7 +50,7 @@ static DWORD WINAPI TestThreadFunction(LPVOID lpParam) InterlockedIncrement(pTestThreadFunctionCalls); 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); return 0; } @@ -59,7 +59,7 @@ static DWORD WINAPI TestThreadFunction(LPVOID lpParam) calls = InterlockedIncrement(pInitOnceExecuteOnceCalls); if (!ok && calls > TEST_NUM_FAILURES) { - fprintf(stderr, "%s: InitOnceExecuteOnce failed unexpectedly\n", __FUNCTION__); + fprintf(stderr, "%s: InitOnceExecuteOnce failed unexpectedly\n", __func__); InterlockedIncrement(pErrors); } return 0; diff --git a/winpr/libwinpr/synch/test/TestSynchMultipleThreads.c b/winpr/libwinpr/synch/test/TestSynchMultipleThreads.c index 16e92dbf3..e481da559 100644 --- a/winpr/libwinpr/synch/test/TestSynchMultipleThreads.c +++ b/winpr/libwinpr/synch/test/TestSynchMultipleThreads.c @@ -26,7 +26,7 @@ static int start_threads(DWORD count, HANDLE* threads) if (!threads[i]) { - fprintf(stderr, "%s: CreateThread [%" PRIu32 "] failure\n", __FUNCTION__, i); + fprintf(stderr, "%s: CreateThread [%" PRIu32 "] failure\n", __func__, i); return -1; } } @@ -48,7 +48,7 @@ static int close_threads(DWORD count, HANDLE* threads) if (!CloseHandle(threads[i])) { - fprintf(stderr, "%s: CloseHandle [%" PRIu32 "] failure\n", __FUNCTION__, i); + fprintf(stderr, "%s: CloseHandle [%" PRIu32 "] failure\n", __func__, i); rc = -1; } threads[i] = NULL; @@ -65,7 +65,7 @@ static BOOL TestWaitForAll(void) /* WaitForAll, timeout */ if (start_threads(THREADS, threads)) { - fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: start_threads failed\n", __func__); goto fail; } @@ -73,13 +73,13 @@ static BOOL TestWaitForAll(void) if (ret != WAIT_TIMEOUT) { fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 50 failed, ret=%d\n", - __FUNCTION__, ret); + __func__, ret); goto fail; } 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; } @@ -87,7 +87,7 @@ static BOOL TestWaitForAll(void) fail: if (close_threads(THREADS, threads)) { - fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: close_threads failed\n", __func__); return FALSE; } @@ -102,20 +102,20 @@ static BOOL TestWaitOne(void) /* WaitForAll, timeout */ if (start_threads(THREADS, threads)) { - fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: start_threads failed\n", __func__); goto fail; } ret = WaitForMultipleObjects(THREADS, threads, FALSE, INFINITE); if (ret > (WAIT_OBJECT_0 + THREADS)) { - fprintf(stderr, "%s: WaitForMultipleObjects INFINITE failed\n", __FUNCTION__); + fprintf(stderr, "%s: WaitForMultipleObjects INFINITE failed\n", __func__); goto fail; } 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; } @@ -123,7 +123,7 @@ static BOOL TestWaitOne(void) fail: if (close_threads(THREADS, threads)) { - fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: close_threads failed\n", __func__); return FALSE; } @@ -138,28 +138,27 @@ static BOOL TestWaitOneTimeout(void) /* WaitForAll, timeout */ if (start_threads(THREADS, threads)) { - fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: start_threads failed\n", __func__); goto fail; } ret = WaitForMultipleObjects(THREADS, threads, FALSE, 1); if (ret != WAIT_TIMEOUT) { - fprintf(stderr, "%s: WaitForMultipleObjects timeout 50 failed, ret=%d\n", __FUNCTION__, - ret); + fprintf(stderr, "%s: WaitForMultipleObjects timeout 50 failed, ret=%d\n", __func__, ret); goto fail; } 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; } rc = TRUE; fail: if (close_threads(THREADS, threads)) { - fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: close_threads failed\n", __func__); return FALSE; } @@ -174,7 +173,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void) /* WaitForAll, timeout */ if (start_threads(THREADS, threads)) { - fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: start_threads failed\n", __func__); goto fail; } @@ -183,15 +182,14 @@ static BOOL TestWaitOneTimeoutMultijoin(void) ret = WaitForMultipleObjects(THREADS, threads, FALSE, 0); if (ret != WAIT_TIMEOUT) { - fprintf(stderr, "%s: WaitForMultipleObjects timeout 0 failed, ret=%d\n", __FUNCTION__, - ret); + fprintf(stderr, "%s: WaitForMultipleObjects timeout 0 failed, ret=%d\n", __func__, ret); goto fail; } } 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; } @@ -199,7 +197,7 @@ static BOOL TestWaitOneTimeoutMultijoin(void) fail: if (close_threads(THREADS, threads)) { - fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: close_threads failed\n", __func__); return FALSE; } @@ -213,7 +211,7 @@ static BOOL TestDetach(void) /* WaitForAll, timeout */ if (start_threads(THREADS, threads)) { - fprintf(stderr, "%s: start_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: start_threads failed\n", __func__); goto fail; } @@ -221,7 +219,7 @@ static BOOL TestDetach(void) fail: if (close_threads(THREADS, threads)) { - fprintf(stderr, "%s: close_threads failed\n", __FUNCTION__); + fprintf(stderr, "%s: close_threads failed\n", __func__); return FALSE; } diff --git a/winpr/libwinpr/synch/test/TestSynchMutex.c b/winpr/libwinpr/synch/test/TestSynchMutex.c index 40bfacbbd..56344f1b4 100644 --- a/winpr/libwinpr/synch/test/TestSynchMutex.c +++ b/winpr/libwinpr/synch/test/TestSynchMutex.c @@ -10,7 +10,7 @@ static BOOL test_mutex_basic(void) if (!(mutex = CreateMutex(NULL, FALSE, NULL))) { - printf("%s: CreateMutex failed\n", __FUNCTION__); + printf("%s: CreateMutex failed\n", __func__); return FALSE; } @@ -18,25 +18,25 @@ static BOOL test_mutex_basic(void) 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; } if (!ReleaseMutex(mutex)) { - printf("%s: ReleaseMutex failed\n", __FUNCTION__); + printf("%s: ReleaseMutex failed\n", __func__); return FALSE; } 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; } if (!CloseHandle(mutex)) { - printf("%s: CloseHandle on mutex failed\n", __FUNCTION__); + printf("%s: CloseHandle on mutex failed\n", __func__); return FALSE; } @@ -50,7 +50,7 @@ static BOOL test_mutex_recursive(void) if (!(mutex = CreateMutex(NULL, TRUE, NULL))) { - printf("%s: CreateMutex failed\n", __FUNCTION__); + printf("%s: CreateMutex failed\n", __func__); return FALSE; } @@ -61,7 +61,7 @@ static BOOL test_mutex_recursive(void) if (rc != WAIT_OBJECT_0) { printf("%s: WaitForSingleObject #%" PRIu32 " on mutex failed with %" PRIu32 "\n", - __FUNCTION__, i, rc); + __func__, i, rc); return FALSE; } } @@ -70,7 +70,7 @@ static BOOL test_mutex_recursive(void) { if (!ReleaseMutex(mutex)) { - printf("%s: ReleaseMutex #%" PRIu32 " failed\n", __FUNCTION__, i); + printf("%s: ReleaseMutex #%" PRIu32 " failed\n", __func__, i); return FALSE; } } @@ -78,19 +78,19 @@ static BOOL test_mutex_recursive(void) if (!ReleaseMutex(mutex)) { /* Note: The mutex was initially owned ! */ - printf("%s: Final ReleaseMutex failed\n", __FUNCTION__); + printf("%s: Final ReleaseMutex failed\n", __func__); return FALSE; } 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; } if (!CloseHandle(mutex)) { - printf("%s: CloseHandle on mutex failed\n", __FUNCTION__); + printf("%s: CloseHandle on mutex failed\n", __func__); return FALSE; } @@ -108,7 +108,7 @@ static DWORD WINAPI test_mutex_thread1(LPVOID lpParam) 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; } @@ -127,7 +127,7 @@ static DWORD WINAPI test_mutex_thread1(LPVOID lpParam) fprintf(stderr, "%s: WaitForSingleObject on thread1_mutex1 unexpectedly returned %" PRIu32 " instead of WAIT_TIMEOUT (%u)\n", - __FUNCTION__, rc, WAIT_TIMEOUT); + __func__, rc, WAIT_TIMEOUT); return 0; } @@ -138,13 +138,13 @@ static DWORD WINAPI test_mutex_thread1(LPVOID lpParam) fprintf(stderr, "%s: WaitForSingleObject on thread1_mutex2 unexpectedly returned %" PRIu32 " instead of WAIT_OBJECT_0\n", - __FUNCTION__, rc); + __func__, rc); return 0; } 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; } @@ -159,19 +159,19 @@ static BOOL test_mutex_threading(void) 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; } 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; } 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; } @@ -179,7 +179,7 @@ static BOOL test_mutex_threading(void) 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; } @@ -187,7 +187,7 @@ static BOOL test_mutex_threading(void) if (!thread1_failed) { - fprintf(stderr, "%s: thread1 premature success\n", __FUNCTION__); + fprintf(stderr, "%s: thread1 premature success\n", __func__); goto fail; } @@ -195,13 +195,13 @@ static BOOL test_mutex_threading(void) 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; } 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; } @@ -212,13 +212,13 @@ static BOOL test_mutex_threading(void) 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; } 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; } diff --git a/winpr/libwinpr/sysinfo/test/TestGetComputerName.c b/winpr/libwinpr/sysinfo/test/TestGetComputerName.c index ffbe774f9..f06131e0e 100644 --- a/winpr/libwinpr/sysinfo/test/TestGetComputerName.c +++ b/winpr/libwinpr/sysinfo/test/TestGetComputerName.c @@ -39,14 +39,14 @@ static BOOL Test_GetComputerName(void) if (GetComputerNameA(NULL, &dwSize) == TRUE) { fprintf(stderr, "%s: (1) GetComputerNameA unexpectedly succeeded with null buffer\n", - __FUNCTION__); + __func__); return FALSE; } if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW) { fprintf(stderr, "%s: (2) GetLastError returned 0x%08" PRIX32 " (expected ERROR_BUFFER_OVERFLOW)\n", - __FUNCTION__, dwError); + __func__, dwError); return FALSE; } @@ -56,14 +56,14 @@ static BOOL Test_GetComputerName(void) { fprintf(stderr, "%s: (3) GetComputerNameA unexpectedly succeeded with zero size parameter\n", - __FUNCTION__); + __func__); return FALSE; } if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW) { fprintf(stderr, "%s: (4) GetLastError returned 0x%08" PRIX32 " (expected ERROR_BUFFER_OVERFLOW)\n", - __FUNCTION__, dwError); + __func__, dwError); return FALSE; } /* 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, "%s: (5) GetComputerNameA returned wrong size %" PRIu32 " (expected something in the range from 2 to %" PRIu32 ")\n", - __FUNCTION__, dwSize, netbiosBufferSize); + __func__, dwSize, netbiosBufferSize); return FALSE; } dwNameLength = dwSize - 1; @@ -81,8 +81,8 @@ static BOOL Test_GetComputerName(void) /* test with returned size */ if (GetComputerNameA(netbiosName1, &dwSize) == FALSE) { - fprintf(stderr, "%s: (6) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", - __FUNCTION__, GetLastError()); + fprintf(stderr, "%s: (6) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", __func__, + GetLastError()); return FALSE; } /* check if returned size is valid */ @@ -90,13 +90,13 @@ static BOOL Test_GetComputerName(void) { fprintf(stderr, "%s: (7) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n", - __FUNCTION__, dwSize, dwNameLength); + __func__, dwSize, dwNameLength); return FALSE; } /* check if string is correctly terminated */ if (netbiosName1[dwSize] != 0) { - fprintf(stderr, "%s: (8) string termination error\n", __FUNCTION__); + fprintf(stderr, "%s: (8) string termination error\n", __func__); return FALSE; } @@ -104,8 +104,8 @@ static BOOL Test_GetComputerName(void) dwSize = netbiosBufferSize; if (GetComputerNameA(netbiosName2, &dwSize) == FALSE) { - fprintf(stderr, "%s: (9) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", - __FUNCTION__, GetLastError()); + fprintf(stderr, "%s: (9) GetComputerNameA failed with error: 0x%08" PRIX32 "\n", __func__, + GetLastError()); return FALSE; } /* check if returned size is valid */ @@ -114,20 +114,20 @@ static BOOL Test_GetComputerName(void) fprintf(stderr, "%s: (10) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n", - __FUNCTION__, dwSize, dwNameLength); + __func__, dwSize, dwNameLength); return FALSE; } /* check if string is correctly terminated */ if (netbiosName2[dwSize] != 0) { - fprintf(stderr, "%s: (11) string termination error\n", __FUNCTION__); + fprintf(stderr, "%s: (11) string termination error\n", __func__); return FALSE; } /* compare the results */ if (strcmp(netbiosName1, netbiosName2)) { - fprintf(stderr, "%s: (12) string compare mismatch\n", __FUNCTION__); + fprintf(stderr, "%s: (12) string compare mismatch\n", __func__); return FALSE; } @@ -137,7 +137,7 @@ static BOOL Test_GetComputerName(void) { fprintf(stderr, "%s: (13) GetComputerNameA unexpectedly succeeded with limited buffer size\n", - __FUNCTION__); + __func__); return FALSE; } /* check if returned size is valid */ @@ -146,7 +146,7 @@ static BOOL Test_GetComputerName(void) fprintf(stderr, "%s: (14) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n", - __FUNCTION__, dwSize, dwNameLength + 1); + __func__, dwSize, dwNameLength + 1); return FALSE; } @@ -214,14 +214,14 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) if (GetComputerNameExA(format, NULL, &dwSize) == TRUE) { fprintf(stderr, "%s: (1/%d) GetComputerNameExA unexpectedly succeeded with null buffer\n", - __FUNCTION__, format); + __func__, format); return FALSE; } if ((dwError = GetLastError()) != ERROR_MORE_DATA) { fprintf(stderr, "%s: (2/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n", - __FUNCTION__, format, dwError); + __func__, format, dwError); return FALSE; } @@ -231,14 +231,14 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) { fprintf(stderr, "%s: (3/%d) GetComputerNameExA unexpectedly succeeded with zero size parameter\n", - __FUNCTION__, format); + __func__, format); return FALSE; } if ((dwError = GetLastError()) != ERROR_MORE_DATA) { fprintf(stderr, "%s: (4/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n", - __FUNCTION__, format, dwError); + __func__, format, dwError); return FALSE; } /* 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, "%s: (5/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected something in the range from %" PRIu32 " to %" PRIu32 ")\n", - __FUNCTION__, format, dwSize, dwMinSize, nameBufferSize); + __func__, format, dwSize, dwMinSize, nameBufferSize); return FALSE; } dwNameLength = dwSize - 1; @@ -257,7 +257,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) if (GetComputerNameExA(format, computerName1, &dwSize) == FALSE) { fprintf(stderr, "%s: (6/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n", - __FUNCTION__, format, GetLastError()); + __func__, format, GetLastError()); return FALSE; } /* check if returned size is valid */ @@ -266,13 +266,13 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) fprintf(stderr, "%s: (7/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n", - __FUNCTION__, format, dwSize, dwNameLength); + __func__, format, dwSize, dwNameLength); return FALSE; } /* check if string is correctly terminated */ 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; } @@ -281,7 +281,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) if (GetComputerNameExA(format, computerName2, &dwSize) == FALSE) { fprintf(stderr, "%s: (9/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n", - __FUNCTION__, format, GetLastError()); + __func__, format, GetLastError()); return FALSE; } /* check if returned size is valid */ @@ -290,20 +290,20 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) fprintf(stderr, "%s: (10/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n", - __FUNCTION__, format, dwSize, dwNameLength); + __func__, format, dwSize, dwNameLength); return FALSE; } /* check if string is correctly terminated */ 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; } /* compare the results */ 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; } @@ -313,7 +313,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) { fprintf(stderr, "%s: (13/%d) GetComputerNameExA unexpectedly succeeded with limited buffer size\n", - __FUNCTION__, format); + __func__, format); return FALSE; } /* check if returned size is valid */ @@ -322,7 +322,7 @@ static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format) fprintf(stderr, "%s: (14/%d) GetComputerNameExA returned wrong size %" PRIu32 " (expected %" PRIu32 ")\n", - __FUNCTION__, format, dwSize, dwNameLength + 1); + __func__, format, dwSize, dwNameLength + 1); return FALSE; } diff --git a/winpr/libwinpr/utils/stream.c b/winpr/libwinpr/utils/stream.c index 3cf393bfa..c629e7ca8 100644 --- a/winpr/libwinpr/utils/stream.c +++ b/winpr/libwinpr/utils/stream.c @@ -29,16 +29,16 @@ #define STREAM_TAG WINPR_TAG("wStream") -#define STREAM_ASSERT(cond) \ - do \ - { \ - if (!(cond)) \ - { \ - WLog_FATAL(STREAM_TAG, "%s [%s:%s:%" PRIuz "]", #cond, __FILE__, __FUNCTION__, \ - (size_t)__LINE__); \ - winpr_log_backtrace(STREAM_TAG, WLOG_FATAL, 20); \ - abort(); \ - } \ +#define STREAM_ASSERT(cond) \ + do \ + { \ + if (!(cond)) \ + { \ + WLog_FATAL(STREAM_TAG, "%s [%s:%s:%" PRIuz "]", #cond, __FILE__, __func__, \ + (size_t)__LINE__); \ + winpr_log_backtrace(STREAM_TAG, WLOG_FATAL, 20); \ + abort(); \ + } \ } while (0) BOOL Stream_EnsureCapacity(wStream* s, size_t size) diff --git a/winpr/libwinpr/utils/test/TestBitStream.c b/winpr/libwinpr/utils/test/TestBitStream.c index affa30e9a..bceb052f7 100644 --- a/winpr/libwinpr/utils/test/TestBitStream.c +++ b/winpr/libwinpr/utils/test/TestBitStream.c @@ -66,22 +66,22 @@ int TestBitStream(int argc, char* argv[]) BitStream_Write_Bits(bs, 0xF, 4); /* 1111 */ BitStream_Write_Bits(bs, 0xA, 4); /* 0101 */ 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, 0, 3); /* 000 */ BitStream_Write_Bits(bs, 0x2D, 6); /* 101101 */ BitStream_Write_Bits(bs, 0x19, 5); /* 11001 */ // 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_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, 0xF, 4); /* 1111 */ BitStream_Write_Bits(bs, 0, 20); BitStream_Write_Bits(bs, 0xAFF, 12); /* 111111110101 */ 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); return 0; } diff --git a/winpr/libwinpr/utils/test/TestStream.c b/winpr/libwinpr/utils/test/TestStream.c index 277a7e51c..45484a574 100644 --- a/winpr/libwinpr/utils/test/TestStream.c +++ b/winpr/libwinpr/utils/test/TestStream.c @@ -142,14 +142,14 @@ static BOOL TestStream_Create(size_t count, BOOL selfAlloc) { 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; } } 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; } @@ -175,7 +175,7 @@ static BOOL TestStream_Create(size_t count, BOOL selfAlloc) if (memcmp(buffer, Stream_Buffer(s), cap)) { - printf("%s: buffer memory corruption\n", __FUNCTION__); + printf("%s: buffer memory corruption\n", __func__); goto fail; } } @@ -204,7 +204,7 @@ static BOOL TestStream_Extent(UINT32 maxSize) if (!(s = Stream_New(NULL, 1))) { - printf("%s: Stream_New failed\n", __FUNCTION__); + printf("%s: Stream_New failed\n", __func__); return FALSE; } @@ -226,7 +226,7 @@ static BOOL TestStream_Extent(UINT32 maxSize) 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; } } @@ -247,48 +247,48 @@ fail: #define Stream_Peek_INT8_BE Stream_Peek_INT8 #define Stream_Read_INT8_BE Stream_Read_INT8 -#define TestStream_PeekAndRead(_s, _r, _t) \ - do \ - { \ - _t _a, _b; \ - size_t _i; \ - BYTE* _p = Stream_Buffer(_s); \ - Stream_SetPosition(_s, 0); \ - Stream_Peek_##_t(_s, _a); \ - Stream_Read_##_t(_s, _b); \ - if (_a != _b) \ - { \ - printf("%s: test1 " #_t "_LE failed\n", __FUNCTION__); \ - _r = FALSE; \ - } \ - for (_i = 0; _i < sizeof(_t); _i++) \ - { \ - if (((_a >> (_i * 8)) & 0xFF) != _p[_i]) \ - { \ - printf("%s: test2 " #_t "_LE failed\n", __FUNCTION__); \ - _r = FALSE; \ - break; \ - } \ - } \ - /* printf("a: 0x%016llX\n", a); */ \ - Stream_SetPosition(_s, 0); \ - Stream_Peek_##_t##_BE(_s, _a); \ - Stream_Read_##_t##_BE(_s, _b); \ - if (_a != _b) \ - { \ - printf("%s: test1 " #_t "_BE failed\n", __FUNCTION__); \ - _r = FALSE; \ - } \ - for (_i = 0; _i < sizeof(_t); _i++) \ - { \ - if (((_a >> (_i * 8)) & 0xFF) != _p[sizeof(_t) - _i - 1]) \ - { \ - printf("%s: test2 " #_t "_BE failed\n", __FUNCTION__); \ - _r = FALSE; \ - break; \ - } \ - } \ - /* printf("a: 0x%016llX\n", a); */ \ +#define TestStream_PeekAndRead(_s, _r, _t) \ + do \ + { \ + _t _a, _b; \ + size_t _i; \ + BYTE* _p = Stream_Buffer(_s); \ + Stream_SetPosition(_s, 0); \ + Stream_Peek_##_t(_s, _a); \ + Stream_Read_##_t(_s, _b); \ + if (_a != _b) \ + { \ + printf("%s: test1 " #_t "_LE failed\n", __func__); \ + _r = FALSE; \ + } \ + for (_i = 0; _i < sizeof(_t); _i++) \ + { \ + if (((_a >> (_i * 8)) & 0xFF) != _p[_i]) \ + { \ + printf("%s: test2 " #_t "_LE failed\n", __func__); \ + _r = FALSE; \ + break; \ + } \ + } \ + /* printf("a: 0x%016llX\n", a); */ \ + Stream_SetPosition(_s, 0); \ + Stream_Peek_##_t##_BE(_s, _a); \ + Stream_Read_##_t##_BE(_s, _b); \ + if (_a != _b) \ + { \ + printf("%s: test1 " #_t "_BE failed\n", __func__); \ + _r = FALSE; \ + } \ + for (_i = 0; _i < sizeof(_t); _i++) \ + { \ + if (((_a >> (_i * 8)) & 0xFF) != _p[sizeof(_t) - _i - 1]) \ + { \ + printf("%s: test2 " #_t "_BE failed\n", __func__); \ + _r = FALSE; \ + break; \ + } \ + } \ + /* printf("a: 0x%016llX\n", a); */ \ } while (0) static BOOL TestStream_Reading(void) @@ -299,7 +299,7 @@ static BOOL TestStream_Reading(void) if (!(s = Stream_New(src, sizeof(src)))) { - printf("%s: Stream_New failed\n", __FUNCTION__); + printf("%s: Stream_New failed\n", __func__); return FALSE; } diff --git a/winpr/libwinpr/utils/test/TestWLogCallback.c b/winpr/libwinpr/utils/test/TestWLogCallback.c index c6498a137..df4a6c619 100644 --- a/winpr/libwinpr/utils/test/TestWLogCallback.c +++ b/winpr/libwinpr/utils/test/TestWLogCallback.c @@ -58,19 +58,19 @@ static BOOL CallbackAppenderMessage(const wLogMessage* msg) static BOOL CallbackAppenderData(const wLogMessage* msg) { - fprintf(stdout, "%s\n", __FUNCTION__); + fprintf(stdout, "%s\n", __func__); return TRUE; } static BOOL CallbackAppenderImage(const wLogMessage* msg) { - fprintf(stdout, "%s\n", __FUNCTION__); + fprintf(stdout, "%s\n", __func__); return TRUE; } static BOOL CallbackAppenderPackage(const wLogMessage* msg) { - fprintf(stdout, "%s\n", __FUNCTION__); + fprintf(stdout, "%s\n", __func__); return TRUE; } @@ -86,7 +86,7 @@ int TestWLogCallback(int argc, char* argv[]) WINPR_UNUSED(argc); WINPR_UNUSED(argv); - function = __FUNCTION__; + function = __func__; root = WLog_GetRoot(); diff --git a/winpr/libwinpr/utils/wlog/Appender.c b/winpr/libwinpr/utils/wlog/Appender.c index f4dcce4f1..d56c2b2fe 100644 --- a/winpr/libwinpr/utils/wlog/Appender.c +++ b/winpr/libwinpr/utils/wlog/Appender.c @@ -126,8 +126,7 @@ static wLogAppender* WLog_Appender_New(wLog* log, DWORD logAppenderType) appender = (wLogAppender*)WLog_UdpAppender_New(log); break; default: - fprintf(stderr, "%s: unknown handler type %" PRIu32 "\n", __FUNCTION__, - logAppenderType); + fprintf(stderr, "%s: unknown handler type %" PRIu32 "\n", __func__, logAppenderType); appender = NULL; break; } diff --git a/winpr/libwinpr/utils/wlog/JournaldAppender.c b/winpr/libwinpr/utils/wlog/JournaldAppender.c index 57118c3fc..2b79d3d6f 100644 --- a/winpr/libwinpr/utils/wlog/JournaldAppender.c +++ b/winpr/libwinpr/utils/wlog/JournaldAppender.c @@ -104,7 +104,7 @@ static BOOL WLog_JournaldAppender_WriteMessage(wLog* log, wLogAppender* appender case WLOG_OFF: return TRUE; default: - fprintf(stderr, "%s: unknown level %" PRIu32 "\n", __FUNCTION__, message->Level); + fprintf(stderr, "%s: unknown level %" PRIu32 "\n", __func__, message->Level); return FALSE; } diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c b/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c index 953decc83..ebdfbe2df 100644 --- a/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c @@ -17,7 +17,7 @@ int TestWtsApiEnumerateProcesses(int argc, char* argv[]) #ifndef _WIN32 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; } #endif diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateSessions.c b/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateSessions.c index 8d8a08116..d9f4c7d04 100644 --- a/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateSessions.c +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateSessions.c @@ -18,7 +18,7 @@ int TestWtsApiEnumerateSessions(int argc, char* argv[]) #ifndef _WIN32 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; } #endif diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiQuerySessionInformation.c b/winpr/libwinpr/wtsapi/test/TestWtsApiQuerySessionInformation.c index 24c95cbeb..a26873bfd 100644 --- a/winpr/libwinpr/wtsapi/test/TestWtsApiQuerySessionInformation.c +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiQuerySessionInformation.c @@ -21,7 +21,7 @@ int TestWtsApiQuerySessionInformation(int argc, char* argv[]) #ifndef _WIN32 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; } #endif diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiSessionNotification.c b/winpr/libwinpr/wtsapi/test/TestWtsApiSessionNotification.c index 9276b3d95..d2d741ed5 100644 --- a/winpr/libwinpr/wtsapi/test/TestWtsApiSessionNotification.c +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiSessionNotification.c @@ -16,7 +16,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[]) #ifndef _WIN32 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; } #else @@ -25,8 +25,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[]) NULL, NULL, NULL); if (!hWnd) { - printf("%s: error creating message-only window: %" PRIu32 "\n", __FUNCTION__, - GetLastError()); + printf("%s: error creating message-only window: %" PRIu32 "\n", __func__, GetLastError()); return -1; } #endif @@ -37,7 +36,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[]) if (!bSuccess) { - printf("%s: WTSRegisterSessionNotification failed: %" PRIu32 "\n", __FUNCTION__, + printf("%s: WTSRegisterSessionNotification failed: %" PRIu32 "\n", __func__, GetLastError()); return -1; } @@ -54,7 +53,7 @@ int TestWtsApiSessionNotification(int argc, char* argv[]) if (!bSuccess) { - printf("%s: WTSUnRegisterSessionNotification failed: %" PRIu32 "\n", __FUNCTION__, + printf("%s: WTSUnRegisterSessionNotification failed: %" PRIu32 "\n", __func__, GetLastError()); return -1; } diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiShutdownSystem.c b/winpr/libwinpr/wtsapi/test/TestWtsApiShutdownSystem.c index c5ef73418..6eb763ee8 100644 --- a/winpr/libwinpr/wtsapi/test/TestWtsApiShutdownSystem.c +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiShutdownSystem.c @@ -15,7 +15,7 @@ int TestWtsApiShutdownSystem(int argc, char* argv[]) #ifndef _WIN32 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; } #endif diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiWaitSystemEvent.c b/winpr/libwinpr/wtsapi/test/TestWtsApiWaitSystemEvent.c index 5987202d9..1b84c53bd 100644 --- a/winpr/libwinpr/wtsapi/test/TestWtsApiWaitSystemEvent.c +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiWaitSystemEvent.c @@ -17,7 +17,7 @@ int TestWtsApiWaitSystemEvent(int argc, char* argv[]) #ifndef _WIN32 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; } #endif