Merge commit 'origin/mc-4.6'
Этот коммит содержится в:
Коммит
74c5601339
@ -1,3 +1,8 @@
|
||||
2009-02-01 Enrico Weigelt, metux ITS <weigelt@metux.de>
|
||||
|
||||
* src/util.c: fixed name_trunc() on NULL or empty parameters
|
||||
(patch from andrew_b)
|
||||
|
||||
2009-01-31 Enrico Weigelt, metux ITS <weigelt@metux.de>, Patrick Winnertz <winnie@debian.org>, Slava Zanko <slavazanko@gmail.com>, Sergei Trofimovich <slyfox@inbox.ru>
|
||||
|
||||
* edit/editcmd.c, mhl/escape.h, mhl/string.h, mhl/types.h, src/Makefile.am,
|
||||
|
2
NEWS
2
NEWS
@ -17,7 +17,7 @@ Version 4.6.2
|
||||
- Fixed file renames, when copying/moving is performed
|
||||
into deleted directories. (Closes: #181)
|
||||
- Add an option to show executables first in the panels (Closes: #173)
|
||||
- Fixed concat_dir_and_file if there is a paramter = NULL (Closes: #180)
|
||||
- Fixed concat_dir_and_file if there is a parameter = NULL (Closes: #180)
|
||||
- Allow out-of-tree builds (Closes: #224, #208)
|
||||
|
||||
- Editor
|
||||
|
@ -149,11 +149,11 @@ static inline char* mhl_str_dir_plus_file(const char* dirname, const char* filen
|
||||
filename++;
|
||||
|
||||
/* skip trailing slashes on dirname */
|
||||
int dnlen = strlen(dirname);
|
||||
while (dnlen && (dirname[dnlen-1]=='/'))
|
||||
size_t dnlen = strlen(dirname);
|
||||
while ((dnlen != 0) && (dirname[dnlen-1]=='/'))
|
||||
dnlen--;
|
||||
|
||||
int fnlen = strlen(filename);
|
||||
size_t fnlen = strlen(filename);
|
||||
char* buffer = mhl_mem_alloc_z(dnlen+fnlen+2); /* enough space for dirname, /, filename, zero */
|
||||
char* ptr = buffer;
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include <iconv.h>
|
||||
|
||||
#include <mhl/string.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "charsets.h"
|
||||
|
||||
|
19
src/util.c
19
src/util.c
@ -230,22 +230,27 @@ fake_name_quote (const char *s, int quote_percent)
|
||||
* Return static buffer, no need to free() it.
|
||||
*/
|
||||
const char *
|
||||
name_trunc (const char *txt, int trunc_len)
|
||||
name_trunc (const char *txt, size_t trunc_len)
|
||||
{
|
||||
static char x[MC_MAXPATHLEN + MC_MAXPATHLEN];
|
||||
int txt_len;
|
||||
size_t txt_len;
|
||||
char *p;
|
||||
|
||||
if ((size_t) trunc_len > sizeof (x) - 1) {
|
||||
if (!txt)
|
||||
return NULL;
|
||||
if (!*txt)
|
||||
return txt;
|
||||
|
||||
if (trunc_len > sizeof (x) - 1) {
|
||||
trunc_len = sizeof (x) - 1;
|
||||
}
|
||||
txt_len = strlen (txt);
|
||||
if (txt_len <= trunc_len) {
|
||||
strcpy (x, txt);
|
||||
} else {
|
||||
int y = (trunc_len / 2) + (trunc_len % 2);
|
||||
strncpy (x, txt, y);
|
||||
strncpy (x + y, txt + txt_len - (trunc_len / 2), trunc_len / 2);
|
||||
size_t y = (trunc_len / 2) + (trunc_len % 2);
|
||||
strncpy (x, txt, (size_t) y);
|
||||
strncpy (x + y, txt + (txt_len - (trunc_len / 2)), trunc_len / 2);
|
||||
x[y] = '~';
|
||||
}
|
||||
x[trunc_len] = 0;
|
||||
@ -261,7 +266,7 @@ name_trunc (const char *txt, int trunc_len)
|
||||
* reasons.
|
||||
*/
|
||||
const char *
|
||||
path_trunc (const char *path, int trunc_len) {
|
||||
path_trunc (const char *path, size_t trunc_len) {
|
||||
const char *ret;
|
||||
char *secure_path = strip_password (g_strdup (path), 1);
|
||||
|
||||
|
@ -34,12 +34,12 @@ char *fake_name_quote (const char *c, int quote_percent);
|
||||
/* Remove the middle part of the string to fit given length.
|
||||
* Use "~" to show where the string was truncated.
|
||||
* Return static buffer, no need to free() it. */
|
||||
const char *name_trunc (const char *txt, int trunc_len);
|
||||
const char *name_trunc (const char *txt, size_t trunc_len);
|
||||
|
||||
/* path_trunc() is the same as name_trunc() above but
|
||||
* it deletes possible password from path for security
|
||||
* reasons. */
|
||||
const char *path_trunc (const char *path, int trunc_len);
|
||||
const char *path_trunc (const char *path, size_t trunc_len);
|
||||
|
||||
/* return a static string representing size, appending "K" or "M" for
|
||||
* big sizes.
|
||||
|
@ -49,6 +49,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <mhl/string.h>
|
||||
|
||||
#include "vfs.h"
|
||||
#include "vfs-impl.h"
|
||||
#include "smbfs.h"
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user