Skip to content

Commit

Permalink
clean warning
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <[email protected]>
  • Loading branch information
QQxiaoming committed Sep 1, 2024
1 parent 66cac1b commit 06431d0
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
11 changes: 7 additions & 4 deletions lib/Qtftp/qtftp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ void QTftp::client_get(QString path, QString server)
m_segsize = 512;
m_timeout = 1000;
struct tftp_header *th = (struct tftp_header *)buffer;
strcpy(th->path, name.fileName().toUtf8().constData());
strcpy(th->path + name.fileName().length() + 1, "octect");
QByteArray baName = name.fileName().toUtf8();
memset(th->path, 0, baName.length()+8);
memcpy(th->path, baName.constData(), baName.length());
memcpy(th->path + baName.length() + 1, "octect", 6);

sock = new QUdpSocket(this);
sock->bind();
Expand Down Expand Up @@ -262,8 +264,9 @@ void QTftp::client_put(QString path, QString server)
m_segsize = 512;
m_timeout = 1000;
struct tftp_header *th = (struct tftp_header *)buffer;
strcpy(th->path, name.fileName().toUtf8().constData());
strcpy(th->path + name.fileName().length() + 1, "octect");
QByteArray baName = name.fileName().toUtf8();
memcpy(th->path, baName.constData(), baName.length());
memcpy(th->path + baName.length() + 1, "octect", 6);

