Commit b5f0ebcb authored by Steve Lhomme's avatar Steve Lhomme

mkclean: handle non-latin command-line characters on windows

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@834 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent 44bbdeec
2012-08-26
version 0.8.7:
- handle non-latin command-line characters on windows
2011-09-25
version 0.8.6:
- correct DisplayUnit that appears to be in pixels but marked as Display Aspect Ratio (DAR)
......
......@@ -1398,7 +1398,11 @@ static void WriteJunk(stream *Output, size_t Amount)
Stream_Write(Output,&Val,1,NULL);
}
#if defined(TARGET_WIN) && defined(UNICODE)
int wmain(int argc, const wchar_t *argv[])
#else
int main(int argc, const char *argv[])
#endif
{
int i,Result = 0;
int ShowUsage = 0;
......@@ -1450,7 +1454,11 @@ int main(int argc, const char *argv[])
memset(StdErr,0,sizeof(_StdErr));
StdErr->Stream = (stream*)NodeSingleton(&p,STDERR_ID);
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[0]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[0]);
#endif
SplitPath(Path,NULL,0,String,TSIZEOF(String),NULL,0);
UnOptimize = tcsisame_ascii(String,T("mkWDclean"));
if (UnOptimize)
......@@ -1459,13 +1467,21 @@ int main(int argc, const char *argv[])
for (i=1;i<argc;++i)
{
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[i]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[i]);
#endif
if (tcsisame_ascii(Path,T("--keep-cues"))) { KeepCues = 1; InputPathIndex = i+1; }
else if (tcsisame_ascii(Path,T("--remux"))) { Remux = 1; InputPathIndex = i+1; }
else if (tcsisame_ascii(Path,T("--live"))) { Live = 1; InputPathIndex = i+1; }
else if (tcsisame_ascii(Path,T("--doctype")) && i+1<argc-1)
{
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[++i]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[++i]);
#endif
if (tcsisame_ascii(Path,T("1")))
DstProfile = PROFILE_MATROSKA_V1;
else if (tcsisame_ascii(Path,T("2")))
......@@ -1487,14 +1503,22 @@ int main(int argc, const char *argv[])
}
else if (tcsisame_ascii(Path,T("--timecodescale")) && i+1<argc-1)
{
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[++i]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[++i]);
#endif
TimeCodeScale = StringToInt(Path,0);
InputPathIndex = i+1;
}
else if (tcsisame_ascii(Path,T("--alt-3d")) && i+1<argc-1)
{
size_t TrackId;
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[++i]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[++i]);
#endif
TrackId = StringToInt(Path,0);
if (ARRAYCOUNT(Alternate3DTracks, block_info*) < (TrackId+1))
{
......@@ -1548,7 +1572,11 @@ int main(int argc, const char *argv[])
goto exit;
}
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[InputPathIndex]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[InputPathIndex]);
#endif
Input = StreamOpen(&p,Path,SFLAG_RDONLY/*|SFLAG_BUFFERED*/);
if (!Input)
{
......@@ -1578,7 +1606,11 @@ int main(int argc, const char *argv[])
stcatprintf_s(Path,TSIZEOF(Path),T("clean.%s"),String);
}
else
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[argc-1]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[argc-1]);
#endif
Output = StreamOpen(&p,Path,SFLAG_WRONLY|SFLAG_CREATE);
if (!Output)
{
......
......@@ -3,7 +3,7 @@
GROUP mkclean_base
{
PROJECT_NAME "mkclean"
PROJECT_VERSION 0.8.6
PROJECT_VERSION 0.8.7
PROJECT_VENDOR "Matroska"
USE matroska2
IF !CONFIG_EBML_UNICODE
......
......@@ -143,7 +143,11 @@ static void testFile(nodecontext *p, int LineNum,const tchar_t *File, tchar_t *M
TextPrintf(StdErr,T("Success:0:%d: %s %s\r\n"),LineNum,File,MkParams);
}
#if defined(TARGET_WIN) && defined(UNICODE)
int wmain(int argc, const wchar_t *argv[])
#else
int main(int argc, const char *argv[])
#endif
{
parsercontext p;
textwriter _StdErr;
......@@ -187,10 +191,18 @@ int main(int argc, const char *argv[])
for (i=1;i<argc;++i)
{
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[i]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[i]);
#endif
if (tcsisame_ascii(Path,T("--version"))) { ShowVersion = 1; }
else if (tcsisame_ascii(Path,T("--help"))) {ShowVersion = 1; ShowUsage = 1; }
#if defined(TARGET_WIN) && defined(UNICODE)
else if (tcsisame_ascii(Path,T("--mkclean"))) Node_FromWcs(&p,MkPath,TSIZEOF(MkPath),argv[++i]);
#else
else if (tcsisame_ascii(Path,T("--mkclean"))) Node_FromStr(&p,MkPath,TSIZEOF(MkPath),argv[++i]);
#endif
else if (tcsisame_ascii(Path,T("--keep"))) KeepOutput = 1;
else if (tcsisame_ascii(Path,T("--quiet"))) {Quiet = 1; }
else if (tcsisame_ascii(Path,T("--generate"))) {Generate = 1; }
......@@ -217,7 +229,11 @@ int main(int argc, const char *argv[])
goto exit;
}
#if defined(TARGET_WIN) && defined(UNICODE)
Node_FromWcs(&p,Path,TSIZEOF(Path),argv[argc-1]);
#else
Node_FromStr(&p,Path,TSIZEOF(Path),argv[argc-1]);
#endif
if (!FileExists((nodecontext*)&p, Path))
{
TextPrintf(StdErr,T("The file with the list of regression files '%s' could not be found!\r\n"),Path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment