Skip to content

Commit

Permalink
corec: add DebugMessage outside of Windows
Browse files Browse the repository at this point in the history
log to stderr.
  • Loading branch information
robUx4 committed Dec 29, 2024
1 parent 793e855 commit 9efdaf3
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libmatroska2/test/mkvtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ void DebugMessage(const tchar_t* Msg,...)
}
#endif
}
#else
#include <stdio.h>
void DebugMessage(const tchar_t* Msg,...)
{
va_list Args;
tchar_t Buffer[1024];

va_start(Args,Msg);
vstprintf_s(Buffer,TSIZEOF(Buffer), Msg, Args);
va_end(Args);
tcscat_s(Buffer,TSIZEOF(Buffer),T("\r\n"));

fprintf(stderr, "%s", Buffer);
}
#endif

static void EndLine(ebml_element *Element)
Expand Down
14 changes: 14 additions & 0 deletions mkclean/mkclean.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ void DebugMessage(const tchar_t* Msg,...)
}
#endif
}
#else
#include <stdio.h>
void DebugMessage(const tchar_t* Msg,...)
{
va_list Args;
tchar_t Buffer[1024];

va_start(Args,Msg);
vstprintf_s(Buffer,TSIZEOF(Buffer), Msg, Args);
va_end(Args);
tcscat_s(Buffer,TSIZEOF(Buffer),T("\r\n"));

fprintf(stderr, "%s", Buffer);
}
#endif

#define EXTRA_SEEK_SPACE 22
Expand Down
14 changes: 14 additions & 0 deletions mkparts/mkparts.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ void DebugMessage(const tchar_t* Msg,...)
}
#endif
}
#else
#include <stdio.h>
void DebugMessage(const tchar_t* Msg,...)
{
va_list Args;
tchar_t Buffer[1024];

va_start(Args,Msg);
vstprintf_s(Buffer,TSIZEOF(Buffer), Msg, Args);
va_end(Args);
tcscat_s(Buffer,TSIZEOF(Buffer),T("\r\n"));

fprintf(stderr, "%s", Buffer);
}
#endif

static int OutputError(int ErrCode, const tchar_t *ErrString, ...)
Expand Down
14 changes: 14 additions & 0 deletions mkvalidator/mkvalidator.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ void DebugMessage(const tchar_t* Msg,...)
}
#endif
}
#else
#include <stdio.h>
void DebugMessage(const tchar_t* Msg,...)
{
va_list Args;
tchar_t Buffer[1024];

va_start(Args,Msg);
vstprintf_s(Buffer,TSIZEOF(Buffer), Msg, Args);
va_end(Args);
tcscat_s(Buffer,TSIZEOF(Buffer),T("\r\n"));

fprintf(stderr, "%s", Buffer);
}
#endif

static const tchar_t *GetProfileName(size_t ProfileNum)
Expand Down

0 comments on commit 9efdaf3

Please sign in to comment.