1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #26434 from dkurt:dk/int64_file_storage_4.x

int64 data type support for FileStorage. 1d and empty Mat with exact dimensions #26434

### Pull Request Readiness Checklist

Port of https://github.com/opencv/opencv/pull/26399 to 4.x branch

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Dmitry Kurtaev
2024-11-11 14:13:33 +03:00
committed by GitHub
parent 6f8c3b13d8
commit 37c2af63f0
9 changed files with 166 additions and 17 deletions
+8 -2
View File
@@ -81,6 +81,12 @@ public:
writeScalar( key, fs::itoa( value, buf, 10 ));
}
void write(const char* key, int64_t value)
{
char buf[128];
writeScalar( key, fs::itoa( value, buf, 10, true ));
}
void write( const char* key, double value )
{
char buf[128];
@@ -596,7 +602,7 @@ public:
}
else
{
int ival = (int)strtol( beg, &ptr, 0 );
int64_t ival = strtoll( beg, &ptr, 0 );
CV_PERSISTENCE_CHECK_END_OF_BUFFER_BUG_CPP();
node.setValue(FileNode::INT, &ival);
@@ -623,7 +629,7 @@ public:
else if( (len == 4 && memcmp( beg, "true", 4 ) == 0) ||
(len == 5 && memcmp( beg, "false", 5 ) == 0) )
{
int ival = *beg == 't' ? 1 : 0;
int64_t ival = *beg == 't' ? 1 : 0;
node.setValue(FileNode::INT, &ival);
}
else