Navigation Menu

Skip to content

Commit

Permalink
LuaFAR: minor refactoring and GCC warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Jun 23, 2017
1 parent 56d2e11 commit 531b867
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
14 changes: 9 additions & 5 deletions enc/enc_lua/luafar_manual.tsi
Expand Up @@ -9672,7 +9672,7 @@ id=213
lv=3
dt=Text
nm=win.GetFileInfo
mtime=3602278965
mtime=3705999657
<article>
#_<markdown>
#_ Info = win.GetFileInfo (FileName)
Expand All @@ -9683,7 +9683,8 @@ mtime=3602278965
#_ wildcard characters (`*` and `?`)
#_
#_###Returns
#_ **`Info`**: [`tPluginPanelItem`][] table, or nil
#_ On success: [`tPluginPanelItem`][] table <br>
#_ On failure: `nil` + error message
#_
#_###Description
#_ This function provides information about the specified file.
Expand Down Expand Up @@ -10481,15 +10482,15 @@ lv=3
dt=Text
nm=win.GetConsoleScreenBufferInfo
ctime=3483001149
mtime=3532720056
mtime=3707371971
<article>
#_info = win.GetConsoleScreenBufferInfo ()
#_
#_**Parameters:**
#_ none
#_
#_**Returns:**
#_ info : table, or nil
#_**Returns (on success):**
#_ info : table
#_ fields of *info*:
#_ SizeX: integer
#_ SizeY: integer
Expand All @@ -10503,6 +10504,9 @@ mtime=3532720056
#_ MaximumWindowSizeX: integer
#_ MaximumWindowSizeY: integer
#_
#_**Returns (on failure):**
#_ nil + error message
#_
#_**Windows API used:**
#_ GetStdHandle(STD_OUTPUT_HANDLE), GetConsoleScreenBufferInfo
#_
Expand Down
6 changes: 5 additions & 1 deletion plugins/luamacro/changelog
@@ -1,4 +1,8 @@
shmuel 16.05.2017 11:42:28 +0200 - build 607
shmuel 23.06.2017 10:09:22 +0200 - build 608

1. LuaFAR: minor refactoring and GCC warnings.

shmuel 16.05.2017 11:42:28 +0200 - build 607

1. LuaFAR: (FIX) функция far.ShowHelp неправильно обрабатывала флаг FHELP_GUID.

Expand Down
5 changes: 3 additions & 2 deletions plugins/luamacro/luafar/service.c
Expand Up @@ -4868,12 +4868,13 @@ static int far_MakeMenuItems(lua_State *L)
{
int item = 1, i;
char delim[] = { 226,148,130,0 }; // Unicode char 9474 in UTF-8
char buf_prefix[64], buf_space[64];
char buf_prefix[64], buf_space[64], buf_format[64];
int maxno = 0;
size_t len_prefix;

for (i=argn; i; maxno++,i/=10) {}
len_prefix = sprintf(buf_space, "%*s%s ", maxno, "", delim);
sprintf(buf_format, "%%%dd%%s ", maxno);

for(i=1; i<=argn; i++)
{
Expand All @@ -4894,7 +4895,7 @@ static int far_MakeMenuItems(lua_State *L)
if(lua_type(L, -1) != LUA_TSTRING)
luaL_error(L, "tostring() returned a non-string value");

sprintf(buf_prefix, "%*d%s ", maxno, i, delim);
sprintf(buf_prefix, buf_format, i, delim);
start = lua_tolstring(L, -1, &len_arg);
str = (char*) malloc(len_arg + 1);
memcpy(str, start, len_arg + 1);
Expand Down
6 changes: 3 additions & 3 deletions plugins/luamacro/luafar/win.c
Expand Up @@ -362,7 +362,7 @@ static void PushWinFindData(lua_State *L, const WIN32_FIND_DATAW *FData)
{
lua_createtable(L, 0, 7);
PutAttrToTable(L, FData->dwFileAttributes);
PutNumToTable(L, "FileSize", FData->nFileSizeLow + 65536.*65536.*FData->nFileSizeHigh);
PutNumToTable(L, "FileSize", FData->nFileSizeLow + (double)(0x100000000ULL)*FData->nFileSizeHigh);
PutFileTimeToTable(L, "LastWriteTime", FData->ftLastWriteTime);
PutFileTimeToTable(L, "LastAccessTime", FData->ftLastAccessTime);
PutFileTimeToTable(L, "CreationTime", FData->ftCreationTime);
Expand All @@ -377,7 +377,7 @@ static int win_GetFileInfo(lua_State *L)
HANDLE h = FindFirstFileW(fname, &fd);

if(h == INVALID_HANDLE_VALUE)
lua_pushnil(L);
return SysErrorReturn(L);
else
{
PushWinFindData(L, &fd);
Expand Down Expand Up @@ -513,7 +513,7 @@ static int win_GetConsoleScreenBufferInfo(lua_State* L)
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);

if(!GetConsoleScreenBufferInfo(h, &info))
return lua_pushnil(L), 1;
return SysErrorReturn(L);

lua_createtable(L, 0, 11);
PutIntToTable(L, "SizeX", info.dwSize.X);
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luamacro.rc
@@ -1,6 +1,6 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 607
#define PLUGIN_BUILD 608
#define PLUGIN_DESC "Lua Macros for Far Manager"
#define PLUGIN_NAME "LuaMacro"
#define PLUGIN_FILENAME "luamacro.dll"
Expand Down

0 comments on commit 531b867

Please sign in to comment.