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

C++ ParameterIncorrect函数代码示例

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

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



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

示例1: ValidateName

	void Serializer::Deserialize (const string &name, const BufferPtr &data)
	{
		ValidateName (name);

		uint64 size = Deserialize <uint64> ();
		if (data.Size() != size)
			throw ParameterIncorrect (SRC_POS);

		DataStream->ReadCompleteBuffer (data);
	}
开发者ID:BitMerc,项目名称:veracrypt,代码行数:10,代码来源:Serializer.cpp


示例2: ParameterIncorrect

	void VolumeHeader::Serialize (const BufferPtr &header) const
	{
		if (header.Size() != EncryptedHeaderDataSize)
			throw ParameterIncorrect (SRC_POS);

		header.Zero();

		header[0] = 'V';
		header[1] = 'E';
		header[2] = 'R';
		header[3] = 'A';
		size_t offset = 4;

		header.GetRange (DataAreaKeyOffset, DataAreaKey.Size()).CopyFrom (DataAreaKey);

		uint16 headerVersion = CurrentHeaderVersion;
		SerializeEntry (headerVersion, header, offset);
		SerializeEntry (RequiredMinProgramVersion, header, offset);
		SerializeEntry (Crc32::ProcessBuffer (header.GetRange (DataAreaKeyOffset, DataKeyAreaMaxSize)), header, offset);

		uint64 reserved64 = 0;
		SerializeEntry (reserved64, header, offset);
		SerializeEntry (reserved64, header, offset);

		SerializeEntry (HiddenVolumeDataSize, header, offset);
		SerializeEntry (VolumeDataSize, header, offset);
		SerializeEntry (EncryptedAreaStart, header, offset);
		SerializeEntry (EncryptedAreaLength, header, offset);
		SerializeEntry (Flags, header, offset);

		if (SectorSize < TC_MIN_VOLUME_SECTOR_SIZE
			|| SectorSize > TC_MAX_VOLUME_SECTOR_SIZE
			|| SectorSize % ENCRYPTION_DATA_UNIT_SIZE != 0)
		{
			throw ParameterIncorrect (SRC_POS);
		}

		SerializeEntry (SectorSize, header, offset);

		offset = TC_HEADER_OFFSET_HEADER_CRC - TC_HEADER_OFFSET_MAGIC;
		SerializeEntry (Crc32::ProcessBuffer (header.GetRange (0, TC_HEADER_OFFSET_HEADER_CRC - TC_HEADER_OFFSET_MAGIC)), header, offset);
	}
开发者ID:AB9IL,项目名称:VeraCrypt,代码行数:42,代码来源:VolumeHeader.cpp


示例3: ss

	uint32 StringConverter::ToUInt32 (const string &str)
	{
		uint32 n;
		stringstream ss (str);

		ss >> n;
		if (ss.fail() || n == 0xffffFFFFU)
			throw ParameterIncorrect (SRC_POS);

		return n;
	}
开发者ID:josejamilena,项目名称:veracrypt,代码行数:11,代码来源:StringConverter.cpp


示例4: ss

	int64 StringConverter::ToInt64 (const string &str)
	{
		int64 n;
		stringstream ss (str);

		ss >> n;
		if (ss.fail() || n == 0x7fffFFFFffffFFFFLL || n == -0x7fffFFFFffffFFFFLL)
			throw ParameterIncorrect (SRC_POS);

		return n;
	}
开发者ID:AB9IL,项目名称:VeraCrypt,代码行数:11,代码来源:StringConverter.cpp


示例5: ParameterIncorrect

	void *Memory::Allocate (std::size_t size)
	{
		if (size < 1)
			throw ParameterIncorrect (SRC_POS);

		void *bufPtr = malloc (size);
		if (!bufPtr)
			throw bad_alloc();

		return bufPtr;
	}
开发者ID:CipherShed,项目名称:CipherShed,代码行数:11,代码来源:Memory.cpp


