Skip to content

Commit a89235e

Browse files
author
Szekeres Tamás
committed
Get rid of SWIG csharp warnings
1 parent dec8c71 commit a89235e

File tree

10 files changed

+34
-34
lines changed

10 files changed

+34
-34
lines changed

swig/csharp/apps/GDALAdjustContrast.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* SPDX-License-Identifier: MIT
1414
*****************************************************************************/
1515

16+
#pragma warning disable CA1416 // Validate platform compatibility
17+
1618
using System;
1719
using System.Drawing;
1820
using System.Drawing.Imaging;
@@ -309,3 +311,4 @@ private static void SaveBitmapDirect(Dataset ds, Bitmap bitmap, int xOff, int yO
309311
}
310312
}
311313
}
314+
#pragma warning restore CA1416 // Validate platform compatibility

swig/csharp/apps/GDALDatasetRasterIO.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* SPDX-License-Identifier: MIT
1313
*****************************************************************************/
1414

15+
#pragma warning disable CA1416 // Validate platform compatibility
16+
1517
using System;
1618
using System.Drawing;
1719
using System.Drawing.Imaging;
@@ -34,13 +36,13 @@
3436
/// </summary>
3537

3638
class GDALReadDirect {
37-
38-
public static void usage()
39+
40+
public static void usage()
3941

40-
{
42+
{
4143
Console.WriteLine("usage: GDALDatasetRasterIO {GDAL dataset name} {output file name}");
42-
System.Environment.Exit(-1);
43-
}
44+
System.Environment.Exit(-1);
45+
}
4446

4547
public static void Main(string[] args)
4648
{
@@ -60,7 +62,7 @@ public static void Main(string[] args)
6062
/* Open dataset. */
6163
/* -------------------------------------------------------------------- */
6264
Dataset ds = Gdal.Open( args[0], Access.GA_ReadOnly );
63-
65+
6466
if (ds == null)
6567
{
6668
Console.WriteLine("Can't open " + args[0]);
@@ -269,4 +271,5 @@ private static void SaveBitmapDirect(string filename, Dataset ds, int xOff, int
269271

270272
bitmap.Save(filename);
271273
}
272-
}
274+
}
275+
#pragma warning restore CA1416 // Validate platform compatibility

swig/csharp/apps/GDALDatasetWrite.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public static void Main(string[] args)
4444

4545
if (args.Length < 1) usage();
4646

47-
int bXSize, bYSize;
4847
int w, h;
4948

5049
w = 100;
@@ -56,9 +55,6 @@ public static void Main(string[] args)
5655
if (args.Length > 2)
5756
h = int.Parse(args[2]);
5857

59-
bXSize = w;
60-
bYSize = 1;
61-
6258
//try
6359
{
6460
/* -------------------------------------------------------------------- */

swig/csharp/apps/GDALRead.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* SPDX-License-Identifier: MIT
1212
*****************************************************************************/
1313

14+
#pragma warning disable CA1416 // Validate platform compatibility
15+
1416
using System;
1517
using System.Drawing;
1618
using System.Drawing.Imaging;
@@ -291,4 +293,5 @@ private static void SaveBitmapGrayBuffered(Dataset ds, string filename, int iOve
291293

292294
bitmap.Save(filename);
293295
}
294-
}
296+
}
297+
#pragma warning restore CA1416 // Validate platform compatibility

swig/csharp/apps/GDALReadDirect.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* SPDX-License-Identifier: MIT
1212
*****************************************************************************/
1313

14+
#pragma warning disable CA1416 // Validate platform compatibility
15+
1416
using System;
1517
using System.Drawing;
1618
using System.Drawing.Imaging;
@@ -291,4 +293,5 @@ private static void SaveBitmapGrayDirect(Dataset ds, string filename, int iOverv
291293

292294
bitmap.Save(filename);
293295
}
294-
}
296+
}
297+
#pragma warning restore CA1416 // Validate platform compatibility

