diff --git a/build_deb.sh b/build_deb.sh index 13f4bc8..b7ac732 100755 --- a/build_deb.sh +++ b/build_deb.sh @@ -6,8 +6,8 @@ QT_DIR=/opt/Qt6.2.0/6.2.0/gcc_64 # 定义版本号 QFSVIEWER_MAJARVERSION="0" -QFSVIEWER_SUBVERSION="0" -QFSVIEWER_REVISION="3" +QFSVIEWER_SUBVERSION="1" +QFSVIEWER_REVISION="0" ############################################################################### diff --git a/build_dmg.sh b/build_dmg.sh index a7358e0..60fb1bc 100755 --- a/build_dmg.sh +++ b/build_dmg.sh @@ -6,8 +6,8 @@ QT_DIR=/opt/Qt6.2.0/6.2.0/gcc_64 # 定义版本号 QFSVIEWER_MAJARVERSION="0" -QFSVIEWER_SUBVERSION="0" -QFSVIEWER_REVISION="3" +QFSVIEWER_SUBVERSION="1" +QFSVIEWER_REVISION="0" ############################################################################### diff --git a/build_setup.bat b/build_setup.bat index e891e97..07f9bd4 100644 --- a/build_setup.bat +++ b/build_setup.bat @@ -7,7 +7,7 @@ set "QT_TOOLS_DIR=C:/Qt/Qt6.2.0/Tools/mingw810_32/bin" :: 定义Inno Setup目录 set "INNO_SETUP_DIR=C:/Program Files (x86)/Inno Setup 6" :: 定义版本号 -set "QFSVIEWER_VERSION=0.0.3" +set "QFSVIEWER_VERSION=0.1.0" ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/lib/jffs2/jffs2extract.cpp b/lib/jffs2/jffs2extract.cpp index 95912a5..5d5116d 100644 --- a/lib/jffs2/jffs2extract.cpp +++ b/lib/jffs2/jffs2extract.cpp @@ -767,17 +767,7 @@ uint16_t jffs2_compress( unsigned char *data_in, unsigned char **cpage_out, uint32_t *datalen, uint32_t *cdatalen) { int ret = JFFS2_COMPR_NONE; - int compr_ret; - unsigned char *output_buf = NULL, *tmp_buf; - uint32_t orig_slen, orig_dlen; - uint32_t best_slen=0, best_dlen=0; - - //switch (jffs2_compression_mode) { - // case JFFS2_COMPR_MODE_NONE: - // break; - // default: - // break; - //} + unsigned char *output_buf = NULL; if (ret == JFFS2_COMPR_NONE) { *cpage_out = data_in; @@ -789,21 +779,22 @@ uint16_t jffs2_compress( unsigned char *data_in, unsigned char **cpage_out, return ret; } -static uint64_t pre_pad_block(uint64_t offset, int req, int add_cleanmarkers, int erase_block_size) +static uint64_t pre_pad_block(uint64_t offset, uint32_t req, uint32_t add_cleanmarkers, uint32_t erase_block_size) { const static unsigned char ffbuf[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - static struct jffs2_unknown_node cleanmarker = {0}; - static int cleanmarker_size = sizeof(cleanmarker); + const struct jffs2_unknown_node cleanmarker = { + .magic = {0}, .nodetype = {0}, .totlen = {0}, .hdr_crc = {0}}; + const int cleanmarker_size = sizeof(cleanmarker); if(erase_block_size) { if (add_cleanmarkers) { if ((offset % erase_block_size) == 0) { memcpy(ram_disk_data + offset, &cleanmarker, sizeof(cleanmarker)); offset += sizeof(cleanmarker); - int req = cleanmarker_size - sizeof(cleanmarker); + unsigned int req = cleanmarker_size - sizeof(cleanmarker); while (req) { if (req > sizeof(ffbuf)) { memcpy(ram_disk_data + offset, ffbuf, sizeof(ffbuf)); @@ -832,7 +823,7 @@ static uint64_t pre_pad_block(uint64_t offset, int req, int add_cleanmarkers, in if ((offset % erase_block_size) == 0) { memcpy(ram_disk_data + offset, &cleanmarker, sizeof(cleanmarker)); offset += sizeof(cleanmarker); - int req = cleanmarker_size - sizeof(cleanmarker); + uint32_t req = cleanmarker_size - sizeof(cleanmarker); while (req) { if (req > sizeof(ffbuf)) { memcpy(ram_disk_data + offset, ffbuf, sizeof(ffbuf)); @@ -887,7 +878,7 @@ void write_dir(const char *name, uint32_t pino, uint32_t ino, uint32_t timestamp rd.pino = cpu_to_je32(pino); rd.version = cpu_to_je32(1); rd.ino = cpu_to_je32(ino); - rd.mctime = cpu_to_je32(0);//st_mtime + rd.mctime = cpu_to_je32(timestamp);//st_mtime rd.nsize = strlen(name); rd.type = 4; //rd.unused[0] = 0; @@ -982,7 +973,7 @@ void write_file(const char *name, const unsigned char *buff, size_t size, } else { unsigned char *tbuf = (unsigned char *)buff; uint32_t ver = 0, woff = 0; - unsigned char *buf, *cbuf, *wbuf; + unsigned char *cbuf, *wbuf; while (size) { uint32_t dsize, space; uint16_t compression; @@ -1004,8 +995,8 @@ void write_file(const char *name, const unsigned char *buff, size_t size, ri.totlen = cpu_to_je32(sizeof(ri) + space); ri.hdr_crc = cpu_to_je32(mtd_crc32(0, &ri, sizeof(struct jffs2_unknown_node) - 4)); - - ri.version = cpu_to_je32(++ver); + ++ver; + ri.version = cpu_to_je32(ver); ri.offset = cpu_to_je32(woff); ri.csize = cpu_to_je32(space); ri.dsize = cpu_to_je32(dsize); diff --git a/partform_unix.pri b/partform_unix.pri index 84e4491..7de41a8 100644 --- a/partform_unix.pri +++ b/partform_unix.pri @@ -1,4 +1,4 @@ ############################################################################### # 定义版本号路径 -QFSVIEWER_VERSION=0.0.3 +QFSVIEWER_VERSION=0.1.0 ############################################################################### diff --git a/partform_win32.pri b/partform_win32.pri index 5d5b6fe..41dc72e 100644 --- a/partform_win32.pri +++ b/partform_win32.pri @@ -1,4 +1,4 @@ ############################################################################### # 定义版本号路径 -QFSVIEWER_VERSION=0.0.3 +QFSVIEWER_VERSION=0.1.0 ############################################################################### diff --git a/src/fsviewmodel.cpp b/src/fsviewmodel.cpp index 5bd9a6a..4f0192e 100644 --- a/src/fsviewmodel.cpp +++ b/src/fsviewmodel.cpp @@ -92,7 +92,8 @@ int Ext4FSViewModel::fs_create_dir(QString path) { } int Ext4FSViewModel::fs_remove_dir(QString path) { - ext4_dir_rm(path.toStdString().c_str()); + int ret = ext4_dir_rm(path.toStdString().c_str()); + qDebug() << ret; return 0; } diff --git a/src/qfsviewer.h b/src/qfsviewer.h index 92eaaac..1aff58f 100644 --- a/src/qfsviewer.h +++ b/src/qfsviewer.h @@ -389,7 +389,7 @@ class FSViewWindow : public QTreeView QMessageBox::critical(this, tr("Error"), tr("Unsupported operation!")); return; } - if(size != 0) { + if(type == FSViewModel::FSView_DIR && size != 0) { QMessageBox::critical(this, tr("Error"), tr("Now only support delete empty dir!")); return; } @@ -411,9 +411,9 @@ class FSViewWindow : public QTreeView QFileInfo info(this->windowTitle()); int ret = -1; if(fsView) { - if(type != FSViewModel::FSView_DIR ) { + if(type == FSViewModel::FSView_DIR ) { ret = fsView->removeDirFSImg(path); - } else if(type != FSViewModel::FSView_REG_FILE) { + } else if(type == FSViewModel::FSView_REG_FILE) { ret = fsView->removeFileFSImg(path); } if(ret == 0) { @@ -424,7 +424,7 @@ class FSViewWindow : public QTreeView } } if(ret == 0) { - QMessageBox::information(this, tr("Information"), tr("Delete dir success!")); + QMessageBox::information(this, tr("Information"), tr("Delete success!")); } else { QMessageBox::critical(this, tr("Error"), tr("Unsupported operation!")); }