Skip to content

Commit

Permalink
Pull in latest yori srcs for all components
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Dec 31, 2024
1 parent fd35071 commit b896c92
Show file tree
Hide file tree
Showing 62 changed files with 10,645 additions and 1,505 deletions.
27 changes: 27 additions & 0 deletions misc/tools/yori/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,18 @@ set(YORI_FILES
yori/edit/edit.h
yori/edit/options.c
yori/lib/Makefile
yori/lib/airplane.c
yori/lib/bargraph.c
yori/lib/builtin.c
yori/lib/bytebuf.c
yori/lib/cabinet.c
yori/lib/call.c
yori/lib/cancel.c
yori/lib/clip.c
yori/lib/cmdline.c
yori/lib/color.c
yori/lib/condrv.c
yori/lib/cpuinfo.c
yori/lib/cshot.c
yori/lib/curdir.c
yori/lib/cvtcons.c
Expand All @@ -82,26 +86,49 @@ set(YORI_FILES
yori/lib/group.c
yori/lib/hash.c
yori/lib/hexdump.c
yori/lib/http.c
yori/lib/iconv.c
yori/lib/jobobj.c
yori/lib/license.c
yori/lib/lineread.c
yori/lib/list.c
yori/lib/malloc.c
yori/lib/movefile.c
yori/lib/numkey.c
yori/lib/obenum.c
yori/lib/osver.c
yori/lib/path.c
yori/lib/printf.c
yori/lib/printf.inc
yori/lib/printfa.c
yori/lib/priv.c
yori/lib/process.c
yori/lib/progman.c
yori/lib/recycle.c
yori/lib/rsrc.c
yori/lib/scheme.c
yori/lib/scut.c
yori/lib/select.c
yori/lib/strarray.c
yori/lib/string.c
yori/lib/strmenum.c
yori/lib/temp.c
yori/lib/update.c
yori/lib/util.c
yori/lib/vt.c
yori/lib/ylhomedr.c
yori/lib/ylstralc.c
yori/lib/ylstrcat.c
yori/lib/ylstrcmp.c
yori/lib/ylstrcnt.c
yori/lib/ylstrcnv.c
yori/lib/ylstrfnd.c
yori/lib/ylstrhex.c
yori/lib/ylstrnum.c
yori/lib/ylstrsrt.c
yori/lib/ylstrtrm.c
yori/lib/ylvolpth.c
yori/lib/ylvtdbg.c
yori/lib/yori.man
yori/lib/yoricall.h
yori/lib/yoricmpt.h
Expand Down
25 changes: 25 additions & 0 deletions misc/tools/yori/yori/crt/ep_cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,31 @@

#if defined(_MSC_VER) && (_MSC_VER >= 1700)
#pragma warning(disable: 26451) // Arithmetic overflow
#if (_MSC_VER >= 1939)
//
// These warnings aim to check for integer overflows when allocating memory,
// resulting in a smaller allocation than expected. Unfortunately the
// implementation is quite bad:
//
// - An allocator is a function with "alloc" in its name, which matches
// Yori's bounds check functions
// - There is no annotation or awareness of a bounds check function, so it
// will catch overflows that have already been checked.
//
// The "best" thing Yori could do here is implement bounds check functions,
// without "alloc" in their names, that return an integer value which is
// supplied directly to the allocator. Note this has the effect of
// disabling these warnings completely anyway, because they only apply to
// "alloc" functions and would not catch overflows as the input of the
// bounds check.
//
// This is quite frustrating because the class of bug these exist to catch
// does exist in Yori and is challenging to completely eliminate.
//
#pragma warning(disable: 26831) // Allocation size might be from overflow
#pragma warning(disable: 26832) // Allocation size from narrowing conversion
#pragma warning(disable: 26833) // Potential overflow before a bounds check
#endif
#endif

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
Expand Down
44 changes: 22 additions & 22 deletions misc/tools/yori/yori/edit/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,15 +808,15 @@ EditSaveFile(
//

if (Line->LengthInChars > 0 && (!AutoIndentActive || LineIndex != AutoIndentLine)) {
if (!YoriLibOutputTextToMultibyteDevice(TempHandle, Line)) {
if (!YoriLibOutputTextToMbyteDev(TempHandle, Line)) {
CloseHandle(TempHandle);
DeleteFile(TempFileName.StartOfString);
YoriLibFreeStringContents(&TempFileName);
YoriLibSetMultibyteOutputEncoding(SavedEncoding);
return FALSE;
}
}
if (!YoriLibOutputTextToMultibyteDevice(TempHandle, &EditContext->Newline)) {
if (!YoriLibOutputTextToMbyteDev(TempHandle, &EditContext->Newline)) {
CloseHandle(TempHandle);
DeleteFile(TempFileName.StartOfString);
YoriLibFreeStringContents(&TempFileName);
Expand Down Expand Up @@ -1384,9 +1384,9 @@ EditSaveAsButtonClicked(
CustomOptionArray[1].Values = LineEndingValues;
CustomOptionArray[1].SelectedValue = 0;

if (YoriLibCompareStringWithLiteral(&EditContext->Newline, _T("\n")) == 0) {
if (YoriLibCompareStringLit(&EditContext->Newline, _T("\n")) == 0) {
CustomOptionArray[1].SelectedValue = 1;
} else if (YoriLibCompareStringWithLiteral(&EditContext->Newline, _T("\r")) == 0) {
} else if (YoriLibCompareStringLit(&EditContext->Newline, _T("\r")) == 0) {
CustomOptionArray[1].SelectedValue = 2;
}

Expand Down Expand Up @@ -1727,9 +1727,9 @@ EditFindNextMatchingString(
Substring.StartOfString = Line->StartOfString + StartOffset;
Substring.LengthInChars = Line->LengthInChars - StartOffset;
if (EditContext->SearchMatchCase) {
Match = YoriLibFindFirstMatchingSubstring(&Substring, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindFirstMatchSubstr(&Substring, 1, &EditContext->SearchString, &Offset);
} else {
Match = YoriLibFindFirstMatchingSubstringInsensitive(&Substring, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindFirstMatchSubstrIns(&Substring, 1, &EditContext->SearchString, &Offset);
}

if (Match != NULL) {
Expand All @@ -1746,9 +1746,9 @@ EditFindNextMatchingString(
for (LineIndex = StartLine + 1; LineIndex < LineCount; LineIndex++) {
Line = YoriWinMultilineEditGetLineByIndex(EditContext->MultilineEdit, LineIndex);
if (EditContext->SearchMatchCase) {
Match = YoriLibFindFirstMatchingSubstring(Line, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindFirstMatchSubstr(Line, 1, &EditContext->SearchString, &Offset);
} else {
Match = YoriLibFindFirstMatchingSubstringInsensitive(Line, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindFirstMatchSubstrIns(Line, 1, &EditContext->SearchString, &Offset);
}
if (Match != NULL) {
*NextMatchLine = LineIndex;
Expand Down Expand Up @@ -1823,9 +1823,9 @@ EditFindPreviousMatchingString(
}
}
if (EditContext->SearchMatchCase) {
Match = YoriLibFindLastMatchingSubstring(&Substring, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindLastMatchSubstr(&Substring, 1, &EditContext->SearchString, &Offset);
} else {
Match = YoriLibFindLastMatchingSubstringInsensitive(&Substring, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindLastMatchSubstrIns(&Substring, 1, &EditContext->SearchString, &Offset);
}

if (Match != NULL) {
Expand All @@ -1841,9 +1841,9 @@ EditFindPreviousMatchingString(
for (LineIndex = StartLine; LineIndex > 0; LineIndex--) {
Line = YoriWinMultilineEditGetLineByIndex(EditContext->MultilineEdit, LineIndex - 1);
if (EditContext->SearchMatchCase) {
Match = YoriLibFindLastMatchingSubstring(Line, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindLastMatchSubstr(Line, 1, &EditContext->SearchString, &Offset);
} else {
Match = YoriLibFindLastMatchingSubstringInsensitive(Line, 1, &EditContext->SearchString, &Offset);
Match = YoriLibFindLastMatchSubstrIns(Line, 1, &EditContext->SearchString, &Offset);
}
if (Match != NULL) {
*NextMatchLine = LineIndex - 1;
Expand Down Expand Up @@ -3163,14 +3163,14 @@ EditEncodingFromString(
__in PYORI_STRING String
)
{
if (YoriLibCompareStringWithLiteralInsensitive(String, _T("utf8")) == 0 &&
if (YoriLibCompareStringLitIns(String, _T("utf8")) == 0 &&
YoriLibIsUtf8Supported()) {
return CP_UTF8;
} else if (YoriLibCompareStringWithLiteralInsensitive(String, _T("ascii")) == 0) {
} else if (YoriLibCompareStringLitIns(String, _T("ascii")) == 0) {
return CP_OEMCP;
} else if (YoriLibCompareStringWithLiteralInsensitive(String, _T("ansi")) == 0) {
} else if (YoriLibCompareStringLitIns(String, _T("ansi")) == 0) {
return CP_ACP;
} else if (YoriLibCompareStringWithLiteralInsensitive(String, _T("utf16")) == 0) {
} else if (YoriLibCompareStringLitIns(String, _T("utf16")) == 0) {
return CP_UTF16;
}
return (DWORD)-1;
Expand Down Expand Up @@ -3231,19 +3231,19 @@ ENTRYPOINT(

if (YoriLibIsCommandLineOption(&ArgV[i], &Arg)) {

if (YoriLibCompareStringWithLiteralInsensitive(&Arg, _T("?")) == 0) {
if (YoriLibCompareStringLitIns(&Arg, _T("?")) == 0) {
EditHelp();
return EXIT_SUCCESS;
} else if (YoriLibCompareStringWithLiteralInsensitive(&Arg, _T("license")) == 0) {
} else if (YoriLibCompareStringLitIns(&Arg, _T("license")) == 0) {
YoriLibDisplayMitLicense(strEditCopyrightYear);
return EXIT_SUCCESS;
} else if (YoriLibCompareStringWithLiteralInsensitive(&Arg, _T("a")) == 0) {
} else if (YoriLibCompareStringLitIns(&Arg, _T("a")) == 0) {
GlobalEditContext.UseAsciiDrawing = TRUE;
ArgumentUnderstood = TRUE;
} else if (YoriLibCompareStringWithLiteralInsensitive(&Arg, _T("b")) == 0) {
} else if (YoriLibCompareStringLitIns(&Arg, _T("b")) == 0) {
GlobalEditContext.UseMonoDisplay = TRUE;
ArgumentUnderstood = TRUE;
} else if (YoriLibCompareStringWithLiteralInsensitive(&Arg, _T("e")) == 0) {
} else if (YoriLibCompareStringLitIns(&Arg, _T("e")) == 0) {
if (ArgC > i + 1) {
DWORD NewEncoding;
NewEncoding = EditEncodingFromString(&ArgV[i + 1]);
Expand All @@ -3253,7 +3253,7 @@ ENTRYPOINT(
i++;
}
}
} else if (YoriLibCompareStringWithLiteralInsensitive(&Arg, _T("r")) == 0) {
} else if (YoriLibCompareStringLitIns(&Arg, _T("r")) == 0) {
GlobalEditContext.ReadOnly = TRUE;
ArgumentUnderstood = TRUE;
}
Expand Down
28 changes: 27 additions & 1 deletion misc/tools/yori/yori/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ compile: yorilib.lib yoriver.obj
!INCLUDE "..\config\common.mk"

OBJS=\
airplane.obj \
bargraph.obj \
builtin.obj \
bytebuf.obj \
cabinet.obj \
call.obj \
cancel.obj \
clip.obj \
cmdline.obj \
color.obj \
condrv.obj \
cpuinfo.obj \
cshot.obj \
curdir.obj \
cvtcons.obj \
Expand All @@ -34,25 +38,47 @@ OBJS=\
group.obj \
hash.obj \
hexdump.obj \
http.obj \
iconv.obj \
jobobj.obj \
license.obj \
lineread.obj \
list.obj \
malloc.obj \
movefile.obj \
numkey.obj \
obenum.obj \
osver.obj \
path.obj \
printf.obj \
printfa.obj \
priv.obj \
process.obj \
progman.obj \
recycle.obj \
rsrc.obj \
scut.obj \
scheme.obj \
select.obj \
strarray.obj \
string.obj \
strmenum.obj \
temp.obj \
update.obj \
util.obj \
vt.obj \
ylhomedr.obj \
ylstralc.obj \
ylstrcat.obj \
ylstrcmp.obj \
ylstrcnt.obj \
ylstrcnv.obj \
ylstrfnd.obj \
ylstrhex.obj \
ylstrnum.obj \
ylstrsrt.obj \
ylstrtrm.obj \
ylvolpth.obj \
ylvtdbg.obj \

all: yorilib.lib yoriver.obj

Expand Down
Loading

0 comments on commit b896c92

Please sign in to comment.