Skip to content

Commit a7cc8c0

Browse files
committed
fix the rbruntimerror
1 parent 5b1ca46 commit a7cc8c0

File tree

7 files changed

+125
-142
lines changed

7 files changed

+125
-142
lines changed

ext/gdal-ruby/gdal/extconf.rb

-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
dir_config 'gdal',
66
`gdal-config --cflags`.split(' ')[0].gsub(/-I/, ''),
77
`gdal-config --libs`.split(' ')[0].gsub(/-L/, '')
8-
9-
$CFLAGS << ' -Wno-format-security -Wformat-nonliteral'
108

119
have_library 'gdal' or raise 'libgdal not found'
1210

13-
14-
1511
pkg_config 'gdal'
1612

1713
$libs = append_library $libs, 'gdal'

ext/gdal-ruby/gdal/gdal.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ static CPLXMLNode *RubyArrayToXMLTree(VALUE rubyArray)
19221922
nChildCount = RARRAY_LEN(rubyArray) - 2;
19231923
if( nChildCount < 0 )
19241924
{
1925-
rb_raise(rb_eRuntimeError, "Error in input XMLTree, child count is less than zero.");
1925+
rb_raise(rb_eRuntimeError, "%s", "Error in input XMLTree, child count is less than zero.");
19261926
}
19271927

