Skip to content

Commit

Permalink
b251 -- 0003399: ошибка при модифицировании tgz (tar+gzip) архива
Browse files Browse the repository at this point in the history
  • Loading branch information
w17 committed Mar 5, 2017
1 parent 4652624 commit ebb0531
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
4 changes: 4 additions & 0 deletions plugins/arclite/changelog
@@ -1,3 +1,7 @@
w17 05.03.2017 15:05:58 +0300 - build 251

1. 0003399: ошибка при модифицировании tgz (tar+gzip) архива -- уточнение b245

w17 28.02.2017 19:20:05 +0300 - build 250

1. 003320: arclite выдаёт ошибку при обработке через префикс имени, содержащего переменную окружения
Expand Down
2 changes: 1 addition & 1 deletion plugins/arclite/en.msg
Expand Up @@ -217,7 +217,7 @@ error.no_format = Archive format not found
error.not_updatable = Archive modification not supported
error.not_archive = File is not recognized as archive
error.sfx_convert = Archive cannot be converted into SFX archive
error.update.unsupported_for_singlefilearchive = Can't update single file archive format
error.update.unsupported_for_singlefilearchive = Can't change single file archive format

# Generic buttons
button.ok = OK
Expand Down
2 changes: 1 addition & 1 deletion plugins/arclite/es.msg
Expand Up @@ -217,7 +217,7 @@ error.no_format = Formato de archivo no encontrado
error.not_updatable = Modificación de archivo no soportada
error.not_archive = Archivo no se reconoce como archivo comprimido
error.sfx_convert = El archivo no puede ser convertido en archivo SFX (autoextraíble)
error.update.unsupported_for_singlefilearchive = Can't update single file archive format
error.update.unsupported_for_singlefilearchive = Can't change single file archive format

# Generic buttons
button.ok = Aceptar
Expand Down
9 changes: 7 additions & 2 deletions plugins/arclite/plugin.cpp
Expand Up @@ -514,8 +514,10 @@ class Plugin {
else {
options.arc_type = archive->arc_chain.back().type; // required to set update properties
if (ArcAPI::is_single_file_format(options.arc_type)) {
FAIL_MSG(Far::get_msg(MSG_ERROR_UPDATE_UNSUPPORTED_FOR_SINGLEFILEARCHIVE));
}
if (items_number != 1 || panel_items[0].FileName != archive->file_list[0].name) {
FAIL_MSG(Far::get_msg(MSG_ERROR_UPDATE_UNSUPPORTED_FOR_SINGLEFILEARCHIVE));
}
}
archive->load_update_props();
options.level = archive->level;
options.method = archive->method;
Expand Down Expand Up @@ -778,6 +780,9 @@ class Plugin {
if (!archive->updatable()) {
FAIL_MSG(Far::get_msg(MSG_ERROR_NOT_UPDATABLE));
}
if (ArcAPI::is_single_file_format(archive->arc_chain.back().type)) {
FAIL_MSG(Far::get_msg(MSG_ERROR_UPDATE_UNSUPPORTED_FOR_SINGLEFILEARCHIVE));
}

bool show_dialog = (op_mode & (OPM_SILENT | OPM_FIND | OPM_VIEW | OPM_EDIT | OPM_QUICKVIEW)) == 0;
if (show_dialog) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/arclite/project.ini
Expand Up @@ -2,4 +2,4 @@
MODULE = arclite
VER_MAJOR = 3
VER_MINOR = 0
VER_BUILD = 250
VER_BUILD = 251
2 changes: 1 addition & 1 deletion plugins/arclite/ru.msg
Expand Up @@ -217,7 +217,7 @@ error.no_format = Формат архива не найден
error.not_updatable = Изменение архива невозможно
error.not_archive = Файл не распознан как архив
error.sfx_convert = Архив нельзя преобразовать в SFX архив
error.update.unsupported_for_singlefilearchive = Обновление однофайловых архивов невозможно
error.update.unsupported_for_singlefilearchive = Изменение однофайловых архивов невозможно

# Generic buttons
button.ok = OK
Expand Down
27 changes: 13 additions & 14 deletions plugins/arclite/ui.cpp
Expand Up @@ -652,20 +652,19 @@ const CompressionMethod c_methods[] = {

static bool is_SWFu(const wstring& fname)
{
bool unpacked_swf = false;
File file;
file.open_nt(Far::get_absolute_path(fname),
FILE_READ_DATA, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN
);
if (file.is_open())
{
char bf[8];
size_t nr = 0;
file.read_nt(bf, sizeof(bf), nr);
unpacked_swf = nr==sizeof(bf) && bf[2]=='S' && bf[1]=='W' && bf[0]=='F' && (unsigned)bf[3] < 20;
}
return unpacked_swf;
bool unpacked_swf = false;
File file;
file.open_nt(Far::get_absolute_path(fname),
FILE_READ_DATA, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN
);
if (file.is_open())
{
char bf[8];
size_t nr = 0;
file.read_nt(bf, sizeof(bf), nr);
unpacked_swf = nr==sizeof(bf) && bf[2]=='S' && bf[1]=='W' && bf[0]=='F' && (unsigned)bf[3] < 20;
}
return unpacked_swf;
}

class UpdateDialog: public Far::Dialog {
Expand Down

0 comments on commit ebb0531

Please sign in to comment.