<!DOCTYPE html><html><head><title></title><style type="text/css">#qt p.qt-MsoNormal{margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt;font-size:11pt;font-family:"Calibri", sans-serif;}
#qt a:link{color:rgb(5, 99, 193);text-decoration-line:underline;text-decoration-style:solid;text-decoration-color:currentcolor;text-decoration-thickness:auto;}
#qt a:visited{color:rgb(149, 79, 114);text-decoration-line:underline;text-decoration-style:solid;text-decoration-color:currentcolor;text-decoration-thickness:auto;}
#qt p{margin-right:0cm;margin-left:0cm;font-size:12pt;font-family:"Times New Roman", serif;}
p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style="font-family:Arial;">Hi,<br></div><div style="font-family:Arial;"><br></div><div>On Wed, Feb 14, 2024, at 10:53, Abel Pau via gdal-dev wrote:<br></div><blockquote type="cite" id="qt" style=""><div class="qt-WordSection1"><div style="border-top-width:1pt;border-top-style:solid;border-top-color:rgb(227, 227, 227);border-right-width:1pt;border-right-style:solid;border-right-color:rgb(227, 227, 227);border-bottom-width:1pt;border-bottom-style:solid;border-bottom-color:rgb(227, 227, 227);border-left-width:1pt;border-left-style:solid;border-left-color:rgb(227, 227, 227);border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;padding-top:0cm;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;background-color:white;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;"><p style="margin-right:0cm;margin-bottom:15pt;margin-left:0cm;background-color:white;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;border-top-width:medium;border-top-style:none;border-top-color:currentcolor;border-right-width:medium;border-right-style:none;border-right-color:currentcolor;border-bottom-width:medium;border-bottom-style:none;border-bottom-color:currentcolor;border-left-width:medium;border-left-style:none;border-left-color:currentcolor;border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;padding-top:0cm;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;"><span style="color:rgb(13, 13, 13);"><span class="font" style="font-family:"Segoe UI", sans-serif;">Hi,</span></span><br></p><p style="margin-right:0cm;margin-bottom:15pt;margin-left:0cm;background-color:white;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;border-top-width:medium;border-top-style:none;border-top-color:currentcolor;border-right-width:medium;border-right-style:none;border-right-color:currentcolor;border-bottom-width:medium;border-bottom-style:none;border-bottom-color:currentcolor;border-left-width:medium;border-left-style:none;border-left-color:currentcolor;border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;padding-top:0cm;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;box-sizing:border-box;font-variant-ligatures:normal;font-variant-caps:normal;text-align:start;-webkit-text-stroke-width:0px;white-space:pre-wrap;text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px;"><span style="color:rgb(13, 13, 13);"><span class="font" style="font-family:"Segoe UI", sans-serif;">I am currently working on a driver and have been utilizing CPL_calloc(). However, when attempting to pass the Actions, I encounter errors such as:</span></span><br></p><p style="margin-right:0cm;margin-bottom:15pt;margin-left:0cm;background-color:white;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;border-top-width:medium;border-top-style:none;border-top-color:currentcolor;border-right-width:medium;border-right-style:none;border-right-color:currentcolor;border-bottom-width:medium;border-bottom-style:none;border-bottom-color:currentcolor;border-left-width:medium;border-left-style:none;border-left-color:currentcolor;border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;padding-top:0cm;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;box-sizing:border-box;font-variant-ligatures:normal;font-variant-caps:normal;text-align:start;-webkit-text-stroke-width:0px;white-space:pre-wrap;text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px;"><span style="color:rgb(13, 13, 13);"><span class="font" style="font-family:"Segoe UI", sans-serif;">warning C4244: 'function': conversion from 'MM_INTERNAL_FID' to 'size_t', possible loss of data</span></span><br></p><p style="margin-right:0cm;margin-bottom:15pt;margin-left:0cm;background-color:white;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;border-top-width:medium;border-top-style:none;border-top-color:currentcolor;border-right-width:medium;border-right-style:none;border-right-color:currentcolor;border-bottom-width:medium;border-bottom-style:none;border-bottom-color:currentcolor;border-left-width:medium;border-left-style:none;border-left-color:currentcolor;border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;padding-top:0cm;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;box-sizing:border-box;font-variant-ligatures:normal;font-variant-caps:normal;text-align:start;-webkit-text-stroke-width:0px;white-space:pre-wrap;text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px;"><span style="color:rgb(13, 13, 13);"><span class="font" style="font-family:"Segoe UI", sans-serif;">This issue can be addressed by casting 'MM_INTERNAL_FID' (which is a GUInt64, essentially an unsigned long long) to 'size_t' (also essentially an unsigned long long). So, utilizing a cast is not
problematic in this context.</span></span><br></p></div></div></blockquote><div style="font-family:Arial;">The warning makes sense on 32-bit platforms, where that cast will be problematic.<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">However, while I didn't check what MM_INTERNAL_FID is, it doesn't sound like something calloc() would take.<br></div><div style="font-family:Arial;"><br></div><blockquote type="cite" id="qt" style=""><div class="qt-WordSection1"><div style="border-top-width:1pt;border-top-style:solid;border-top-color:rgb(227, 227, 227);border-right-width:1pt;border-right-style:solid;border-right-color:rgb(227, 227, 227);border-bottom-width:1pt;border-bottom-style:solid;border-bottom-color:rgb(227, 227, 227);border-left-width:1pt;border-left-style:solid;border-left-color:rgb(227, 227, 227);border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;padding-top:0cm;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;background-color:white;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;"><p style="margin-right:0cm;margin-bottom:15pt;margin-left:0cm;background-color:white;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;border-top-width:medium;border-top-style:none;border-top-color:currentcolor;border-right-width:medium;border-right-style:none;border-right-color:currentcolor;border-bottom-width:medium;border-bottom-style:none;border-bottom-color:currentcolor;border-left-width:medium;border-left-style:none;border-left-color:currentcolor;border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;padding-top:0cm;padding-right:0cm;padding-bottom:0cm;padding-left:0cm;box-sizing:border-box;font-variant-ligatures:normal;font-variant-caps:normal;text-align:start;-webkit-text-stroke-width:0px;white-space:pre-wrap;text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px;"><span style="color:rgb(13, 13, 13);"><span class="font" style="font-family:"Segoe UI", sans-serif;">However, I noticed in the function description it states "used for small memory allocations," which prompts me to inquire if there is an alternative calloc function for larger memory allocations</span></span><br></p></div></div></blockquote><div style="font-family:Arial;">"Small" probably means "infallible" here. If you want a fallible allocation (which you're supposed to handle), you can use VSICalloc(), VSIMalloc() etc.<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">Laurentiu<br></div><div style="font-family:Arial;"><br></div></body></html>