Skip to content

Commit fb73a05

Browse files
committed
Make utfgrid driver use msIO output (#5260)
1 parent 4af7028 commit fb73a05

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

maputfgrid.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ int utfgridSaveImage(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *form
481481
imgheight = img->height/renderer->utfresolution;
482482
imgwidth = img->width/renderer->utfresolution;
483483

484-
fprintf(fp,"{\"grid\":[");
484+
msIO_fprintf(fp,"{\"grid\":[");
485485

486486
/* Print the buffer, also */
487487
for(row=0; row<imgheight; row++) {
@@ -491,8 +491,8 @@ int utfgridSaveImage(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *form
491491
stringptr = string;
492492
/* Needs comma between each lines but JSON must not start with a comma. */
493493
if(row!=0)
494-
fprintf(fp,",");
495-
fprintf(fp,"\"");
494+
msIO_fprintf(fp,",");
495+
msIO_fprintf(fp,"\"");
496496
for(col=0; col<img->width/renderer->utfresolution; col++) {
497497
/* Get the datas from buffer. */
498498
pixelid = renderer->buffer[(row*imgwidth)+col];
@@ -505,51 +505,51 @@ int utfgridSaveImage(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *form
505505
*stringptr = '\0';
506506
char * utf8;
507507
utf8 = msConvertWideStringToUTF8 (string, "UCS-4LE");
508-
fprintf(fp,"%s", utf8);
508+
msIO_fprintf(fp,"%s", utf8);
509509
msFree(utf8);
510510
msFree(string);
511-
fprintf(fp,"\"");
511+
msIO_fprintf(fp,"\"");
512512
}
513513

514-
fprintf(fp,"],\"keys\":[\"\"");
514+
msIO_fprintf(fp,"],\"keys\":[\"\"");
515515

516516
/* Prints the key specified */
517517
for(i=0;i<renderer->data->counter;i++) {
518-
fprintf(fp,",");
518+
msIO_fprintf(fp,",");
519519

520520
if(renderer->useutfitem)
521521
{
522522
pszEscaped = msEscapeJSonString(renderer->data->table[i].itemvalue);
523-
fprintf(fp,"\"%s\"", pszEscaped);
523+
msIO_fprintf(fp,"\"%s\"", pszEscaped);
524524
msFree(pszEscaped);
525525
}
526526
/* If no UTFITEM specified use the serial ID as the key */
527527
else
528-
fprintf(fp,"\"%i\"", renderer->data->table[i].serialid);
528+
msIO_fprintf(fp,"\"%i\"", renderer->data->table[i].serialid);
529529
}
530530

531-
fprintf(fp,"],\"data\":{");
531+
msIO_fprintf(fp,"],\"data\":{");
532532

533533
/* Print the datas */
534534
if(renderer->useutfdata) {
535535
for(i=0;i<renderer->data->counter;i++) {
536536
if(i!=0)
537-
fprintf(fp,",");
537+
msIO_fprintf(fp,",");
538538

539539
if(renderer->useutfitem)
540540
{
541541
pszEscaped = msEscapeJSonString(renderer->data->table[i].itemvalue);
542-
fprintf(fp,"\"%s\":", pszEscaped);
542+
msIO_fprintf(fp,"\"%s\":", pszEscaped);
543543
msFree(pszEscaped);
544544
}
545545
/* If no UTFITEM specified use the serial ID as the key */
546546
else
547-
fprintf(fp,"\"%i\":", renderer->data->table[i].serialid);
547+
msIO_fprintf(fp,"\"%i\":", renderer->data->table[i].serialid);
548548

549-
fprintf(fp,"%s", renderer->data->table[i].datavalues);
549+
msIO_fprintf(fp,"%s", renderer->data->table[i].datavalues);
550550
}
551551
}
552-
fprintf(fp,"}}");
552+
msIO_fprintf(fp,"}}");
553553

554554
return MS_SUCCESS;
555555
}

0 commit comments

Comments
 (0)