From c1dce327c55f629e706ea3d140deba54ca1eaf6a Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Fri, 9 Feb 2018 18:07:27 +0500 Subject: [PATCH] [src/Mayaqua/Memory.c:1972]: (style) The function 'DelAllInt' is never used. [src/Mayaqua/Memory.c:2068]: (style) The function 'DelInt64' is never used. [src/Mayaqua/Memory.c:2920]: (style) The function 'DumpData' is never used. [src/Mayaqua/Memory.c:835]: (style) The function 'FillBytes' is never used. [src/Mayaqua/Memory.c:2745]: (style) The function 'GetFifoCurrentReallocMemSize' is never used. [src/Mayaqua/Memory.c:1475]: (style) The function 'InsertDistinct' is never used. [src/Mayaqua/Memory.c:2274]: (style) The function 'InsertInt64Distinct' is never used. [src/Mayaqua/Memory.c:1612]: (style) The function 'IsInListUniStr' is never used. [src/Mayaqua/Memory.c:2633]: (style) The function 'LockFifo' is never used. [src/Mayaqua/Memory.c:1120]: (style) The function 'PeekQueue' is never used. [src/Mayaqua/Memory.c:2158]: (style) The function 'RandomizeList' is never used. [src/Mayaqua/Memory.c:1364]: (style) The function 'SetCmp' is never used. [src/Mayaqua/Memory.c:1570]: (style) The function 'SetSortFlag' is never used. [src/Mayaqua/Memory.c:1596]: (style) The function 'SortEx' is never used. [src/Mayaqua/Memory.c:3704]: (style) The function 'Swap' is never used. [src/Mayaqua/Memory.c:2645]: (style) The function 'UnlockFifo' is never used. [src/Mayaqua/Memory.c:2532]: (style) The function 'WriteFifoFront' is never used. --- src/Cedar/WinUi.c | 85 ------------ src/Cedar/WinUi.h | 3 - src/Mayaqua/Memory.c | 312 ------------------------------------------- src/Mayaqua/Memory.h | 17 --- 4 files changed, 417 deletions(-) diff --git a/src/Cedar/WinUi.c b/src/Cedar/WinUi.c index b6a6e61b..a2d685a2 100644 --- a/src/Cedar/WinUi.c +++ b/src/Cedar/WinUi.c @@ -2004,52 +2004,6 @@ void RegistToDontShowFreeEditionDialog(char *server_name) MsRegWriteInt(REG_LOCAL_MACHINE, FREE_REGKEY, server_name, 1); } -// Free Edition dialog procedure -UINT FreeInfoDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - FREEINFO *info = (FREEINFO *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_HUB); - Top(hWnd); - info->hWnd = hWnd; - Set(info->Event); - FormatText(hWnd, S_INFO_2, info->ServerName); - DlgFont(hWnd, S_INFO_1, 13, true); - DlgFont(hWnd, S_INFO_3, 13, false); - DlgFont(hWnd, B_HIDE, 10, true); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - if (IsChecked(hWnd, B_HIDE)) - { - RegistToDontShowFreeEditionDialog(info->ServerName); - } - - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - // Show the Easter Egg void ShowEasterEgg(HWND hWnd) { @@ -6521,18 +6475,6 @@ void LbReset(HWND hWnd, UINT id) SendMsg(hWnd, id, LB_RESETCONTENT, 0, 0); } -// Select by specifying the index -void LbSelectIndex(HWND hWnd, UINT id, UINT index) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, LB_SETCURSEL, index, 0); -} - // Get the data UINT LbGetData(HWND hWnd, UINT id, UINT index) { @@ -6545,33 +6487,6 @@ UINT LbGetData(HWND hWnd, UINT id, UINT index) return SendMsg(hWnd, id, LB_GETITEMDATA, index, 0); } -// Search for the data -UINT LbFindData(HWND hWnd, UINT id, UINT data) -{ - UINT i, num; - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - num = LbNum(hWnd, id); - if (num == INFINITE) - { - return INFINITE; - } - - for (i = 0;i < num;i++) - { - if (LbGetData(hWnd, id, i) == data) - { - return i; - } - } - - return INFINITE; -} - // Password input dialog state change void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p) { diff --git a/src/Cedar/WinUi.h b/src/Cedar/WinUi.h index 6f754139..409b88db 100644 --- a/src/Cedar/WinUi.h +++ b/src/Cedar/WinUi.h @@ -697,9 +697,7 @@ UINT CbGetSelectIndex(HWND hWnd, UINT id); UINT CbGetSelect(HWND hWnd, UINT id); void SetRange(HWND hWnd, UINT id, UINT start, UINT end); void SetPos(HWND hWnd, UINT id, UINT pos); -void LbSelectIndex(HWND hWnd, UINT id, UINT index); UINT LbNum(HWND hWnd, UINT id); -UINT LbFindData(HWND hWnd, UINT id, UINT data); UINT LbGetData(HWND hWnd, UINT id, UINT index); void LbReset(HWND hWnd, UINT id); STATUS_WINDOW *StatusPrinterWindowStart(SOCK *s, wchar_t *account_name); @@ -826,7 +824,6 @@ KAKUSHI *InitKakushi(); void FreeKakushi(KAKUSHI *k); void ShowEasterEgg(HWND hWnd); void RegistToDontShowFreeEditionDialog(char *server_name); -UINT FreeInfoDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); bool Win32CnCheckAlreadyExists(bool lock); void RegistWindowsFirewallAll(); void RegistWindowsFirewallAllEx(char *dir); diff --git a/src/Mayaqua/Memory.c b/src/Mayaqua/Memory.c index 5ccb38e3..bf89ace9 100644 --- a/src/Mayaqua/Memory.c +++ b/src/Mayaqua/Memory.c @@ -831,18 +831,6 @@ LIST *NewCandidateList() return NewList(ComapreCandidate); } -// Fill a range of memory -void FillBytes(void *data, UINT size, UCHAR c) -{ - UCHAR *buf = (UCHAR *)data; - UINT i; - - for (i = 0;i < size;i++) - { - buf[i] = c; - } -} - // Examine whether the specified address points all-zero area bool IsZero(void *data, UINT size) { @@ -1116,28 +1104,6 @@ void *Pop(SK *s) return ret; } -// Peep -void *PeekQueue(QUEUE *q) -{ - void *p = NULL; - // Validate arguments - if (q == NULL) - { - return NULL; - } - - if (q->num_item == 0) - { - // No items - return NULL; - } - - // Read from the FIFO - PeekFifo(q->fifo, &p, sizeof(void *)); - - return p; -} - // Get the number of queued items UINT GetQueueNum(QUEUE *q) { @@ -1360,22 +1326,6 @@ QUEUE *NewQueueFast() return q; } -// Set the comparison function to list -void SetCmp(LIST *o, COMPARE *cmp) -{ - // Validate arguments - if (o == NULL || cmp == NULL) - { - return; - } - - if (o->cmp != cmp) - { - o->cmp = cmp; - o->sorted = false; - } -} - // Clone the list LIST *CloneList(LIST *o) { @@ -1471,23 +1421,6 @@ void *Search(LIST *o, void *target) } } -// Insert an item to the list (Do not insert if it already exists) -void InsertDistinct(LIST *o, void *p) -{ - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - if (IsInList(o, p)) - { - return; - } - - Insert(o, p); -} - // Insert an item to the list void Insert(LIST *o, void *p) { @@ -1566,18 +1499,6 @@ void Insert(LIST *o, void *p) KS_INC(KS_INSERT_COUNT); } -// Setting the sort flag -void SetSortFlag(LIST *o, bool sorted) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - o->sorted = sorted; -} - // Sort the list void Sort(LIST *o) { @@ -1593,43 +1514,6 @@ void Sort(LIST *o) // KS KS_INC(KS_SORT_COUNT); } -void SortEx(LIST *o, COMPARE *cmp) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - qsort(o->p, o->num_item, sizeof(void *), (int(*)(const void *, const void *))cmp); - o->sorted = false; - - // KS - KS_INC(KS_SORT_COUNT); -} - -// Examine whether a certain string items are present in the list (Unicode version) -bool IsInListUniStr(LIST *o, wchar_t *str) -{ - UINT i; - // Validate arguments - if (o == NULL || str == NULL) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t *s = LIST_DATA(o, i); - - if (UniStrCmpi(s, str) == 0) - { - return true; - } - } - - return false; -} // Replace the pointer in the list bool ReplaceListPointer(LIST *o, void *oldptr, void *newptr) @@ -1968,26 +1852,6 @@ bool IsInt64InList(LIST *o, UINT64 i) return false; } -// Remove all int from the interger list -void DelAllInt(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - UINT *p = LIST_DATA(o, i); - - Free(p); - } - - DeleteAll(o); -} - // Release the integer list void ReleaseIntList(LIST *o) { @@ -2065,44 +1929,6 @@ void DelInt(LIST *o, UINT i) ReleaseList(o2); } } -void DelInt64(LIST *o, UINT64 i) -{ - LIST *o2 = NULL; - UINT j; - // Validate arguments - if (o == NULL) - { - return; - } - - for (j = 0;j < LIST_NUM(o);j++) - { - UINT64 *p = LIST_DATA(o, j); - - if (*p == i) - { - if (o2 == NULL) - { - o2 = NewListFast(NULL); - } - Add(o2, p); - } - } - - for (j = 0;j < LIST_NUM(o2);j++) - { - UINT64 *p = LIST_DATA(o2, j); - - Delete(o, p); - - Free(p); - } - - if (o2 != NULL) - { - ReleaseList(o2); - } -} // Create a new list of integers LIST *NewIntList(bool sorted) @@ -2154,41 +1980,6 @@ int CompareInt64(void *p1, void *p2) return COMPARE_RET(*v1, *v2); } -// Randomize the contents of the list -void RandomizeList(LIST *o) -{ - LIST *o2; - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - o2 = NewListFast(NULL); - - while (LIST_NUM(o) != 0) - { - UINT num = LIST_NUM(o); - UINT i = Rand32() % num; - void *p = LIST_DATA(o, i); - - Add(o2, p); - Delete(o, p); - } - - DeleteAll(o); - - for (i = 0;i < LIST_NUM(o2);i++) - { - void *p = LIST_DATA(o2, i); - - Add(o, p); - } - - ReleaseList(o2); -} - // Add an integer to the list void AddInt(LIST *o, UINT i) { @@ -2271,19 +2062,6 @@ void InsertIntDistinct(LIST *o, UINT i) InsertInt(o, i); } } -void InsertInt64Distinct(LIST *o, UINT64 i) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (IsInt64InList(o, i) == false) - { - InsertInt64(o, i); - } -} // String comparison function (Unicode) int CompareUniStr(void *p1, void *p2) @@ -2528,25 +2306,6 @@ void ShrinkFifoMemory(FIFO *f) } } -// Write data to the front of FIFO -void WriteFifoFront(FIFO *f, void *p, UINT size) -{ - // Validate arguments - if (f == NULL || size == 0) - { - return; - } - - if (f->pos < size) - { - PadFifoFront(f, size - f->pos); - } - - Copy(((UCHAR *)f->p) + (f->pos - size), p, size); - f->pos -= size; - f->size += size; -} - // Write to the FIFO void WriteFifo(FIFO *f, void *p, UINT size) { @@ -2629,30 +2388,6 @@ UINT FifoSize(FIFO *f) return f->size; } -// Lock the FIFO -void LockFifo(FIFO *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - Lock(f->lock); -} - -// Unlock the FIFO -void UnlockFifo(FIFO *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - Unlock(f->lock); -} - // Release the FIFO void ReleaseFifo(FIFO *f) { @@ -2741,12 +2476,6 @@ FIFO *NewFifoEx2(bool fast, bool fixed) return f; } -// Get the default memory reclaiming size of the FIFO -UINT GetFifoCurrentReallocMemSize() -{ - return fifo_current_realloc_mem_size; -} - // Set the default memory reclaiming size of the FIFO void SetFifoCurrentReallocMemSize(UINT size) { @@ -2917,25 +2646,6 @@ bool DumpDataW(void *data, UINT size, wchar_t *filename) return true; } -bool DumpData(void *data, UINT size, char *filename) -{ - IO *o; - // Validate arguments - if (filename == NULL || (size != 0 && data == NULL)) - { - return false; - } - - o = FileCreate(filename); - if (o == NULL) - { - return false; - } - FileWrite(o, data, size); - FileClose(o); - - return true; -} // Dump the contents of the buffer to the file bool DumpBuf(BUF *b, char *filename) @@ -3700,28 +3410,6 @@ UINT64 Endian64(UINT64 src) } } -// Swap data of any -void Swap(void *buf, UINT size) -{ - UCHAR *tmp, *src; - UINT i; - // Validate arguments - if (buf == NULL || size == 0) - { - return; - } - - src = (UCHAR *)buf; - tmp = Malloc(size); - for (i = 0;i < size;i++) - { - tmp[size - i - 1] = src[i]; - } - - Copy(buf, tmp, size); - Free(buf); -} - // 16bit swap USHORT Swap16(USHORT value) { diff --git a/src/Mayaqua/Memory.h b/src/Mayaqua/Memory.h index c41ef1ff..d8bef518 100644 --- a/src/Mayaqua/Memory.h +++ b/src/Mayaqua/Memory.h @@ -299,7 +299,6 @@ int B64_Decode(char *set, char *source, int len); UINT Encode64(char *dst, char *src); UINT Decode64(char *dst, char *src); -void Swap(void *buf, UINT size); USHORT Swap16(USHORT value); UINT Swap32(UINT value); UINT64 Swap64(UINT64 value); @@ -337,7 +336,6 @@ void AddBufStr(BUF *b, char *str); bool DumpBuf(BUF *b, char *filename); bool DumpBufW(BUF *b, wchar_t *filename); bool DumpBufWIfNecessary(BUF *b, wchar_t *filename); -bool DumpData(void *data, UINT size, char *filename); bool DumpDataW(void *data, UINT size, wchar_t *filename); BUF *ReadDump(char *filename); BUF *ReadDumpWithMaxSize(char *filename, UINT max_size); @@ -357,11 +355,8 @@ void ShrinkFifoMemory(FIFO *f); UCHAR *GetFifoPointer(FIFO *f); UCHAR *FifoPtr(FIFO *f); void WriteFifo(FIFO *f, void *p, UINT size); -void WriteFifoFront(FIFO *f, void *p, UINT size); void PadFifoFront(FIFO *f, UINT size); UINT FifoSize(FIFO *f); -void LockFifo(FIFO *f); -void UnlockFifo(FIFO *f); void ReleaseFifo(FIFO *f); void CleanupFifo(FIFO *f); FIFO *NewFifo(); @@ -369,16 +364,13 @@ FIFO *NewFifoFast(); FIFO *NewFifoEx(bool fast); FIFO *NewFifoEx2(bool fast, bool fixed); void InitFifo(); -UINT GetFifoCurrentReallocMemSize(); void SetFifoCurrentReallocMemSize(UINT size); void *Search(LIST *o, void *target); void Sort(LIST *o); -void SortEx(LIST *o, COMPARE *cmp); void Add(LIST *o, void *p); void AddDistinct(LIST *o, void *p); void Insert(LIST *o, void *p); -void InsertDistinct(LIST *o, void *p); bool Delete(LIST *o, void *p); bool DeleteKey(LIST *o, UINT key); void DeleteAll(LIST *o); @@ -395,8 +387,6 @@ void CopyToArray(LIST *o, void *p); void *ToArray(LIST *o); void *ToArrayEx(LIST *o, bool fast); LIST *CloneList(LIST *o); -void SetCmp(LIST *o, COMPARE *cmp); -void SetSortFlag(LIST *o, bool sorted); int CompareStr(void *p1, void *p2); bool InsertStr(LIST *o, char *str); int CompareUniStr(void *p1, void *p2); @@ -404,17 +394,14 @@ bool IsInList(LIST *o, void *p); bool IsInListKey(LIST *o, UINT key); void *ListKeyToPointer(LIST *o, UINT key); bool IsInListStr(LIST *o, char *str); -bool IsInListUniStr(LIST *o, wchar_t *str); bool ReplaceListPointer(LIST *o, void *oldptr, void *newptr); void AddInt(LIST *o, UINT i); void AddInt64(LIST *o, UINT64 i); void AddIntDistinct(LIST *o, UINT i); void AddInt64Distinct(LIST *o, UINT64 i); void DelInt(LIST *o, UINT i); -void DelInt64(LIST *o, UINT64 i); void ReleaseIntList(LIST *o); void ReleaseInt64List(LIST *o); -void DelAllInt(LIST *o); bool IsIntInList(LIST *o, UINT i); bool IsInt64InList(LIST *o, UINT64 i); LIST *NewIntList(bool sorted); @@ -424,12 +411,9 @@ int CompareInt64(void *p1, void *p2); void InsertInt(LIST *o, UINT i); void InsertInt64(LIST *o, UINT64 i); void InsertIntDistinct(LIST *o, UINT i); -void InsertInt64Distinct(LIST *o, UINT64 i); -void RandomizeList(LIST *o); void *GetNext(QUEUE *q); void *GetNextWithLock(QUEUE *q); -void *PeekQueue(QUEUE *q); void InsertQueue(QUEUE *q, void *p); void InsertQueueWithLock(QUEUE *q, void *p); void InsertQueueInt(QUEUE *q, UINT value); @@ -458,7 +442,6 @@ BUF *CompressBuf(BUF *src_buf); BUF *UncompressBuf(BUF *src_buf); bool IsZero(void *data, UINT size); -void FillBytes(void *data, UINT size, UCHAR c); LIST *NewStrMap(); void *StrMapSearch(LIST *map, char *key);