swig/csharp/exe_template.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<OutputType>Exe</OutputType>
44
<TargetFramework>${CSHARP_APPLICATION_VERSION}</TargetFramework>
55
<RuntimeIdentifier>${CSHARP_RID}</RuntimeIdentifier>
6+
<SelfContained>true</SelfContained>
67
<CheckEolTargetFramework>false</CheckEolTargetFramework>
78
<AssemblyVersion>${GDAL_VERSION_MAJOR}.${GDAL_VERSION_MINOR}.${GDAL_VERSION_REV}</AssemblyVersion>
89
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>

swig/csharp/exe_template_dcomp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<OutputType>Exe</OutputType>
44
<TargetFramework>${CSHARP_APPLICATION_VERSION}</TargetFramework>
55
<RuntimeIdentifier>${CSHARP_RID}</RuntimeIdentifier>
6+
<SelfContained>true</SelfContained>
67
<CheckEolTargetFramework>false</CheckEolTargetFramework>
78
<AssemblyVersion>${GDAL_VERSION_MAJOR}.${GDAL_VERSION_MINOR}.${GDAL_VERSION_REV}</AssemblyVersion>
89
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>

swig/include/Relationship.i

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@
1919
#ifndef SWIGCSHARP
2020
typedef int GDALRelationshipCardinality;
2121
typedef int GDALRelationshipType;
22-
#else
23-
%rename (RelationshipCardinality) GDALRelationshipCardinality;
24-
typedef enum {
25-
/*! One-to-one */ GRC_ONE_TO_ONE,
26-
/*! One-to-many */ GRC_ONE_TO_MANY,
27-
/*! Many-to-one */ GRC_MANY_TO_ONE,
28-
/*! Many-to-many */ GRC_MANY_TO_MANY,
29-
} GDALRelationshipCardinality;
30-
31-
%rename (RelationshipType) GDALRelationshipType;
32-
typedef enum {
33-
/*! Composite relationship */ GRT_COMPOSITE,
34-
/*! Association relationship */ GRT_ASSOCIATION,
35-
/*! Aggregation relationship */ GRT_AGGREGATION
36-
} GDALRelationshipType;
37-
3822
#endif /* CSHARP */
3923

4024
%rename (Relationship) GDALRelationshipShadow;
@@ -135,9 +119,15 @@ public:
135119
}
136120
%clear char**pList;
137121

122+
#ifdef SWIGCSHARP
123+
GDALRelationshipType GetRelationshipType() {
124+
return GDALRelationshipGetType( self );
125+
}
126+
#else
138127
GDALRelationshipType GetType() {
139128
return GDALRelationshipGetType( self );
140129
}
130+
#endif
141131

142132
void SetType( GDALRelationshipType type ) {
143133
return GDALRelationshipSetType( self, type );

swig/include/cpl.i

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,10 @@ retStringAndCPLFree* EscapeString(const char* str, int scheme) {
244244
%clear (int len, unsigned char *bin_string);
245245
#elif defined(SWIGCSHARP)
246246
%inline %{
247-
retStringAndCPLFree* EscapeString(int len, char *bin_string , int scheme) {
248-
return CPLEscapeString((const char*)bin_string, len, scheme);
249-
}
250-
%}
251-
252247
retStringAndCPLFree* EscapeString(int len, char *bin_string , int scheme=CPLES_SQL) {
253248
return CPLEscapeString(bin_string, len, scheme);
254249
}
250+
%}
255251
#elif defined(SWIGPYTHON)
256252

257253
%feature( "kwargs" ) wrapper_EscapeString;

swig/include/osr.i

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ typedef void OSRCoordinateTransformationShadow;
142142
#endif
143143
%}
144144

145+
#ifndef FROM_OGR_I
145146
typedef int OGRErr;
147+
#endif
146148

147149
#if defined(SWIGPYTHON)
148150
%include osr_python.i
@@ -1292,6 +1294,8 @@ public:
12921294
#endif
12931295
#if SWIGPYTHON
12941296
void _TransformPoint4Double( double inout[4] ) {
1297+
#elif defined(SWIGCSHARP)
1298+
void TransformPoint4D( double inout[4] ) {
12951299
#else
12961300
void TransformPoint( double inout[4] ) {
12971301
#endif

0 commit comments

Comments
 (0)