示例6: ParameterIncorrect

	string StringConverter::GetTrailingNumber (const string &str)
	{
		size_t start = str.find_last_not_of ("0123456789");
		if (start == string::npos)
			return str;

		string s = str.substr (start + 1);
		if (s.empty ())
			throw ParameterIncorrect (SRC_POS);

		return s;
	}
开发者ID:josejamilena,项目名称:veracrypt,代码行数:12,代码来源:StringConverter.cpp


示例7: ParameterIncorrect

	void Cipher::SetKey (const ConstBufferPtr &key)
	{
		if (key.Size() != GetKeySize ())
			throw ParameterIncorrect (SRC_POS);

		if (!Initialized)
			ScheduledKey.Allocate (GetScheduledKeySize ());

		SetCipherKey (key);
		Key.CopyFrom (key);
		Initialized = true;
	}
开发者ID:wyrover,项目名称:VeraCrypt,代码行数:12,代码来源:Cipher.cpp


示例8: sizeof

	T Serializer::Deserialize ()
	{
		uint64 size;
		DataStream->ReadCompleteBuffer (BufferPtr ((byte *) &size, sizeof (size)));
		
		if (Endian::Big (size) != sizeof (T))
			throw ParameterIncorrect (SRC_POS);

		T data;
		DataStream->ReadCompleteBuffer (BufferPtr ((byte *) &data, sizeof (data)));

		return Endian::Big (data);
	}
开发者ID:4nt1m0n,项目名称:truecrypt,代码行数:13,代码来源:Serializer.cpp


示例9: GetVersion

	bool SystemInfo::IsVersionAtLeast (int versionNumber1, int versionNumber2, int versionNumber3)
	{
		vector <int> osVersionNumbers = GetVersion();

		if (osVersionNumbers.size() < 2)
			throw ParameterIncorrect (SRC_POS);

		if (osVersionNumbers.size() < 3)
			osVersionNumbers[2] = 0;

		return (osVersionNumbers[0] * 10000000 +  osVersionNumbers[1] * 10000 + osVersionNumbers[2]) >=
			(versionNumber1 * 10000000 +  versionNumber2 * 10000 + versionNumber3);
	}
开发者ID:NaldoDj,项目名称:VeraCrypt,代码行数:13,代码来源:SystemInfo.cpp


示例10: deserializedObject

	auto_ptr <T> CoreService::GetResponse ()
	{
		auto_ptr <Serializable> deserializedObject (Serializable::DeserializeNew (ServiceOutputStream));
		
		Exception *deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
		if (deserializedException)
			deserializedException->Throw();

		if (dynamic_cast <T *> (deserializedObject.get()) == nullptr)
			throw ParameterIncorrect (SRC_POS);

		return auto_ptr <T> (dynamic_cast <T *> (deserializedObject.release()));
	}
开发者ID:cocoon,项目名称:VeraCrypt,代码行数:13,代码来源:CoreService.cpp


