mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[cmp] update Bled to latest
* Adds the provision of default buffer size in bled_init()
This commit is contained in:
parent
c717c7789b
commit
c47ee4c435
10 changed files with 31 additions and 20 deletions
|
@ -31,6 +31,7 @@ jmp_buf bb_error_jmp;
|
|||
char* bb_virtual_buf = NULL;
|
||||
size_t bb_virtual_len = 0, bb_virtual_pos = 0;
|
||||
int bb_virtual_fd = -1;
|
||||
uint32_t BB_BUFSIZE = 0x10000;
|
||||
|
||||
static long long int unpack_none(transformer_state_t *xstate)
|
||||
{
|
||||
|
@ -265,7 +266,8 @@ int64_t bled_uncompress_from_buffer_to_buffer(const char* src, const size_t src_
|
|||
}
|
||||
|
||||
/* Initialize the library.
|
||||
* When the parameters are not NULL you can:
|
||||
* When the parameters are not NULL or zero you can:
|
||||
* - specify the buffer size to use (must be larger than 64KB and a power of two)
|
||||
* - specify the printf-like function you want to use to output message
|
||||
* void print_function(const char* format, ...);
|
||||
* - specify the read/write functions you want to use;
|
||||
|
@ -275,18 +277,25 @@ int64_t bled_uncompress_from_buffer_to_buffer(const char* src, const size_t src_
|
|||
* void switch_function(const char* filename, const uint64_t filesize);
|
||||
* - point to an unsigned long variable, to be used to cancel operations when set to non zero
|
||||
*/
|
||||
int bled_init(printf_t print_function, read_t read_function, write_t write_function,
|
||||
int bled_init(uint32_t buffer_size, printf_t print_function, read_t read_function, write_t write_function,
|
||||
progress_t progress_function, switch_t switch_function, unsigned long* cancel_request)
|
||||
{
|
||||
if (bled_initialized)
|
||||
return -1;
|
||||
bled_initialized = true;
|
||||
BB_BUFSIZE = buffer_size;
|
||||
/* buffer_size must be larger than 64 KB and a power of two */
|
||||
if (buffer_size < 0x10000 || (buffer_size & (buffer_size - 1)) != 0) {
|
||||
if (buffer_size != 0 && print_function != NULL)
|
||||
print_function("bled_init: invalid buffer_size, defaulting to 64 KB");
|
||||
BB_BUFSIZE = 0x10000;
|
||||
}
|
||||
bled_printf = print_function;
|
||||
bled_read = read_function;
|
||||
bled_write = write_function;
|
||||
bled_progress = progress_function;
|
||||
bled_switch = switch_function;
|
||||
bled_cancel_request = cancel_request;
|
||||
bled_initialized = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ int64_t bled_uncompress_to_dir(const char* src, const char* dir, int type);
|
|||
int64_t bled_uncompress_from_buffer_to_buffer(const char* src, const size_t src_len, char* dst, size_t dst_len, int type);
|
||||
|
||||
/* Initialize the library.
|
||||
* When the parameters are not NULL you can:
|
||||
* When the parameters are not NULL or zero you can:
|
||||
* - specify the buffer size to use (must be larger than 64KB and a power of two)
|
||||
* - specify the printf-like function you want to use to output message
|
||||
* void print_function(const char* format, ...);
|
||||
* - specify the read/write functions you want to use;
|
||||
|
@ -60,7 +61,7 @@ int64_t bled_uncompress_from_buffer_to_buffer(const char* src, const size_t src_
|
|||
* void switch_function(const char* filename, const uint64_t filesize);
|
||||
* - point to an unsigned long variable, to be used to cancel operations when set to non zero
|
||||
*/
|
||||
int bled_init(printf_t print_function, read_t read_function, write_t write_function,
|
||||
int bled_init(uint32_t buffer_size, printf_t print_function, read_t read_function, write_t write_function,
|
||||
progress_t progress_function, switch_t switch_function, unsigned long* cancel_request);
|
||||
|
||||
/* This call frees any resource used by the library */
|
||||
|
|
|
@ -45,10 +45,11 @@ typedef struct huft_t {
|
|||
} v;
|
||||
} huft_t;
|
||||
|
||||
/* gunzip_window size--must be a power of two, and
|
||||
* at least 32K for zip's deflate method */
|
||||
#define GUNZIP_WSIZE BB_BUFSIZE
|
||||
|
||||
enum {
|
||||
/* gunzip_window size--must be a power of two, and
|
||||
* at least 32K for zip's deflate method */
|
||||
GUNZIP_WSIZE = BB_BUFSIZE,
|
||||
/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
|
||||
BMAX = 16, /* maximum bit length of any code (16 for explode) */
|
||||
N_MAX = 288, /* maximum number of codes in any set */
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
|
||||
|
||||
/* Default input buffer size */
|
||||
#define IBUFSIZ BB_BUFSIZE
|
||||
#define IBUFSIZ ((int)BB_BUFSIZE)
|
||||
|
||||
/* Default output buffer size */
|
||||
#define OBUFSIZ BB_BUFSIZE
|
||||
#define OBUFSIZ ((int)BB_BUFSIZE)
|
||||
|
||||
/* Defines for third byte of header */
|
||||
#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <io.h>
|
||||
|
||||
#define BB_BUFSIZE 0x40000
|
||||
#define ONE_TB 1099511627776ULL
|
||||
|
||||
#define ENABLE_DESKTOP 1
|
||||
|
@ -105,6 +104,7 @@ typedef unsigned int uid_t;
|
|||
#define get_le16(ptr) (*(const uint16_t *)(ptr))
|
||||
#endif
|
||||
|
||||
extern uint32_t BB_BUFSIZE;
|
||||
extern smallint bb_got_signal;
|
||||
extern uint32_t *global_crc32_table;
|
||||
extern jmp_buf bb_error_jmp;
|
||||
|
|
|
@ -1290,7 +1290,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
|
|||
}
|
||||
assert((uintptr_t)sec_buf % SelectedDrive.SectorSize == 0);
|
||||
sec_buf_pos = 0;
|
||||
bled_init(uprintf, NULL, sector_write, update_progress, NULL, &FormatStatus);
|
||||
bled_init(256 * KB, uprintf, NULL, sector_write, update_progress, NULL, &FormatStatus);
|
||||
bled_ret = bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type);
|
||||
bled_exit();
|
||||
uprintfs("\r\n");
|
||||
|
|
|
@ -1283,7 +1283,7 @@ out:
|
|||
update_md5sum();
|
||||
if (archive_path != NULL) {
|
||||
uprintf("● Adding files from %s", archive_path);
|
||||
bled_init(NULL, NULL, NULL, NULL, alt_print_extracted_file, NULL);
|
||||
bled_init(256 * KB, NULL, NULL, NULL, NULL, alt_print_extracted_file, NULL);
|
||||
bled_uncompress_to_dir(archive_path, dest_dir, BLED_COMPRESSION_ZIP);
|
||||
bled_exit();
|
||||
}
|
||||
|
|
|
@ -948,7 +948,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
free(sig);
|
||||
uprintf("Download signature is valid ✓");
|
||||
uncompressed_size = *((uint64_t*)&compressed[5]);
|
||||
if ((uncompressed_size < 1 * MB) && (bled_init(uprintf, NULL, NULL, NULL, NULL, &FormatStatus) >= 0)) {
|
||||
if ((uncompressed_size < 1 * MB) && (bled_init(0, uprintf, NULL, NULL, NULL, NULL, &FormatStatus) >= 0)) {
|
||||
fido_script = malloc((size_t)uncompressed_size);
|
||||
size = bled_uncompress_from_buffer_to_buffer(compressed, dwCompressedSize, fido_script, (size_t)uncompressed_size, BLED_COMPRESSION_LZMA);
|
||||
bled_exit();
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 4.2.2057"
|
||||
CAPTION "Rufus 4.2.2058"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -392,8 +392,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,2,2057,0
|
||||
PRODUCTVERSION 4,2,2057,0
|
||||
FILEVERSION 4,2,2058,0
|
||||
PRODUCTVERSION 4,2,2058,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -411,13 +411,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "4.2.2057"
|
||||
VALUE "FileVersion", "4.2.2058"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-4.2.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "4.2.2057"
|
||||
VALUE "ProductVersion", "4.2.2058"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -211,7 +211,7 @@ static BOOL IsCompressedBootableImage(const char* path)
|
|||
if (buf == NULL)
|
||||
return FALSE;
|
||||
FormatStatus = 0;
|
||||
bled_init(uprintf, NULL, NULL, NULL, NULL, &FormatStatus);
|
||||
bled_init(0, uprintf, NULL, NULL, NULL, NULL, &FormatStatus);
|
||||
dc = bled_uncompress_to_buffer(path, (char*)buf, MBR_SIZE, file_assoc[i].type);
|
||||
bled_exit();
|
||||
if (dc != MBR_SIZE) {
|
||||
|
|
Loading…
Reference in a new issue