• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ readInternal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中readInternal函数的典型用法代码示例。如果您正苦于以下问题:C++ readInternal函数的具体用法?C++ readInternal怎么用?C++ readInternal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了readInternal函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: WDT_CHECK

// TODO: consider refactoring this to return error code
void WdtSocket::readEncryptionSettingsOnce(int timeoutMs) {
  if (!encryptionParams_.isSet() || encryptionSettingsRead_) {
    return;
  }
  WDT_CHECK(!encryptionParams_.getSecret().empty());

  int numRead = readInternal(buf_, 1, timeoutMs, true);
  if (numRead != 1) {
    LOG(ERROR) << "Failed to read encryption settings " << numRead << " "
               << port_;
    return;
  }
  if (buf_[0] != Protocol::ENCRYPTION_CMD) {
    LOG(ERROR) << "Expected to read ENCRYPTION_CMD(e), but got " << buf_[0];
    readErrorCode_ = UNEXPECTED_CMD_ERROR;
    return;
  }
  int toRead = Protocol::kMaxEncryption - 1;  // already read 1 byte for cmd
  numRead = readInternal(buf_, toRead,
                         threadCtx_.getOptions().read_timeout_millis, true);
  if (numRead != toRead) {
    LOG(ERROR) << "Failed to read encryption settings " << numRead << " "
               << toRead << " " << port_;
    readErrorCode_ = SOCKET_READ_ERROR;
    return;
  }
  int64_t off = 0;
  EncryptionType encryptionType;
  std::string iv;
  if (!Protocol::decodeEncryptionSettings(buf_, off, Protocol::kMaxEncryption,
                                          encryptionType, iv)) {
    LOG(ERROR) << "Failed to decode encryption settings";
    readErrorCode_ = PROTOCOL_ERROR;
    return;
  }
  if (encryptionType != encryptionParams_.getType()) {
    LOG(ERROR) << "Encryption type mismatch "
               << encryptionTypeToStr(encryptionType) << " "
               << encryptionTypeToStr(encryptionParams_.getType());
    readErrorCode_ = PROTOCOL_ERROR;
    return;
  }
  if (!decryptor_.start(encryptionParams_, iv)) {
    readErrorCode_ = ENCRYPTION_ERROR;
    return;
  }
  LOG(INFO) << "Successfully read encryption settings " << port_ << " "
            << encryptionTypeToStr(encryptionType);
  encryptionSettingsRead_ = true;
}
开发者ID:hjybdrs,项目名称:wdt,代码行数:51,代码来源:WdtSocket.cpp


示例2: ALOGV

void NuCachedSource2::onRead(const sp<AMessage> &msg) {
    ALOGV("onRead");

    int64_t offset;
    CHECK(msg->findInt64("offset", &offset));

    void *data;
    CHECK(msg->findPointer("data", &data));

    size_t size;
    CHECK(msg->findSize("size", &size));

    ssize_t result = readInternal(offset, data, size);

    if (result == -EAGAIN) {
        msg->post(50000);
        return;
    }

    Mutex::Autolock autoLock(mLock);
    if (mDisconnecting) {
        mCondition.signal();
        return;
    }

    CHECK(mAsyncResult == NULL);

    mAsyncResult = new AMessage;
    mAsyncResult->setInt32("result", result);

    mCondition.signal();
}
开发者ID:XperiaZProject,项目名称:frameworks_av,代码行数:32,代码来源:NuCachedSource2.cpp


示例3: ASSERT

void FileReader::readAsDataURL(Blob* blob, ExceptionState& exceptionState)
{
    ASSERT(blob);
    WTF_LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());

    readInternal(blob, FileReaderLoader::ReadAsDataURL, exceptionState);
}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:7,代码来源:FileReader.cpp


示例4: WDT_CHECK_GT

int WdtSocket::readWithTimeout(char *buf, int nbyte, int timeoutMs,
                               bool tryFull) {
  WDT_CHECK_GT(nbyte, 0);
  if (readErrorCode_ != OK && readErrorCode_ != WDT_TIMEOUT) {
    WLOG(ERROR) << "Socket read failed before, not trying to read again "
                << port_;
    return -1;
  }
  readErrorCode_ = OK;
  int numRead = 0;
  readEncryptionSettingsOnce(timeoutMs);
  if (supportUnencryptedPeer_ && readErrorCode_ == UNEXPECTED_CMD_ERROR) {
    WLOG(WARNING)
        << "Turning off encryption since the other side does not support "
           "encryption "
        << port_;
    readErrorCode_ = OK;
    buf[0] = buf_[0];
    numRead = 1;
    // also turn off encryption
    encryptionParams_.erase();
  } else if (readErrorCode_ != OK) {
    return -1;
  }
  if (nbyte == numRead) {
    return nbyte;
  }
  bool encrypt = encryptionParams_.isSet();
  int ret = readInternal(buf + numRead, nbyte - numRead, timeoutMs, tryFull);
  if (ret >= 0) {
    numRead += ret;
  } else {
    return (numRead > 0 ? numRead : -1);
  }
  if (!encrypt) {
    return numRead;
  }
  int numDecrypted = 0;
  if (ctxSaveOffset_ >= 0) {
    if (ctxSaveOffset_ <= numRead) {
      if (!decryptor_.decrypt(buf, ctxSaveOffset_, buf)) {
        readErrorCode_ = ENCRYPTION_ERROR;
        return -1;
      }
      decryptor_.saveContext();
      numDecrypted = ctxSaveOffset_;
      ctxSaveOffset_ = CTX_SAVED;
    } else {
      ctxSaveOffset_ -= numRead;
    }
  }
  // have to decrypt data
  if (!decryptor_.decrypt((buf + numDecrypted), (numRead - numDecrypted),
                          (buf + numDecrypted))) {
    readErrorCode_ = ENCRYPTION_ERROR;
    return -1;
  }
  return numRead;
}
开发者ID:ldemailly,项目名称:wdt,代码行数:59,代码来源:WdtSocket.cpp


