summaryrefslogtreecommitdiff
path: root/Ports/cmake/patches/0003-stoi-atoi-2.patch
blob: 8d55dcc0afe639debe7b0388d7b982cc5885fa1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
From ba18f1f52135b3dc08e4c7889f214807ce6bb966 Mon Sep 17 00:00:00 2001
From: AnotherTest <ali.mpfard@gmail.com>
Date: Thu, 11 Feb 2021 19:35:50 +0330
Subject: [PATCH 03/11] stoi -> atoi 2

---
 Source/cmFileCommand.cxx           |  2 +-
 Source/cmListCommand.cxx           | 22 +++++++++++-----------
 Source/cmStandardLevelResolver.cxx |  8 ++++----
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 372179c..ea9631a 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3104,7 +3104,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
       cmSystemTools::SetFatalErrorOccured();
       return false;
     }
-    compressionLevel = std::stoi(parsedArgs.CompressionLevel);
+    compressionLevel = atoi((parsedArgs.CompressionLevel).c_str());
     if (compressionLevel < 0 || compressionLevel > 9) {
       status.SetError(cmStrCat("compression level ",
                                parsedArgs.CompressionLevel,
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 687273e..a79074d 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -901,12 +901,12 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
       // get all specified indexes
       std::vector<int> indexes;
       while (args.size() > ++index) {
-        std::size_t pos;
+        char* pos;
         int value;
 
         try {
-          value = std::stoi(args[index], &pos);
-          if (pos != args[index].length()) {
+          value = strtol(args[index].c_str(), &pos, 10);
+          if (pos != args[index].c_str() + args[index]) {
             // this is not a number, stop processing
             break;
           }
@@ -944,15 +944,15 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
       int step = 1;
       bool valid = true;
       try {
-        std::size_t pos;
+        char* pos;
 
-        start = std::stoi(args[index], &pos);
-        if (pos != args[index].length()) {
+        start = strtol(args[index].c_str(), &pos, 10);
+        if (pos != args[index].c_str() + args[index].length()) {
           // this is not a number
           valid = false;
         } else {
-          stop = std::stoi(args[++index], &pos);
-          if (pos != args[index].length()) {
+          start = strtol(args[++index].c_str(), &pos, 10);
+          if (pos != args[index].c_str() + args[index].length()) {
             // this is not a number
             valid = false;
           }
@@ -969,10 +969,10 @@ bool HandleTransformCommand(std::vector<std::string> const& args,
       // try to read a third numeric value for step
       if (args.size() > ++index) {
         try {
-          std::size_t pos;
+          char* pos;
 
-          step = std::stoi(args[index], &pos);
-          if (pos != args[index].length()) {
+          start = strtol(args[index].c_str(), &pos, 10);
+          if (pos != args[index].c_str() + args[index].length()) {
             // this is not a number
             step = 1;
           } else {
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index c418b09..50510e4 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -117,7 +117,7 @@ struct StanardLevelComputer
     int defaultValue = -1;
     try {
       standardValue = atoi((standardStr).c_str());
-      defaultValue = std::stoi(*defaultStd);
+      defaultValue = atoi((*defaultStd).c_str());
     } catch (std::invalid_argument&) {
       // fall through as we want an error
       // when we can't find the bad value in the `stds` vector
@@ -195,7 +195,7 @@ struct StanardLevelComputer
     if (existingStandard) {
       existingLevelIter =
         std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
-                  std::stoi(*existingStandard));
+                  atoi((*existingStandard).c_str()));
       if (existingLevelIter == cm::cend(this->Levels)) {
         const std::string e =
           cmStrCat("The ", this->Language, "_STANDARD property on target \"",
@@ -240,7 +240,7 @@ struct StanardLevelComputer
     }
     // convert defaultStandard to an integer
     if (std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
-                  std::stoi(*defaultStandard)) == cm::cend(this->Levels)) {
+                  atoi((*defaultStandard).c_str())) == cm::cend(this->Levels)) {
       const std::string e = cmStrCat("The CMAKE_", this->Language,
                                      "_STANDARD_DEFAULT variable contains an "
                                      "invalid value: \"",
@@ -257,7 +257,7 @@ struct StanardLevelComputer
 
     auto existingLevelIter =
       std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
-                std::stoi(*existingStandard));
+                atoi((*existingStandard).c_str()));
     if (existingLevelIter == cm::cend(this->Levels)) {
       const std::string e =
         cmStrCat("The ", this->Language, "_STANDARD property on target \"",
-- 
2.30.1