Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe561c5

Browse files
Rework blobstamper code. We do not need both size and end count. So leave only one (and it is end that will be left)
1 parent6d8607a commitbe561c5

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

‎blobstamper/blob.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
Blob::Blob (char * data_in,size_t size_in)
2828
{
2929
data = data_in;
30-
size = size_in;
3130
begin =0;
32-
end =size -1;/* i.e. size=1 means begin=0 && end=0*/
31+
end =size_in -1;/* i.e. size=1 means begin=0 && end=0*/
3332
}
3433

3534
bool
@@ -77,7 +76,7 @@ Blob::Chop(size_t min_size, size_t max_size)
7776
std::vector<char>
7877
Blob::AsByteVector()
7978
{
80-
std::vector<char>res(data + begin, data +begin +size);
79+
std::vector<char>res(data + begin, data +end +1);
8180
return res;
8281
}
8382

@@ -100,8 +99,6 @@ std::vector<char>
10099
Blob::asVector()
101100
{
102101
std::vector<char>res( (char *)data + begin, (char*)data + begin +Size());
103-
104-
// memcpy(&res[0], data + begin, Size());
105102
return res;
106103
}
107104

‎blobstamper/blob.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ class StampBase;
2929

3030
classBlob
3131
{
32-
protected:
32+
private:
3333
char* data;
34-
size_t size;
3534
size_t begin;
3635
size_t end;
3736
public:
@@ -49,12 +48,12 @@ class Blob
4948
std::stringasString();/* Should not be used in prod, for tests and examples only*/
5049
};
5150

52-
classOutOfData/*Anexeption. Experemental for now*/
51+
classOutOfData/*Anexception. Experimental for now*/
5352
{
5453

5554
};
5655

57-
classNotImplemented/*Anexeption*/
56+
classNotImplemented/*Anexception*/
5857
{
5958

6059
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp