@@ -442,6 +442,10 @@ namespace std {
442
442
* Default char * and C array typemaps
443
443
* ----------------------------------------------------------------------------- */
444
444
445
+ %fragment("<string.h>", "runtime") %{
446
+ #include <string.h>
447
+ %}
448
+
445
449
/* Set up the typemap for handling new return strings */
446
450
447
451
#ifdef __cplusplus
@@ -453,7 +457,7 @@ namespace std {
453
457
/* Default typemap for handling char * members */
454
458
455
459
#ifdef __cplusplus
456
- %typemap(memberin) char * {
460
+ %typemap(memberin,fragment="<string.h>" ) char * {
457
461
delete [] $1;
458
462
if ($input) {
459
463
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
@@ -462,15 +466,15 @@ namespace std {
462
466
$1 = 0;
463
467
}
464
468
}
465
- %typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
469
+ %typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>" ) const char * {
466
470
if ($input) {
467
471
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
468
472
strcpy((char *)$1, (const char *)$input);
469
473
} else {
470
474
$1 = 0;
471
475
}
472
476
}
473
- %typemap(globalin) char * {
477
+ %typemap(globalin,fragment="<string.h>" ) char * {
474
478
delete [] $1;
475
479
if ($input) {
476
480
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
@@ -479,7 +483,7 @@ namespace std {
479
483
$1 = 0;
480
484
}
481
485
}
482
- %typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
486
+ %typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>" ) const char * {
483
487
if ($input) {
484
488
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
485
489
strcpy((char *)$1, (const char *)$input);
@@ -488,7 +492,7 @@ namespace std {
488
492
}
489
493
}
490
494
#else
491
- %typemap(memberin) char * {
495
+ %typemap(memberin,fragment="<string.h>" ) char * {
492
496
free($1);
493
497
if ($input) {
494
498
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
@@ -497,15 +501,15 @@ namespace std {
497
501
$1 = 0;
498
502
}
499
503
}
500
- %typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
504
+ %typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>" ) const char * {
501
505
if ($input) {
502
506
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
503
507
strcpy((char *)$1, (const char *)$input);
504
508
} else {
505
509
$1 = 0;
506
510
}
507
511
}
508
- %typemap(globalin) char * {
512
+ %typemap(globalin,fragment="<string.h>" ) char * {
509
513
free($1);
510
514
if ($input) {
511
515
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
@@ -514,7 +518,7 @@ namespace std {
514
518
$1 = 0;
515
519
}
516
520
}
517
- %typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
521
+ %typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>" ) const char * {
518
522
if ($input) {
519
523
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
520
524
strcpy((char *)$1, (const char *)$input);
@@ -527,7 +531,7 @@ namespace std {
527
531
528
532
/* Character array handling */
529
533
530
- %typemap(memberin) char [ANY] {
534
+ %typemap(memberin,fragment="<string.h>" ) char [ANY] {
531
535
if($input) {
532
536
strncpy((char*)$1, (const char *)$input, $1_dim0-1);
533
537
$1[$1_dim0-1] = 0;
@@ -536,7 +540,7 @@ namespace std {
536
540
}
537
541
}
538
542
539
- %typemap(globalin) char [ANY] {
543
+ %typemap(globalin,fragment="<string.h>" ) char [ANY] {
540
544
if($input) {
541
545
strncpy((char*)$1, (const char *)$input, $1_dim0-1);
542
546
$1[$1_dim0-1] = 0;
@@ -545,33 +549,33 @@ namespace std {
545
549
}
546
550
}
547
551
548
- %typemap(memberin) char [] {
552
+ %typemap(memberin,fragment="<string.h>" ) char [] {
549
553
if ($input) strcpy((char *)$1, (const char *)$input);
550
554
else $1[0] = 0;
551
555
}
552
556
553
- %typemap(globalin) char [] {
557
+ %typemap(globalin,fragment="<string.h>" ) char [] {
554
558
if ($input) strcpy((char *)$1, (const char *)$input);
555
559
else $1[0] = 0;
556
560
}
557
561
558
562
/* memberin/globalin typemap for arrays. */
559
563
560
- %typemap(memberin) SWIGTYPE [ANY] {
564
+ %typemap(memberin,fragment="<string.h>" ) SWIGTYPE [ANY] {
561
565
size_t ii;
562
566
$1_basetype *b = ($1_basetype *) $1;
563
567
for (ii = 0; ii < (size_t)$1_size; ii++) b[ii] = *(($1_basetype *) $input + ii);
564
568
}
565
569
566
- %typemap(globalin) SWIGTYPE [ANY] {
570
+ %typemap(globalin,fragment="<string.h>" ) SWIGTYPE [ANY] {
567
571
size_t ii;
568
572
$1_basetype *b = ($1_basetype *) $1;
569
573
for (ii = 0; ii < (size_t)$1_size; ii++) b[ii] = *(($1_basetype *) $input + ii);
570
574
}
571
575
572
576
/* memberin/globalin typemap for double arrays. */
573
577
574
- %typemap(memberin) SWIGTYPE [ANY][ANY] {
578
+ %typemap(memberin,fragment="<string.h>" ) SWIGTYPE [ANY][ANY] {
575
579
$basetype (*inp)[$1_dim1] = ($basetype (*)[$1_dim1])($input);
576
580
$basetype (*dest)[$1_dim1] = ($basetype (*)[$1_dim1])($1);
577
581
size_t ii = 0;
@@ -583,7 +587,7 @@ namespace std {
583
587
}
584
588
}
585
589
586
- %typemap(globalin) SWIGTYPE [ANY][ANY] {
590
+ %typemap(globalin,fragment="<string.h>" ) SWIGTYPE [ANY][ANY] {
587
591
$basetype (*inp)[$1_dim1] = ($basetype (*)[$1_dim1])($input);
588
592
$basetype (*dest)[$1_dim1] = ($basetype (*)[$1_dim1])($1);
589
593
size_t ii = 0;
0 commit comments