diff --git a/godal.cpp b/godal.cpp index 025137a..4720055 100644 --- a/godal.cpp +++ b/godal.cpp @@ -1770,20 +1770,20 @@ namespace cpl } // namespace cpl -bool VSIHasGoHandler(const char *pszPrefix) +int godalVSIHasGoHandler(const char *pszPrefix) { CSLConstList papszPrefix = VSIFileManager::GetPrefixes(); for( size_t i = 0; papszPrefix && papszPrefix[i]; ++i ) { if(strcmp(papszPrefix[i],pszPrefix)==0) { - return true; + return TRUE; } } - return false; + return FALSE; } -void VSIInstallGoHandler(cctx *ctx, const char *pszPrefix, size_t bufferSize, size_t cacheSize) +void godalVSIInstallGoHandler(cctx *ctx, const char *pszPrefix, size_t bufferSize, size_t cacheSize) { - bool alreadyExists = VSIHasGoHandler(pszPrefix); + bool alreadyExists = godalVSIHasGoHandler(pszPrefix) != 0; godalWrap(ctx); if (alreadyExists) { CPLError(CE_Failure, CPLE_AppDefined, "handler already registered on prefix"); @@ -1986,4 +1986,4 @@ void godalGCPListToGeoTransform(cctx *ctx, goGCPList GCPList, int numGCPs, doubl CPLFree(GDALGCPList); godalUnwrap(); -} \ No newline at end of file +} diff --git a/godal.go b/godal.go index 902c715..599dda1 100644 --- a/godal.go +++ b/godal.go @@ -3886,7 +3886,7 @@ func RegisterVSIHandler(prefix string, handler KeySizerReaderAt, opts ...VSIHand return fmt.Errorf("handler already registered on prefix") } cgc := createCGOContext(nil, opt.errorHandler) - C.VSIInstallGoHandler(cgc.cPointer(), C.CString(prefix), C.size_t(opt.bufferSize), C.size_t(opt.cacheSize)) + C.godalVSIInstallGoHandler(cgc.cPointer(), C.CString(prefix), C.size_t(opt.bufferSize), C.size_t(opt.cacheSize)) if err := cgc.close(); err != nil { return err } @@ -3900,7 +3900,7 @@ func RegisterVSIHandler(prefix string, handler KeySizerReaderAt, opts ...VSIHand // HasVSIHandler returns true if a VSIHandler is registered for this prefix func HasVSIHandler(prefix string) bool { - return bool(C.VSIHasGoHandler(C.CString(prefix))) + return C.godalVSIHasGoHandler(C.CString(prefix)) != 0 } // BuildVRT runs the GDALBuildVRT function and creates a VRT dataset from a list of datasets diff --git a/godal.h b/godal.h index c834a8e..fd9dfed 100644 --- a/godal.h +++ b/godal.h @@ -130,8 +130,8 @@ extern "C" { void godalStartTransaction(cctx *ctx, GDALDatasetH ds, int bForce); void godalDatasetRollbackTransaction(cctx *ctx, GDALDatasetH ds); void godalCommitTransaction(cctx *ctx, GDALDatasetH ds); - bool VSIHasGoHandler(const char *pszPrefix); - void VSIInstallGoHandler(cctx *ctx, const char *pszPrefix, size_t bufferSize, size_t cacheSize); + int godalVSIHasGoHandler(const char *pszPrefix); + void godalVSIInstallGoHandler(cctx *ctx, const char *pszPrefix, size_t bufferSize, size_t cacheSize); void godalGetColorTable(GDALRasterBandH bnd, GDALPaletteInterp *interp, int *nEntries, short **entries); void godalSetColorTable(cctx *ctx, GDALRasterBandH bnd, GDALPaletteInterp interp, int nEntries, short *entries);