示例5: LOG

void FileReader::readAsArrayBuffer(Blob* blob, ExceptionCode& ec)
{
    if (!blob)
        return;

    LOG(FileAPI, "FileReader: reading as array buffer: %s %s\n", blob->url().string().utf8().data(), blob->isFile() ? static_cast<File*>(blob)->path().utf8().data() : "");

    readInternal(blob, FileReaderLoader::ReadAsArrayBuffer, ec);
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:9,代码来源:FileReader.cpp


示例6: LOG

void FileReader::readAsDataURL(Blob* blob, ExceptionCode& ec)
{
    if (!blob)
        return;

    LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", blob->url().string().utf8().data(), is<File>(*blob) ? downcast<File>(*blob).path().utf8().data() : "");

    readInternal(blob, FileReaderLoader::ReadAsDataURL, ec);
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:9,代码来源:FileReader.cpp


示例7: LOG

void FileReader::readAsDataURL(Blob* blob, ExceptionCode& ec)
{
    if (!blob)
        return;

    LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());

    readInternal(blob, FileReaderLoader::ReadAsDataURL, ec);
}
开发者ID:windyuuy,项目名称:opera,代码行数:9,代码来源:FileReader.cpp


示例8: return

int
LSM9DS1_G::readY()
{
    int data = 0;
    if (readInternal(AG_GYR_Y_H, AG_GYR_Y_L, &data)) {
        _y = data;
    }
    // Decode Gyroscope y-axis  [mdps measurement unit]
    return (g_lsb_sentivity * _y);
}
开发者ID:Masakai,项目名称:Arduino,代码行数:10,代码来源:LSM9DS1.cpp


示例9: Q_ASSERT

KoFilter::ConversionStatus XlsxXmlDocumentReader::read(MSOOXML::MsooXmlReaderContext* context)
{
    m_context = dynamic_cast<XlsxXmlDocumentReaderContext*>(context);
    Q_ASSERT(m_context);
    const KoFilter::ConversionStatus result = readInternal();
    m_context = 0;
    if (result == KoFilter::OK)
        return KoFilter::OK;
    return result;
}
开发者ID:KDE,项目名称:koffice,代码行数:10,代码来源:XlsxXmlDocumentReader.cpp


示例10: LOG

void FileReader::readAsDataURL(Blob* blob)
{
    if (!blob)
        return;

    LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", blob->url().string().utf8().data(), blob->isFile() ? static_cast<File*>(blob)->path().utf8().data() : "");

    m_fileType = blob->type();
    readInternal(blob, ReadFileAsDataURL);
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:10,代码来源:FileReader.cpp


示例11: WTF_LOG

void FileReader::readAsDataURL(Blob* blob, ExceptionState& exceptionState)
{
    if (!blob) {
        exceptionState.throwTypeError("The argument is not a Blob.");
        return;
    }

    WTF_LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());

    readInternal(blob, FileReaderLoader::ReadAsDataURL, exceptionState);
}
开发者ID:coinpayee,项目名称:blink,代码行数:11,代码来源:FileReader.cpp


示例12: Q_ASSERT

KoFilter::ConversionStatus XlsxXmlCommentsReader::read(MSOOXML::MsooXmlReaderContext* context)
{
    m_context = dynamic_cast<XlsxXmlCommentsReaderContext*>(context);
    Q_ASSERT(m_context);
    m_colorIndices = m_context->colorIndices;
    m_themes = m_context->themes;
    const KoFilter::ConversionStatus result = readInternal();
    m_context = 0;
    if (result == KoFilter::OK)
        return KoFilter::OK;
    return result;
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:12,代码来源:XlsxXmlCommentsReader.cpp


示例13: sectorSize

bool X86AtaDevice::read(uint64_t address, uint16_t *buf, size_t sectors)
{
    if (sectors == 0) return false;

    if (sectors > 10) {
        size_t const bufIncr = sectorSize() / sizeof(uint16_t);

        bool success = true;
        for (size_t offset = 0; offset < sectors; offset += 10) {
            size_t const bufOffset = bufIncr * offset;
            size_t sectorsToRead = sectors - offset < 10 ? sectors - offset : 10;
            success = readInternal(address + offset, buf + bufOffset, sectorsToRead);
            if (!success) {
                break;
            }
        }

        return success;
    } else {
        return readInternal(address, buf, sectors);
    }

}
开发者ID:axalon900,项目名称:LambOS,代码行数:23,代码来源:X86AtaDevice.cpp


示例14: Q_ASSERT

KoFilter::ConversionStatus XlsxXmlCommentsReader::read(MSOOXML::MsooXmlReaderContext* context)
{
    m_context = dynamic_cast<XlsxXmlCommentsReaderContext*>(context);
    Q_ASSERT(m_context);
    m_colorIndices = m_context->colorIndices;
    m_themes = m_context->themes;
    const KoFilter::ConversionStatus result = readInternal();
    m_context = 0;
    if (result != KoFilter::OK) {
        kWarning() << "Failure reading the comments";
    }
    // We're not going to fail reading the whole file because the comments cannot be read
    return KoFilter::OK;
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:14,代码来源:XlsxXmlCommentsReader.cpp



注:本文中的readInternal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ readLabel函数代码示例发布时间:2022-05-30
下一篇:
C++ readInt函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap