Git Product home page Git Product logo

struct2x's Issues

GenericReader::convertDouble need consider '-'

double GenericReader::convertDouble(const char* value, uint32_t length) {
if (!length) return 0.0;

	bool isNegative = false; // Flag to indicate if the number is negative
	double result = 0.0;
	uint32_t startIdx = 0; // Start index for processing the number

	// Check for negative sign
	if (value[0] == '-') {
		isNegative = true;
		startIdx = 1; // Start processing from the next character
	}

	for (uint32_t idx = startIdx, bFlag = false, num = 0; idx < length; ++idx) {
		const char& c = value[idx];
		if (c == '.') {
			bFlag = true;
			continue;
		}
		uint8_t n = c - '0';
		if (!bFlag) {
			result *= 10;
			result += n;
		}
		else {
			++num;
			result += decimal(n, num);
		}
	}

	// Negate the result if the number is negative
	if (isNegative) {
		result = -result;
	}

	return result;
}

mac上编译失败

jiuxian.tjo@B-Q3GDMD6M-2146 build % make
Scanning dependencies of target struct2x
[ 9%] Building CXX object CMakeFiles/struct2x.dir/src/struct2x.cpp.o
In file included from /Users/jiuxian.tjo/git/c++_project/struct2x/src/struct2x.cpp:1:
/Users/jiuxian.tjo/git/c++_project/struct2x/./include/struct2x.h:204:71: error: use of undeclared identifier '_atoi64'
static inline int64_t strto(const char* str) { return _atoi64(str); }
^
/Users/jiuxian.tjo/git/c++_project/struct2x/./include/struct2x.h:209:82: error: use of undeclared identifier '_atoi64'
static inline uint64_t strto(const char* str) { return (uint64_t)_atoi64(str); }
^
/Users/jiuxian.tjo/git/c++_project/struct2x/./include/struct2x.h:235:81: error: implicit instantiation of undefined template
'std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >'
static inline const char* tostr(const std::string& v) { return v.c_str(); }

请问这个项目的开源协议是啥?

您好,打算将您的代码用于商业用途,不知这个项目的开源协议是哪个?

我看里面用到了 cJSON 和 protobuf 的代码,是 MIT 协议么?

谢谢!

编译错误

protobuf/decoder.h encoder.h缺少cstring

/mnt/d/NEW_CONF/struct2x/./include/struct2x/protobuf/encoder.h: In constructor ‘struct2x::PBEncoder::enclosure_t::enclosure_t(uint32_t, uint32_t)’:
/mnt/d/NEW_CONF/struct2x/./include/struct2x/protobuf/encoder.h:45:70: error: ‘memset’ was not declared in this scope
45 | enclosure_t(uint32_t t, uint32_t n) : type(t), size(n) { memset(sz, 0, 10); }
| ^~~~~~
/mnt/d/NEW_CONF/struct2x/./include/struct2x/protobuf/encoder.h:9:1: note: ‘memset’ is defined in header ‘’; did you forget to ‘#include ’?
8 | #include <struct2x/traits.h>
+++ |+#include
9 |

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.