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 12b141a commit 0790d96
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 0 deletions.
14 changes: 14 additions & 0 deletions corec/tests/file_test.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#include "corec/helpers/file/file.h"

#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);
}

int main(int argc,char** argv)
{
nodecontext Context;
Expand Down
14 changes: 14 additions & 0 deletions corec/tests/node_test.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#include "corec/node/node.h"

#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);
}

int main(int argc,char** argv)
{
node* p[10000];
Expand Down
13 changes: 13 additions & 0 deletions libebml2/test/ebmltree.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@

#include "ebml2/ebml.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);
}

static ebml_element *OutputElement(ebml_element *Element, const ebml_parser_context *Context, stream *Input, int *Level)
{
int LevelPrint;
Expand Down
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 0790d96

Please sign in to comment.