Skip to content

Commit 93c1861

Browse files
committed
Fixed isIPv4 and isIPv6
1 parent d318b39 commit 93c1861

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/wsjcpp_core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ std::string WSJCppCore::createUuid() {
413413

414414
// ---------------------------------------------------------------------
415415

416-
bool WSJCppCore::isIPv4(std::string& str) {
416+
bool WSJCppCore::isIPv4(const std::string& str) {
417417
int n = 0;
418418
std::string s[4] = {"", "", "", ""};
419419
for (int i = 0; i < str.length(); i++) {
@@ -443,7 +443,7 @@ bool WSJCppCore::isIPv4(std::string& str) {
443443

444444
// ---------------------------------------------------------------------
445445

446-
bool WSJCppCore::isIPv6(std::string& str) {
446+
bool WSJCppCore::isIPv6(const std::string& str) {
447447
unsigned char buf[sizeof(struct in6_addr)];
448448
bool isValid = inet_pton(AF_INET6, str.c_str(), buf);
449449
return isValid;

src/wsjcpp_core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class WSJCppCore {
4848

4949
static void initRandom();
5050
static std::string createUuid();
51-
static bool isIPv4(std::string& str);
52-
static bool isIPv6(std::string& str);
51+
static bool isIPv4(const std::string& str);
52+
static bool isIPv6(const std::string& str);
5353
};
5454

5555

wsjcpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ wsjcpp_version: v0.0.1
22
cmake_cxx_standard: 11
33
cmake_minimum_required: 3.0
44

5-
name: wsjcpp/wsjcpp-core
5+
name: wsjcpp-core
66
version: v0.0.4
77
description: Basic Utils for wsjcpp
88
issues: https://github.com/wsjcpp/wsjcpp-core/issues

0 commit comments

Comments
 (0)