cleanup Libs

This commit is contained in:
Pinya
2018-07-18 15:11:20 +03:00
parent 8b44916c87
commit 8d19a3f345
12 changed files with 29 additions and 45 deletions
@@ -20,7 +20,7 @@ if not AceSerializer then return end
local strbyte, strchar, gsub, gmatch, format = string.byte, string.char, string.gsub, string.gmatch, string.format local strbyte, strchar, gsub, gmatch, format = string.byte, string.char, string.gsub, string.gmatch, string.format
local assert, error, pcall = assert, error, pcall local assert, error, pcall = assert, error, pcall
local type, tostring, tonumber = type, tostring, tonumber local type, tostring, tonumber = type, tostring, tonumber
local pairs, select, frexp = pairs, select, math.frexp local pairs, frexp = pairs, math.frexp
local tconcat = table.concat local tconcat = table.concat
-- quick copies of string representations of wonky numbers -- quick copies of string representations of wonky numbers
@@ -10,7 +10,7 @@ local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
local tconcat = table.concat local tconcat = table.concat
local assert, error, loadstring = assert, error, loadstring local assert, error, loadstring = assert, error, loadstring
local setmetatable, rawset, rawget = setmetatable, rawset, rawget local setmetatable, rawset, rawget = setmetatable, rawset, rawget
local next, select, pairs, type, tostring = next, select, pairs, type, tostring local next, pairs, type, tostring = next, pairs, type, tostring
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script -- List them here for Mikk's FindGlobals script
@@ -12,13 +12,13 @@ if not LibBase64 then
return return
end end
local byte, char, format, gsub, len, sub = string.byte, string.char, string.format, string.gsub, string.len, string.sub local error = error
local concat, insert = table.concat, table.insert local type = type
local error, pairs, tonumber, tostring, type = error, pairs, tonumber, tostring, type
local mod = math.mod local mod = math.mod
local byte, char, format, len, sub = string.byte, string.char, string.format, string.len, string.sub
local concat = table.concat
local _chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' local _chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
local charTable = {}
local byteToNum = {} local byteToNum = {}
local numToChar = {} local numToChar = {}
+13 -2
View File
@@ -81,8 +81,8 @@ local function setCleanupTables(...)
if not LibCompress.frame:IsShown() then if not LibCompress.frame:IsShown() then
LibCompress.frame:Show() LibCompress.frame:Show()
end end
for i = 1, getn(arg) do for i = 1, arg.n do
tables_to_clean[(select(i, unpack(arg)))] = true tables_to_clean[arg[i]] = true
end end
end end
@@ -825,18 +825,25 @@ end
--[[ --[[
Howto: Encode and Decode: Howto: Encode and Decode:
3 functions are supplied, 2 of them are variants of the first. They return a table with functions to encode and decode text. 3 functions are supplied, 2 of them are variants of the first. They return a table with functions to encode and decode text.
table, msg = LibCompress:GetEncodeTable(reservedChars, escapeChars, mapChars) table, msg = LibCompress:GetEncodeTable(reservedChars, escapeChars, mapChars)
reservedChars: The characters in this string will not appear in the encoded data. reservedChars: The characters in this string will not appear in the encoded data.
escapeChars: A string of characters used as escape-characters (don't supply more than needed). #escapeChars >= 1 escapeChars: A string of characters used as escape-characters (don't supply more than needed). #escapeChars >= 1
mapChars: First characters in reservedChars maps to first characters in mapChars. (#mapChars <= #reservedChars) mapChars: First characters in reservedChars maps to first characters in mapChars. (#mapChars <= #reservedChars)
return value: return value:
table table
if nil then msg holds an error message, otherwise use like this: if nil then msg holds an error message, otherwise use like this:
encoded_message = table:Encode(message) encoded_message = table:Encode(message)
message = table:Decode(encoded_message) message = table:Decode(encoded_message)
GetAddonEncodeTable: Sets up encoding for the addon channel (\000 is encoded) GetAddonEncodeTable: Sets up encoding for the addon channel (\000 is encoded)
GetChatEncodeTable: Sets up encoding for the chat channel (many bytes encoded, see the function for details) GetChatEncodeTable: Sets up encoding for the chat channel (many bytes encoded, see the function for details)
Except for the mapped characters, all encoding will be with 1 escape character followed by 1 suffix, i.e. 2 bytes. Except for the mapped characters, all encoding will be with 1 escape character followed by 1 suffix, i.e. 2 bytes.
]] ]]
-- to be able to match any requested byte value, the search string must be preprocessed -- to be able to match any requested byte value, the search string must be preprocessed
@@ -1122,7 +1129,9 @@ end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2003, Dominik Reichl <dominik.reichl@t-online.de>, Germany. Copyright (c) 2003, Dominik Reichl <dominik.reichl@t-online.de>, Germany.
All rights reserved. All rights reserved.
Distributed under the terms of the GNU General Public License v2. Distributed under the terms of the GNU General Public License v2.
This software is provided 'as is' with no explicit or implied warranties This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose. and/or fitness for purpose.
@@ -1186,7 +1195,9 @@ end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2003, Dominik Reichl <dominik.reichl@t-online.de>, Germany. Copyright (c) 2003, Dominik Reichl <dominik.reichl@t-online.de>, Germany.
All rights reserved. All rights reserved.
Distributed under the terms of the GNU General Public License v2. Distributed under the terms of the GNU General Public License v2.
This software is provided 'as is' with no explicit or implied warranties This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose. and/or fitness for purpose.
@@ -88,7 +88,6 @@ do
end end
Unusable[class] = nil Unusable[class] = nil
subs = nil
end end
Lib.unusable = Unusable Lib.unusable = Unusable
@@ -97,9 +96,9 @@ end
--[[ API ]]-- --[[ API ]]--
function Lib:IsItemUnusable(arg1) function Lib:IsItemUnusable(item)
if arg1 then if item then
local subclass, _, slot = select(7, GetItemInfo(arg1)) local subclass, _, slot = select(7, GetItemInfo(item))
return Lib:IsClassUnusable(subclass, slot) return Lib:IsClassUnusable(subclass, slot)
end end
end end
@@ -9,7 +9,7 @@ Dependencies: LibStub, CallbackHandler-1.0
License: LGPL v2.1 License: LGPL v2.1
]] ]]
local MAJOR, MINOR = "LibSharedMedia-3.0", 2040001 -- 2.4.3 / increase manually on changes local MAJOR, MINOR = "LibSharedMedia-3.0", 1120001 -- 1.12.1 / increase manually on changes
local lib = LibStub:NewLibrary(MAJOR, MINOR) local lib = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end if not lib then return end
@@ -4,8 +4,7 @@
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
local _G = _G local _G = _G
local strsub, strlen, strmatch, gsub = strsub, strlen, strmatch, gsub local strsub, strlen, strmatch, gsub = strsub, strlen, strmatch, gsub
local max, match = max, match local max = max
local securecall, issecure = securecall, issecure
local tonumber = tonumber local tonumber = tonumber
local type = type local type = type
local wipe = table.wipe local wipe = table.wipe
@@ -43,7 +42,7 @@ L_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = nil;
-- List of open menus -- List of open menus
L_OPEN_DROPDOWNMENUS = {}; L_OPEN_DROPDOWNMENUS = {};
local UIDropDownMenuDelegate = CreateFrame("FRAME"); --local UIDropDownMenuDelegate = CreateFrame("FRAME");
function L_UIDropDownMenu_InitializeHelper (frame) function L_UIDropDownMenu_InitializeHelper (frame)
-- This deals with the potentially tainted stuff! -- This deals with the potentially tainted stuff!
@@ -204,20 +203,10 @@ info.minWidth = [nil, NUMBER] -- Minimum width for this line
local UIDropDownMenu_ButtonInfo = {}; local UIDropDownMenu_ButtonInfo = {};
--Until we get around to making this betterz...
local UIDropDownMenu_SecureInfo = {};
--local wipe = table.wipe;
function L_UIDropDownMenu_CreateInfo() function L_UIDropDownMenu_CreateInfo()
-- Reuse the same table to prevent memory churn -- Reuse the same table to prevent memory churn
-- if ( issecure() ) then
-- securecall(wipe, UIDropDownMenu_SecureInfo);
-- return UIDropDownMenu_SecureInfo;
-- else
return wipe(UIDropDownMenu_ButtonInfo); return wipe(UIDropDownMenu_ButtonInfo);
-- end
end end
function L_UIDropDownMenu_CreateFrames(level, index) function L_UIDropDownMenu_CreateFrames(level, index)
@@ -577,7 +566,7 @@ function L_UIDropDownMenu_GetButtonWidth(button)
end end
function L_UIDropDownMenu_Refresh(frame, useValue, dropdownLevel) function L_UIDropDownMenu_Refresh(frame, useValue, dropdownLevel)
local button, checked, checkImage, normalText, width; local button, checked, checkImage, width;
local maxWidth = 0; local maxWidth = 0;
local somethingChecked = nil; local somethingChecked = nil;
if ( not dropdownLevel ) then if ( not dropdownLevel ) then
@@ -1123,7 +1112,7 @@ function L_UIDropDownMenuButton_GetName(self)
end end
function L_UIDropDownMenuButton_OpenColorPicker(self, button) function L_UIDropDownMenuButton_OpenColorPicker(self, button)
securecall("CloseMenus"); CloseMenus()
if ( not button ) then if ( not button ) then
button = self; button = self;
end end
@@ -27,7 +27,6 @@ local oUF = ns.oUF
local UnitInRaid = UnitInRaid local UnitInRaid = UnitInRaid
local UnitIsPartyLeader = UnitIsPartyLeader local UnitIsPartyLeader = UnitIsPartyLeader
local UnitIsRaidOfficer = UnitIsRaidOfficer
local function Update(self, event) local function Update(self, event)
local element = self.AssistantIndicator local element = self.AssistantIndicator
-1
View File
@@ -67,7 +67,6 @@ local tinsert, getn = table.insert, table.getn
local floor, min, mod = math.floor, math.min, math.mod local floor, min, mod = math.floor, math.min, math.mod
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local GetTime = GetTime
local UnitAura = UnitAura local UnitAura = UnitAura
local GetPlayerBuff = GetPlayerBuff local GetPlayerBuff = GetPlayerBuff
local GetPlayerBuffTexture = GetPlayerBuffTexture local GetPlayerBuffTexture = GetPlayerBuffTexture
@@ -36,7 +36,6 @@ local ns = oUF
local oUF = ns.oUF local oUF = ns.oUF
local SetPortraitTexture = SetPortraitTexture local SetPortraitTexture = SetPortraitTexture
local UnitExists = UnitExists
local UnitName = UnitName local UnitName = UnitName
local UnitIsConnected = UnitIsConnected local UnitIsConnected = UnitIsConnected
local UnitIsUnit = UnitIsUnit local UnitIsUnit = UnitIsUnit
-11
View File
@@ -53,17 +53,6 @@ for k, v in next, {
end end
end, end,
UpdateElement = function(self, name)
local unit = self.unit
if(not unit or not UnitExists(unit)) then return end
local element = elements[name]
if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end
if(element.update) then
element.update(self, "OnShow", unit)
end
end,
--[[ frame:EnableElement(name, unit) --[[ frame:EnableElement(name, unit)
Used to activate an element for the given unit frame. Used to activate an element for the given unit frame.
@@ -9,7 +9,6 @@ local pi2 = 3.141592653589793 / 2
local GetPlayerMapPosition = GetPlayerMapPosition local GetPlayerMapPosition = GetPlayerMapPosition
local UnitInParty = UnitInParty local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid local UnitInRaid = UnitInRaid
local UnitInRange = UnitInRange
local UnitIsConnected = UnitIsConnected local UnitIsConnected = UnitIsConnected
local UnitIsUnit = UnitIsUnit local UnitIsUnit = UnitIsUnit