sock = new QUdpSocket(this);
sock->bind();
Expand Down
8 changes: 4 additions & 4 deletions lib/qextserialport/qextserialenumerator_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static QString getRegKeyValue(HKEY key, LPCTSTR property)
BYTE *buff = new BYTE[size];
QString result;
if (::RegQueryValueEx(key, property, NULL, &type, buff, &size) == ERROR_SUCCESS)
result = QString::fromUtf16(reinterpret_cast<ushort *>(buff));
result = QString::fromUtf16(reinterpret_cast<char16_t *>(buff));
delete [] buff;
return result;
}
Expand All @@ -145,7 +145,7 @@ static QString getDeviceRegistryProperty(HDEVINFO devInfoSet, PSP_DEVINFO_DATA d
return QString();
BYTE *buff = new BYTE[buffSize];
::SetupDiGetDeviceRegistryProperty(devInfoSet, devInfoData, property, NULL, buff, buffSize, NULL);
QString result = QString::fromUtf16(reinterpret_cast<ushort *>(buff));
QString result = QString::fromUtf16(reinterpret_cast<char16_t *>(buff));
delete [] buff;
return result;
}
Expand Down Expand Up @@ -263,7 +263,7 @@ LRESULT QextSerialEnumeratorPrivate::onDeviceChanged(WPARAM wParam, LPARAM lPara
if (pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
PDEV_BROADCAST_DEVICEINTERFACE pDevInf = (PDEV_BROADCAST_DEVICEINTERFACE)pHdr;
// delimiters are different across APIs...change to backslash. ugh.
QString deviceID = QString::fromUtf16(reinterpret_cast<ushort *>(pDevInf->dbcc_name));
QString deviceID = QString::fromUtf16(reinterpret_cast<char16_t *>(pDevInf->dbcc_name));
deviceID = deviceID.toUpper().replace(QLatin1String("#"), QLatin1String("\\"));

matchAndDispatchChangedDevice(deviceID, GUID_DEVINTERFACE_COMPORT, wParam);
Expand All @@ -285,7 +285,7 @@ bool QextSerialEnumeratorPrivate::matchAndDispatchChangedDevice(const QString &d
DWORD nSize = 0;
TCHAR buf[MAX_PATH];
if (SetupDiGetDeviceInstanceId(devInfoSet, &spDevInfoData, buf, MAX_PATH, &nSize)
&& deviceID.contains(QString::fromUtf16(reinterpret_cast<ushort *>(buf)))) { // we found a match
&& deviceID.contains(QString::fromUtf16(reinterpret_cast<char16_t *>(buf)))) { // we found a match
rv = true;
QextPortInfo info;
info.productID = info.vendorID = info.revision = 0;
Expand Down
3 changes: 2 additions & 1 deletion lib/qtermwidget/TerminalDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,8 @@ void TerminalDisplay::paintFilters(QPainter &painter) {
do {
if (endColumn <= 0)
break;
if (_image[loc(startColumn, line)].character > 0xffff)
uint64_t ucode = _image[loc(startColumn, line)].character;
if (ucode > 0xffff)
break;
if (QChar(_image[loc(startColumn, line)].character).isSpace())
break;
Expand Down
3 changes: 2 additions & 1 deletion lib/qtermwidget/util/CharWidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ void CharWidth::setFont(QFont font) {
}

int CharWidth::font_width(wchar_t ucs) {
if(ucs <= 0xffff)
uint64_t ucode = ucs;
if(ucode <= 0xffff)
return fm->horizontalAdvance(QString(QChar(ucs)),1)/fm->horizontalAdvance("0",1);
else
return unicode_width(ucs);
Expand Down
2 changes: 1 addition & 1 deletion lib/qtkeychain/keychain_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void WritePasswordJobPrivate::scheduledStart() {
}
if (err == RPC_S_INVALID_BOUND) {
const size_t maxTargetName = CRED_MAX_GENERIC_TARGET_NAME_LENGTH;
if (key.size() > maxTargetName) {
if (((size_t)key.size()) > maxTargetName) {
q->emitFinishedWithError(
OtherError,
tr("Credential key exceeds maximum size of %1").arg(maxTargetName));
Expand Down
12 changes: 6 additions & 6 deletions lib/qzmodem/qrecvzmodem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,14 +798,14 @@ int QRecvZmodem::rz_receive_file(struct zm_fileinfo *zi) {
if (akt->pos == zi->bytes_received) {
rz_write_string_to_file(zi, akt->data, akt->len);
zi->bytes_received += akt->len;
qDebug("using saved out-of-sync-paket %lx, len %ld", akt->pos,
akt->len);
qDebug("using saved out-of-sync-paket %llx, len %lld", (uint64_t)akt->pos,
(uint64_t)akt->len);
goto nxthdr;
}
next = akt->next;
if (akt->pos < zi->bytes_received) {
qDebug("removing unneeded saved out-of-sync-paket %lx, len %ld",
akt->pos, akt->len);
qDebug("removing unneeded saved out-of-sync-paket %llx, len %lld",
(uint64_t)akt->pos, (uint64_t)akt->len);
if (last)
last->next = akt->next;
else
Expand Down Expand Up @@ -881,8 +881,8 @@ int QRecvZmodem::rz_receive_file(struct zm_fileinfo *zi) {
if (neu)
neu->data = (char *)malloc(bytes_in_block);
if (neu && neu->data) {
qDebug("saving out-of-sync-block %lx, len %lu", pos,
(unsigned long)bytes_in_block);
qDebug("saving out-of-sync-block %llx, len %llu", (uint64_t)pos,
(uint64_t)bytes_in_block);
memcpy(neu->data, secbuf, bytes_in_block);
neu->pos = pos;
neu->len = bytes_in_block;
Expand Down
2 changes: 2 additions & 0 deletions lib/sqlite/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -34247,6 +34247,7 @@ SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject); /* os_win.c */
SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
DWORD rc;
BOOL bRc;
(void)bRc;

assert( ppOut!=0 );
if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
Expand Down Expand Up @@ -51209,6 +51210,7 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
** may now be invalid and should be unmapped.
*/
static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){
(void)iOff;
#if SQLITE_MAX_MMAP_SIZE>0
winFile *pFd = (winFile*)fd; /* The underlying database file */

Expand Down

0 comments on commit 06431d0

Please sign in to comment.