示例11: NotInitialized

	void EncryptionAlgorithm::SetKey (const ConstBufferPtr &key)
	{
		if (Ciphers.size() < 1)
			throw NotInitialized (SRC_POS);

		if (GetKeySize() != key.Size())
			throw ParameterIncorrect (SRC_POS);

		size_t keyOffset = 0;
		foreach_ref (Cipher &c, Ciphers)
		{
			c.SetKey (key.GetRange (keyOffset, c.GetKeySize()));
			keyOffset += c.GetKeySize();
		}
开发者ID:josejamilena,项目名称:veracrypt,代码行数:14,代码来源:EncryptionAlgorithm.cpp


示例12: ParameterIncorrect

	uint64 MemoryStream::Read (const BufferPtr &buffer)
	{
		if (Data.size() == 0)
			throw ParameterIncorrect (SRC_POS);

		ConstBufferPtr streamBuf (*this);
		size_t len = buffer.Size();
		if (streamBuf.Size() - ReadPosition < len)
			len = streamBuf.Size() - ReadPosition;

		BufferPtr(buffer).CopyFrom (streamBuf.GetRange (ReadPosition, len));
		ReadPosition += len;
		return len;
	}
开发者ID:ggielly,项目名称:GostCrypt_Windows_1.0,代码行数:14,代码来源:MemoryStream.cpp


示例13: switch

	uint64 EncryptionModeLRW::SectorToBlockIndex (uint64 sectorIndex) const
	{
		sectorIndex -= SectorOffset;

		switch (Ciphers.front()->GetBlockSize())
		{
		case 8:
			return (sectorIndex << 6) | 1;

		case 16:
			return (sectorIndex << 5) | 1;
		
		default:
			throw ParameterIncorrect (SRC_POS);
		}
	}
开发者ID:BlueBlock,项目名称:truecrypt,代码行数:16,代码来源:EncryptionModeLRW.cpp


示例14: ParameterIncorrect

	void EncryptionModeLRW::SetKey (const ConstBufferPtr &key)
	{
		if (key.Size() != 16)
			throw ParameterIncorrect (SRC_POS);

		if (!KeySet)
			GfContext.Allocate (sizeof (GfCtx));

		if (!Gf64TabInit ((unsigned char *) key.Get(), (GfCtx *) (GfContext.Ptr())))
			throw bad_alloc();

		if (!Gf128Tab64Init ((unsigned char *) key.Get(), (GfCtx *) (GfContext.Ptr())))
			throw bad_alloc();

		Key.CopyFrom (key);
		KeySet = true;
	}
开发者ID:BlueBlock,项目名称:truecrypt,代码行数:17,代码来源:EncryptionModeLRW.cpp


示例15: switch

	void VolumeFormatOptionsWizardPage::SetFilesystemType (VolumeCreationOptions::FilesystemType::Enum type)
	{
		switch (type)
		{
		case VolumeCreationOptions::FilesystemType::None:		FilesystemTypeChoice->SetStringSelection (LangString["NONE"]); break;
		case VolumeCreationOptions::FilesystemType::FAT:		FilesystemTypeChoice->SetStringSelection (L"FAT"); break;
		case VolumeCreationOptions::FilesystemType::NTFS:		FilesystemTypeChoice->SetStringSelection (L"NTFS"); break;
		case VolumeCreationOptions::FilesystemType::Ext2:		FilesystemTypeChoice->SetStringSelection (L"Linux Ext2"); break;
		case VolumeCreationOptions::FilesystemType::Ext3:		FilesystemTypeChoice->SetStringSelection (L"Linux Ext3"); break;
		case VolumeCreationOptions::FilesystemType::Ext4:		FilesystemTypeChoice->SetStringSelection (L"Linux Ext4"); break;
		case VolumeCreationOptions::FilesystemType::MacOsExt:	FilesystemTypeChoice->SetStringSelection (L"Mac OS Extended"); break;
		case VolumeCreationOptions::FilesystemType::UFS:		FilesystemTypeChoice->SetStringSelection (L"UFS"); break;

		default:
			throw ParameterIncorrect (SRC_POS);
		}
	}
开发者ID:cocoon,项目名称:VeraCrypt,代码行数:17,代码来源:VolumeFormatOptionsWizardPage.cpp


示例16: PasswordTooLong

	void VolumePassword::Set (const wchar_t *password, size_t charCount)
	{
		if (charCount > MaxSize)
			throw PasswordTooLong (SRC_POS);

		union Conv
		{
			byte b[sizeof (wchar_t)];
			wchar_t c;
		};

		Conv conv;
		conv.c = L'A';
		
		int lsbPos = -1;
		for (size_t i = 0; i < sizeof (conv.b); ++i)
		{
			if (conv.b[i] == L'A')
			{
				lsbPos = i;
				break;
			}
		}

		if (lsbPos == -1)
			throw ParameterIncorrect (SRC_POS);

		bool unportable = false;
		byte passwordBuf[MaxSize];
		for (size_t i = 0; i < charCount; ++i)
		{
			conv.c = password[i];
			passwordBuf[i] = conv.b[lsbPos];
			for (int j = 0; j < (int) sizeof (wchar_t); ++j)
			{
				if (j != lsbPos && conv.b[j] != 0)
					unportable = true;
			}
		}
		
		Set (passwordBuf, charCount);
		
		if (unportable)
			Unportable = true;
	}
开发者ID:cocoon,项目名称:VeraCrypt,代码行数:45,代码来源:VolumePassword.cpp


示例17: switch

	void Application::Initialize (UserInterfaceType::Enum type)
	{
		switch (type)
		{
		case UserInterfaceType::Text:
			{
				wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) CreateConsoleApp);
				break;
			}

#ifndef TC_NO_GUI
		case UserInterfaceType::Graphic:
			{
				wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) CreateGuiApp);
				break;
			}
