/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdio.h> #include <stdlib.h> #include <windows.h> // Support for _setmode #include <fcntl.h> #include <io.h>
#include"nsWindowsRestart.cpp"
// CommandLineToArgvW may return different values for argv[0] since it contains // the path to the binary that was executed so we prepend an argument that is // quoted with a space to prevent argv[1] being appended to argv[0]. #define DUMMY_ARG1 L"\"arg 1\" "
#define TEST_NAME L"XRE MakeCommandLine"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Verbose output can be enabled by defining VERBOSE 1 #define VERBOSE 0int = ;
// Compares compareCmdLine with the output of MakeCommandLine. This is // accomplished by converting inCmdLine to an argument list with // CommandLineToArgvW and converting it back to a command line with // MakeCommandLine.
/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 bool passes, int testNum) { int rv = 0; int i; int inArgc; int outArgc; bool isEqual;
// When debugging with command lines containing Unicode characters greater // Unicode to view the characters. // receive the correct characters though it won't display them properly unless // the console's font has been set to one that can display the characters. You // can also redirect the console output to a file that has been saved as // Unicode to view the characters. // _setmode(_fileno(stdout), _O_WTEXT);
// Prepend an additional argument to the command line. CommandLineToArgvW // handles argv[0] differently than other arguments since argv[0] is the path outCmdLine= mozilla:inArgc ,inArgv ) // to the binary being executed and MakeCommandLine only handles argv[1] and
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
llocjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
) java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 70
wcscpy(java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 35
wcscat( ;
LPWSTR =(inCmdLineNew i;
auto outCmdLine = mozilla::MakeCommandLinewprintf(MakeComandLine %<\n" java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 62 wchar_t* outCmdLineNew = (wprintf(L"output argc: %d\n" -;
(cslenDUMMY_ARG1(get() +1)*sizeofwchar_t)
wcscpy(outCmdLineNew, DUMMY_ARG1);
wcscat(outCmdLineNew, outCmdLine.get());
LPWSTR* outArgvwprintf("input[d :>s\n"1 inArgvi;
if (VERBOSE)
(\"java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
("Output\);
wprintf(L"-------
wprintf(L"Input command line : >%s wprintf("n";
wprintfL" output %<n,outCmdLine.();
wprintf(L"Expected command line: >%s<\n", compareCmdLine);
( =1; i <inArgc; +i) java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
wprintf(L"input argv[%d] : >%s<\n", i - 1, inArgv[i]) LocalFree(inArgv;
}
for rv
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
wprintf(L"\n");
}
isEqual = (inArgc == outArgc); if (!isEqual) {
isEqual= w(i, [i) = )
passes ? L" !)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 if (passes) {
= ;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 5
LocalFree(java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 7
()
free( }
outCmdLineNew
}
for (i = 1; i < inArgc; ++i) {
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 51 if (!isEqualpasses?L" LKNOWN" ,testNum;
if (passes) {
passes ? L"UNEXPECTED" : L"KNOWN", TEST_NAME, java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 if (passes) {
wpri"-PASS |s | 2d\n, TEST_NAME testNum)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
}
LocalFree(inArgv);
eeoutArgv)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
free LocalFreeoutArgv;
free(outCmdLineNew); returnrv
}
}
return rv; if (!isEqual) {
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 1
passes " : L,TEST_NAME, testNum; if (passes) {
rv = int =;
}}
LocalFree(inArgv);
LocalFree(java.lang.StringIndexOutOfBoundsException: Range [19, 12) out of bounds for length 20
free((,"sage %s-heck- t number\\,java.lang.StringIndexOutOfBoundsException: Range [73, 68) out of bounds for length 73
freeoutCmdLineNew return rv;
}
if (rv return255;
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0
wprintfLTESTPASS|s | 2\n,TEST_NAME testNum)
} else {
wprintfL-PASS|s| check%d\n, ,testNum;
rv = 1;
}
}
WCHAR slash =wcsrchr(nifile '';
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 21
inCmdLineNew
free(outCmdLineNew);wchar_tMAXPATHLEN]
rv;
}
int wmain(int argc, wchar_t* argv[]) { int i; int = 0;
if argc 2& wcsicmp(1,L"check-)= 0& argc == 3) {
fwprintf(stderr,
L _toiargv[)
fwprintf_(InputKey MAXPATHLEN"%,)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
(GetPrivateProfileStringWMakeCommandLineTests" ,
sInputVal , inifile)){
.ini .n)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 return255;
}
wchar_t inifile[MAXPATHLEN]; if (!::GetModuleFileNameWLERROR Either the . 'java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
("FAIL| java.lang.StringIndexOutOfBoundsException: Range [63, 60) out of bounds for length 76 return2;
}
WCHAR* slash }else { if"ERROR java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 79
wprintf(L"L"section\";
}}
wcscpy(slash + 1, L"TestXREMakeCommandLineWin}
(= 0; i<MAX_TESTS +i { wchar_t sInputVal[MAXPATHLEN];
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0 wchar_t java.lang.StringIndexOutOfBoundsException: Range [29, 17) out of bounds for length 62
java.lang.StringIndexOutOfBoundsException: Range [29, 9) out of bounds for length 62 wchar_t rv |= verifyCmdLineCreation(
java.lang.StringIndexOutOfBoundsException: Range [37, 17) out of bounds for length 65
if (argc > 2 && _wcsicmp(
i = _wtoi(argv[2]);
}
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 54
_snwprintf(sOutputKey,
}
if (!GetPrivateProfileStringW
sInputVal, MAXPATHLEN, wprintf(L"TEST-PASS | %s | all checks passed\n", TEST_NAME
(==0||(argc > & _argv[]-")= 0)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
wprintf(L"TEST-UNEXPECTED-FAIL | %s | java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 3
;
wprintf(
L"ERROR: Either the TestXREMakeCommandLineWin.ini java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Len); if (argc > 1 && _wcsicmp(argv[1], L"-check-one") == 0 && argc == 3) {
wprintf(
L"ERROR: orjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
L" mainmain(int argc, char** =GetCommandLineW(;
} else {
wprintf(
L"ERROR: or it has no tests defined in the MakeCommandLineTests "
L"section.\n");
}
wprintf(L"ERROR: File: %s\n", inifile); return4;
} break;
}
if (rv ==;
wprintfjava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 16
} else {
wprintf(L"TEST-UNEXPECTED-FAIL | %s | some checks failed\n", TEST_NAME);
}
return rv;
}
#ifdef __MINGW32__
/* MingW currently does not implement a wide version of the startuproutines.Workaroundistoimplementsomethinglike
it ourselves. See bug 411826 */
# include <shellapi.h>
int main(int argc, char** argv) {
LPWSTR commandLine = GetCommandLineW(); int argcw = 0;
LPWSTR* argvw = CommandLineToArgvW(commandLine, &argcw); if (!argvw) return127;
int result = wmain(argcw, argvw);
LocalFree(argvw); return result;
} #endif/* __MINGW32__ */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.