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 assert, error, pcall = assert, error, pcall
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
-- 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 assert, error, loadstring = assert, error, loadstring
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
-- List them here for Mikk's FindGlobals script
@@ -12,13 +12,13 @@ if not LibBase64 then
return
end
local byte, char, format, gsub, len, sub = string.byte, string.char, string.format, string.gsub, string.len, string.sub
local concat, insert = table.concat, table.insert
local error, pairs, tonumber, tostring, type = error, pairs, tonumber, tostring, type
local error = error
local type = type
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 charTable = {}
local byteToNum = {}
local numToChar = {}
+13 -2
View File
@@ -81,8 +81,8 @@ local function setCleanupTables(...)
if not LibCompress.frame:IsShown() then
LibCompress.frame:Show()
end
for i = 1, getn(arg) do
tables_to_clean[(select(i, unpack(arg)))] = true
for i = 1, arg.n do
tables_to_clean[arg[i]] = true
end
end
@@ -825,18 +825,25 @@ end
--[[
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.
table, msg = LibCompress:GetEncodeTable(reservedChars, escapeChars, mapChars)
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
mapChars: First characters in reservedChars maps to first characters in mapChars. (#mapChars <= #reservedChars)
return value:
table
if nil then msg holds an error message, otherwise use like this:
encoded_message = table:Encode(message)
message = table:Decode(encoded_message)
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)
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
@@ -1122,7 +1129,9 @@ end
---------------------------------------------------------------------------
Copyright (c) 2003, Dominik Reichl <dominik.reichl@t-online.de>, Germany.
All rights reserved.
Distributed under the terms of the GNU General Public License v2.
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
@@ -1186,7 +1195,9 @@ end
---------------------------------------------------------------------------
Copyright (c) 2003, Dominik Reichl <dominik.reichl@t-online.de>, Germany.
All rights reserved.
Distributed under the terms of the GNU General Public License v2.
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
@@ -88,7 +88,6 @@ do
end
Unusable[class] = nil
subs = nil
end
Lib.unusable = Unusable
@@ -97,9 +96,9 @@ end
--[[ API ]]--
function Lib:IsItemUnusable(arg1)
if arg1 then
local subclass, _, slot = select(7, GetItemInfo(arg1))
function Lib:IsItemUnusable(item)
if item then
local subclass, _, slot = select(7, GetItemInfo(item))
return Lib:IsClassUnusable(subclass, slot)
end
end
@@ -9,7 +9,7 @@ Dependencies: LibStub, CallbackHandler-1.0
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)
if not lib then return end
@@ -4,8 +4,7 @@
-- ----------------------------------------------------------------------------
local _G = _G
local strsub, strlen, strmatch, gsub = strsub, strlen, strmatch, gsub
local max, match = max, match
local securecall, issecure = securecall, issecure
local max = max
local tonumber = tonumber
local type = type
local wipe = table.wipe
@@ -43,7 +42,7 @@ L_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = nil;
-- List of open menus
L_OPEN_DROPDOWNMENUS = {};
local UIDropDownMenuDelegate = CreateFrame("FRAME");
--local UIDropDownMenuDelegate = CreateFrame("FRAME");
function L_UIDropDownMenu_InitializeHelper (frame)
-- This deals with the potentially tainted stuff!
@@ -204,20 +203,10 @@ info.minWidth = [nil, NUMBER] -- Minimum width for this line
local UIDropDownMenu_ButtonInfo = {};
--Until we get around to making this betterz...
local UIDropDownMenu_SecureInfo = {};
--local wipe = table.wipe;
function L_UIDropDownMenu_CreateInfo()
-- Reuse the same table to prevent memory churn
-- if ( issecure() ) then
-- securecall(wipe, UIDropDownMenu_SecureInfo);
-- return UIDropDownMenu_SecureInfo;
-- else
return wipe(UIDropDownMenu_ButtonInfo);
-- end
end
function L_UIDropDownMenu_CreateFrames(level, index)
@@ -577,7 +566,7 @@ function L_UIDropDownMenu_GetButtonWidth(button)
end
function L_UIDropDownMenu_Refresh(frame, useValue, dropdownLevel)
local button, checked, checkImage, normalText, width;
local button, checked, checkImage, width;
local maxWidth = 0;
local somethingChecked = nil;
if ( not dropdownLevel ) then
@@ -1123,7 +1112,7 @@ function L_UIDropDownMenuButton_GetName(self)
end
function L_UIDropDownMenuButton_OpenColorPicker(self, button)
securecall("CloseMenus");
CloseMenus()
if ( not button ) then
button = self;
end
@@ -27,7 +27,6 @@ local oUF = ns.oUF
local UnitInRaid = UnitInRaid
local UnitIsPartyLeader = UnitIsPartyLeader
local UnitIsRaidOfficer = UnitIsRaidOfficer
local function Update(self, event)
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 CreateFrame = CreateFrame
local GetTime = GetTime
local UnitAura = UnitAura
local GetPlayerBuff = GetPlayerBuff
local GetPlayerBuffTexture = GetPlayerBuffTexture
@@ -36,7 +36,6 @@ local ns = oUF
local oUF = ns.oUF
local SetPortraitTexture = SetPortraitTexture
local UnitExists = UnitExists
local UnitName = UnitName
local UnitIsConnected = UnitIsConnected
local UnitIsUnit = UnitIsUnit
-11
View File
@@ -53,17 +53,6 @@ for k, v in next, {
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)
Used to activate an element for the given unit frame.
@@ -9,7 +9,6 @@ local pi2 = 3.141592653589793 / 2
local GetPlayerMapPosition = GetPlayerMapPosition
local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid
local UnitInRange = UnitInRange
local UnitIsConnected = UnitIsConnected
local UnitIsUnit = UnitIsUnit