19281928
VALUE item1 = rb_ary_entry(rubyArray, 0);
@@ -8343,7 +8343,7 @@ _wrap_gcps_to_geo_transform(int argc, VALUE *argv, VALUE self) {
83438343
SWIG_ConvertPtr( rubyItem, (void**)&item, SWIGTYPE_p_GDAL_GCP, SWIG_POINTER_EXCEPTION | 0 );
83448344

83458345
if (!item) {
8346-
rb_raise(rb_eRuntimeError, "GDAL_GCP item cannot be nil");
8346+
rb_raise(rb_eRuntimeError, "%s", "GDAL_GCP item cannot be nil");
83478347
}
83488348

83498349
memcpy( (void*) item, (void*) tmpGCPList1, sizeof( GDAL_GCP ) );
@@ -9432,7 +9432,7 @@ _wrap_Dataset_set_gcps(int argc, VALUE *argv, VALUE self) {
94329432
SWIG_ConvertPtr( rubyItem, (void**)&item, SWIGTYPE_p_GDAL_GCP, SWIG_POINTER_EXCEPTION | 0 );
94339433

94349434
if (!item) {
9435-
rb_raise(rb_eRuntimeError, "GDAL_GCP item cannot be nil");
9435+
rb_raise(rb_eRuntimeError, "%s", "GDAL_GCP item cannot be nil");
94369436
}
94379437

94389438
memcpy( (void*) item, (void*) tmpGCPList2, sizeof( GDAL_GCP ) );
@@ -17545,7 +17545,7 @@ _wrap_serialize_xml_tree(int argc, VALUE *argv, VALUE self) {
1754517545
arg1 = RubyArrayToXMLTree(argv[0]);
1754617546

1754717547
if ( !arg1 ) {
17548-
rb_raise(rb_eRuntimeError, "Could not convert Ruby Array to XML tree.");
17548+
rb_raise(rb_eRuntimeError, "%s", "Could not convert Ruby Array to XML tree.");
1754917549
}
1755017550
}
1755117551
{

ext/gdal-ruby/gdalconst/extconf.rb

-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
dir_config 'gdal',
66
`gdal-config --cflags`.split(' ')[0].gsub(/-I/, ''),
77
`gdal-config --libs`.split(' ')[0].gsub(/-L/, '')
8-
9-
$CFLAGS << ' -Wno-format-security -Wformat-nonliteral'
108

119
have_library 'gdal' or raise 'libgdal not found'
1210

13-
14-
1511
pkg_config 'gdal'
1612

1713
$libs = append_library $libs, 'gdal'

ext/gdal-ruby/ogr/extconf.rb

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22

33
raise 'gdal-config not found.' if `which gdal-config`.empty?
44

5+
raise 'gdal-config not found.' if `which gdal-config`.empty?
6+
57
dir_config 'gdal',
68
`gdal-config --cflags`.split(' ')[0].gsub(/-I/, ''),
79
`gdal-config --libs`.split(' ')[0].gsub(/-L/, '')
8-
9-
$CFLAGS << ' -Wno-format-security -Wformat-nonliteral'
10-
print "Current CFLAGS: #{$CFLAGS}\n"
11-
$CFLAGS.gsub!(/-Werror=format-security/, "-Wno-format-security")
12-
print "Modified CFLAGS: #{$CFLAGS}\n"
1310

1411
have_library 'gdal' or raise 'libgdal not found'
1512

16-
17-
1813
pkg_config 'gdal'
1914

2015
$libs = append_library $libs, 'gdal'

ext/gdal-ruby/ogr/ogr.cpp

+30-30
Original file line numberDiff line numberDiff line change
@@ -4264,7 +4264,7 @@ _wrap_DataSource_delete_layer(int argc, VALUE *argv, VALUE self) {
42644264
{
42654265
/* %typemap(out) OGRErr */
42664266
if (result != 0) {
4267-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
4267+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
42684268
}
42694269
}
42704270
{
@@ -4327,7 +4327,7 @@ _wrap_DataSource_sync_to_disk(int argc, VALUE *argv, VALUE self) {
43274327
{
43284328
/* %typemap(out) OGRErr */
43294329
if (result != 0) {
4330-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
4330+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
43314331
}
43324332
}
43334333
{
@@ -5152,7 +5152,7 @@ _wrap_Layer_set_attribute_filter(int argc, VALUE *argv, VALUE self) {
51525152
{
51535153
/* %typemap(out) OGRErr */
51545154
if (result != 0) {
5155-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
5155+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
51565156
}
51575157
}
51585158
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -5601,7 +5601,7 @@ _wrap_Layer_set_next_by_index(int argc, VALUE *argv, VALUE self) {
56015601
{
56025602
/* %typemap(out) OGRErr */
56035603
if (result != 0) {
5604-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
5604+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
56055605
}
56065606
}
56075607
{
@@ -5677,7 +5677,7 @@ _wrap_Layer_set_feature(int argc, VALUE *argv, VALUE self) {
56775677
{
56785678
/* %typemap(out) OGRErr */
56795679
if (result != 0) {
5680-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
5680+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
56815681
}
56825682
}
56835683
{
@@ -5753,7 +5753,7 @@ _wrap_Layer_create_feature(int argc, VALUE *argv, VALUE self) {
57535753
{
57545754
/* %typemap(out) OGRErr */
57555755
if (result != 0) {
5756-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
5756+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
57575757
}
57585758
}
57595759
{
@@ -5824,7 +5824,7 @@ _wrap_Layer_delete_feature(int argc, VALUE *argv, VALUE self) {
58245824
{
58255825
/* %typemap(out) OGRErr */
58265826
if (result != 0) {
5827-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
5827+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
58285828
}
58295829
}
58305830
{
@@ -5887,7 +5887,7 @@ _wrap_Layer_sync_to_disk(int argc, VALUE *argv, VALUE self) {
58875887
{
58885888
/* %typemap(out) OGRErr */
58895889
if (result != 0) {
5890-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
5890+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
58915891
}
58925892
}
58935893
{
@@ -6088,7 +6088,7 @@ _wrap_Layer_get_extent(int argc, VALUE *argv, VALUE self) {
60886088
{
60896089
/* %typemap(out) OGRErr */
60906090
if (result != 0) {
6091-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6091+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
60926092
}
60936093
}
60946094
{
@@ -6259,7 +6259,7 @@ _wrap_Layer_create_field(int argc, VALUE *argv, VALUE self) {
62596259
{
62606260
/* %typemap(out) OGRErr */
62616261
if (result != 0) {
6262-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6262+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
62636263
}
62646264
}
62656265
{
@@ -6330,7 +6330,7 @@ _wrap_Layer_delete_field(int argc, VALUE *argv, VALUE self) {
63306330
{
63316331
/* %typemap(out) OGRErr */
63326332
if (result != 0) {
6333-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6333+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
63346334
}
63356335
}
63366336
{
@@ -6409,7 +6409,7 @@ _wrap_Layer_reorder_field(int argc, VALUE *argv, VALUE self) {
64096409
{
64106410
/* %typemap(out) OGRErr */
64116411
if (result != 0) {
6412-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6412+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
64136413
}
64146414
}
64156415
{
@@ -6493,7 +6493,7 @@ _wrap_Layer_reorder_fields(int argc, VALUE *argv, VALUE self) {
64936493
{
64946494
/* %typemap(out) OGRErr */
64956495
if (result != 0) {
6496-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6496+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
64976497
}
64986498
}
64996499
{
@@ -6597,7 +6597,7 @@ _wrap_Layer_alter_field_defn(int argc, VALUE *argv, VALUE self) {
65976597
{
65986598
/* %typemap(out) OGRErr */
65996599
if (result != 0) {
6600-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6600+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
66016601
}
66026602
}
66036603
{
@@ -6660,7 +6660,7 @@ _wrap_Layer_start_transaction(int argc, VALUE *argv, VALUE self) {
66606660
{
66616661
/* %typemap(out) OGRErr */
66626662
if (result != 0) {
6663-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6663+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
66646664
}
66656665
}
66666666
{
@@ -6723,7 +6723,7 @@ _wrap_Layer_commit_transaction(int argc, VALUE *argv, VALUE self) {
67236723
{
67246724
/* %typemap(out) OGRErr */
67256725
if (result != 0) {
6726-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6726+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
67276727
}
67286728
}
67296729
{
@@ -6786,7 +6786,7 @@ _wrap_Layer_rollback_transaction(int argc, VALUE *argv, VALUE self) {
67866786
{
67876787
/* %typemap(out) OGRErr */
67886788
if (result != 0) {
6789-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6789+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
67906790
}
67916791
}
67926792
{
@@ -6969,7 +6969,7 @@ _wrap_Layer_set_ignored_fields(int argc, VALUE *argv, VALUE self) {
69696969
{
69706970
/* %typemap(out) OGRErr */
69716971
if (result != 0) {
6972-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
6972+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
69736973
}
69746974
}
69756975
{
@@ -7247,7 +7247,7 @@ _wrap_Feature_set_geometry(int argc, VALUE *argv, VALUE self) {
72477247
{
72487248
/* %typemap(out) OGRErr */
72497249
if (result != 0) {
7250-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
7250+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
72517251
}
72527252
}
72537253
{
@@ -7316,7 +7316,7 @@ _wrap_Feature_set_geometry_directly(int argc, VALUE *argv, VALUE self) {
73167316
{
73177317
/* %typemap(out) OGRErr */
73187318
if (result != 0) {
7319-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
7319+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
73207320
}
73217321
}
73227322
{
@@ -8928,7 +8928,7 @@ _wrap_Feature_set_fid(int argc, VALUE *argv, VALUE self) {
89288928
{
89298929
/* %typemap(out) OGRErr */
89308930
if (result != 0) {
8931-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
8931+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
89328932
}
89338933
}
89348934
{
@@ -10334,7 +10334,7 @@ _wrap_Feature_set_from(int argc, VALUE *argv, VALUE self) {
1033410334
{
1033510335
/* %typemap(out) OGRErr */
1033610336
if (result != 0) {
10337-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
10337+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1033810338
}
1033910339
}
1034010340
{
@@ -10439,7 +10439,7 @@ _wrap_Feature_set_from_with_map(int argc, VALUE *argv, VALUE self) {
1043910439
{
1044010440
/* %typemap(out) OGRErr */
1044110441
if (result != 0) {
10442-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
10442+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1044310443
}
1044410444
}
1044510445
{
@@ -13371,7 +13371,7 @@ _wrap_Geometry_export_to_wkt(int argc, VALUE *argv, VALUE self) {
1337113371
{
1337213372
/* %typemap(out) OGRErr */
1337313373
if (result != 0) {
13374-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
13374+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1337513375
}
1337613376
}
1337713377
{
@@ -13477,7 +13477,7 @@ _wrap_Geometry_export_to_wkb(int argc, VALUE *argv, VALUE self) {
1347713477
{
1347813478
/* %typemap(out) OGRErr */
1347913479
if (result != 0) {
13480-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
13480+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1348113481
}
1348213482
}
1348313483
{
@@ -13884,7 +13884,7 @@ _wrap_Geometry_add_geometry_directly(int argc, VALUE *argv, VALUE self) {
1388413884
{
1388513885
/* %typemap(out) OGRErr */
1388613886
if (result != 0) {
13887-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
13887+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1388813888
}
1388913889
}
1389013890
{
@@ -13960,7 +13960,7 @@ _wrap_Geometry_add_geometry(int argc, VALUE *argv, VALUE self) {
1396013960
{
1396113961
/* %typemap(out) OGRErr */
1396213962
if (result != 0) {
13963-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
13963+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1396413964
}
1396513965
}
1396613966
{
@@ -16769,7 +16769,7 @@ _wrap_Geometry_transform_to(int argc, VALUE *argv, VALUE self) {
1676916769
{
1677016770
/* %typemap(out) OGRErr */
1677116771
if (result != 0) {
16772-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
16772+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1677316773
}
1677416774
}
1677516775
{
@@ -16845,7 +16845,7 @@ _wrap_Geometry_transform(int argc, VALUE *argv, VALUE self) {
1684516845
{
1684616846
/* %typemap(out) OGRErr */
1684716847
if (result != 0) {
16848-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
16848+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1684916849
}
1685016850
}
1685116851
{
@@ -17677,7 +17677,7 @@ _wrap_set_generate_db2_v72_byte_order(int argc, VALUE *argv, VALUE self) {
1767717677
{
1767817678
/* %typemap(out) OGRErr */
1767917679
if (result != 0) {
17680-
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
17680+
rb_raise(rb_eRuntimeError, "%s", OGRErrMessages(result));
1768117681
}
1768217682
}
1768317683
{

ext/gdal-ruby/osr/extconf.rb

-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
dir_config 'gdal',
66
`gdal-config --cflags`.split(' ')[0].gsub(/-I/, ''),
77
`gdal-config --libs`.split(' ')[0].gsub(/-L/, '')
8-
9-
$CFLAGS << ' -Wno-format-security -Wformat-nonliteral'
108

119
have_library 'gdal' or raise 'libgdal not found'
1210

13-
14-
1511
pkg_config 'gdal'
1612

1713
$libs = append_library $libs, 'gdal'

0 commit comments

Comments
 (0)