#endif

		default:
			throw ParameterIncorrect (SRC_POS);
		}
	}
开发者ID:CipherShed,项目名称:CipherShed,代码行数:22,代码来源:Application.cpp


示例18: ParameterIncorrect

	void Buffer::Allocate (size_t size)
	{
		if (size < 1)
			throw ParameterIncorrect (SRC_POS);

		if (DataPtr != nullptr)
		{
			if (DataSize == size)
				return;
			Free();
		}

		try
		{
			DataPtr = static_cast<byte *> (Memory::Allocate (size));
			DataSize = size;
		}
		catch (...)
		{
			DataPtr = nullptr;
			DataSize = 0;
			throw;
		}
	}
开发者ID:ggielly,项目名称:GostCrypt_Windows_1.0,代码行数:24,代码来源:Buffer.cpp


示例19: CoalesceSlotNumberAndMountPoint

	shared_ptr <VolumeInfo> CoreUnix::MountVolume (MountOptions &options)
	{
		CoalesceSlotNumberAndMountPoint (options);

		if (IsVolumeMounted (*options.Path))
			throw VolumeAlreadyMounted (SRC_POS);

		Cipher::EnableHwSupport (!options.NoHardwareCrypto);

		shared_ptr <Volume> volume;

		while (true)
		{
			try
			{
				volume = OpenVolume (
					options.Path,
					options.PreserveTimestamps,
					options.Password,
					options.Keyfiles,
					options.Protection,
					options.ProtectionPassword,
					options.ProtectionKeyfiles,
					options.SharedAccessAllowed,
					VolumeType::Unknown,
					options.UseBackupHeaders,
					options.PartitionInSystemEncryptionScope
					);

				options.Password.reset();
			}
			catch (SystemException &e)
			{
				if (options.Protection != VolumeProtection::ReadOnly
					&& (e.GetErrorCode() == EROFS || e.GetErrorCode() == EACCES || e.GetErrorCode() == EPERM))
				{
					// Read-only filesystem
					options.Protection = VolumeProtection::ReadOnly;
					continue;
				}

				throw;
			}

			break;
		}

		if (options.Path->IsDevice())
		{
			if (volume->GetFile()->GetDeviceSectorSize() != volume->GetSectorSize())
				throw ParameterIncorrect (SRC_POS);

#if defined (TC_LINUX)
			if (volume->GetSectorSize() != TC_SECTOR_SIZE_LEGACY)
			{
				if (options.Protection == VolumeProtection::HiddenVolumeReadOnly)
					throw UnsupportedSectorSizeHiddenVolumeProtection();

				if (options.NoKernelCrypto)
					throw UnsupportedSectorSizeNoKernelCrypto();
			}
#endif
		}

		// Find a free mount point for FUSE service
		MountedFilesystemList mountedFilesystems = GetMountedFilesystems ();
		string fuseMountPoint;
		for (int i = 1; true; i++)
		{
			stringstream path;
			path << GetTempDirectory() << "/" << GetFuseMountDirPrefix() << i;
			FilesystemPath fsPath (path.str());

			bool inUse = false;

			foreach_ref (const MountedFilesystem &mf, mountedFilesystems)
			{
				if (mf.MountPoint == path.str())
				{
					inUse = true;
					break;
				}
			}

			if (!inUse)
			{
				try
				{
					if (fsPath.IsDirectory())
						fsPath.Delete();

					throw_sys_sub_if (mkdir (path.str().c_str(), S_IRUSR | S_IXUSR) == -1, path.str());

					fuseMountPoint = fsPath;
					break;
				}
				catch (...)
				{
					if (i > 255)
						throw TemporaryDirectoryFailure (SRC_POS, StringConverter::ToWide (path.str()));
//.........这里部分代码省略.........
开发者ID:martialboniou,项目名称:truecrypt64,代码行数:101,代码来源:CoreUnix.cpp


示例20: switch

void File::Open (const FilePath &path, FileOpenMode mode, FileShareMode shareMode, FileOpenFlags flags)
{
#ifdef TC_LINUX
    int sysFlags = O_LARGEFILE;
#else
    int sysFlags = 0;
#endif

    switch (mode)
    {
    case CreateReadWrite:
        sysFlags |= O_CREAT | O_TRUNC | O_RDWR;
        break;

    case CreateWrite:
        sysFlags |= O_CREAT | O_TRUNC | O_WRONLY;
        break;

    case OpenRead:
        sysFlags |= O_RDONLY;
        break;

    case OpenWrite:
        sysFlags |= O_WRONLY;
        break;

    case OpenReadWrite:
        sysFlags |= O_RDWR;
        break;

    default:
        throw ParameterIncorrect (SRC_POS);
    }

    if ((flags & File::PreserveTimestamps) && path.IsFile())
    {
        struct stat statData;
        throw_sys_sub_if (stat (string (path).c_str(), &statData) == -1, wstring (path));
        AccTime = statData.st_atime;
        ModTime = statData.st_mtime;
    }

    FileHandle = open (string (path).c_str(), sysFlags, S_IRUSR | S_IWUSR);
    throw_sys_sub_if (FileHandle == -1, wstring (path));

#if 0 // File locking is disabled to avoid remote filesystem locking issues
    try
    {
        struct flock fl;
        memset (&fl, 0, sizeof (fl));
        fl.l_whence = SEEK_SET;
        fl.l_start = 0;
        fl.l_len = 0;

        switch (shareMode)
        {
        case ShareNone:
            fl.l_type = F_WRLCK;
            if (fcntl (FileHandle, F_SETLK, &fl) == -1)
                throw_sys_sub_if (errno == EAGAIN || errno == EACCES, wstring (path));
            break;

        case ShareRead:
            fl.l_type = F_RDLCK;
            if (fcntl (FileHandle, F_SETLK, &fl) == -1)
                throw_sys_sub_if (errno == EAGAIN || errno == EACCES, wstring (path));
            break;

        case ShareReadWrite:
            fl.l_type = (mode == OpenRead ? F_RDLCK : F_WRLCK);
            if (fcntl (FileHandle, F_GETLK, &fl) != -1 && fl.l_type != F_UNLCK)
            {
                errno = EAGAIN;
                throw SystemException (SRC_POS, wstring (path));
            }
            break;

        case ShareReadWriteIgnoreLock:
            break;

        default:
            throw ParameterIncorrect (SRC_POS);
        }
    }
    catch (...)
    {
        close (FileHandle);
        throw;
    }
#endif // 0

    Path = path;
    mFileOpenFlags = flags;
    FileIsOpen = true;
}
开发者ID:Clockwork-Sphinx,项目名称:VeraCrypt,代码行数:95,代码来源:File.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Parameters函数代码示例发布时间:2022-05-30
下一篇:
C++ ParameterException函数代码示例发布时间: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