From 42a0689070d775e8f3b0b82115c0b1397051d9d5 Mon Sep 17 00:00:00 2001 From: fertao <fertao@163.com> Date: 星期三, 30 七月 2025 09:15:41 +0800 Subject: [PATCH] mod code --- Server/付林涛/code/tianKai/uploador.cpp | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git "a/Server/\344\273\230\346\236\227\346\266\233/code/tianKai/uploador.cpp" "b/Server/\344\273\230\346\236\227\346\266\233/code/tianKai/uploador.cpp" index 299449c..c464783 100644 --- "a/Server/\344\273\230\346\236\227\346\266\233/code/tianKai/uploador.cpp" +++ "b/Server/\344\273\230\346\236\227\346\266\233/code/tianKai/uploador.cpp" @@ -44,16 +44,18 @@ } } -int UpLoador::upfile(char* data, int rlen) +int UpLoador::upfile(std::shared_ptr<char> buf, int rlen) { - if(data == nullptr || rlen <= 0){ + if (!buf || rlen <= 0) { // 妫�鏌ユ櫤鑳芥寚閽堟槸鍚︿负绌� return -1; } - if(m_client){ - int len = m_client->write((char*)data,rlen); - qDebug()<<len; + if (m_client) { + // 鍏抽敭淇敼锛氱敤 buf.get() 鑾峰彇鍘熷鎸囬拡 + int len = m_client->write(reinterpret_cast<char*>(buf.get()), rlen); + qDebug() << "Sent bytes:" << len; return len; } + return -1; // 琛ュ厖杩斿洖鍊� } void UpLoador::myRead() -- Gitblit v1.8.0