/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// This function must be called to release memory allocated by lok_dlerror() staticvoid lok_dlerror_free(char *pErrMessage)
{
(void)pErrMessage; // Do nothing for return of dlerror()
}
// This function must be called to release memory allocated by lok_dlerror() staticvoid lok_dlerror_free(char *pErrMessage)
{
HeapFree(GetProcessHeap(), 0, pErrMessage);
}
dlhandle = lok_loadlib(imp_lib); if (!dlhandle)
{ // If TARGET_LIB exists, and likely is a real library (not a // small one-line text stub as in the --enable-mergedlib // case), but dlopen failed for some reason, don't try // TARGET_MERGED_LIB. struct stat st; if (stat(imp_lib, &st) == 0 && st.st_size > 100)
{ char *pErrMessage = lok_dlerror();
fprintf(stderr, "failed to open library '%s': %s\n",
imp_lib, pErrMessage);
lok_dlerror_free(pErrMessage);
free(imp_lib); return NULL;
}
dlhandle = lok_dlopen(install_path, &imp_lib); if (!dlhandle) return NULL;
pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2"); if (!pSym2)
{ if (user_profile_url != NULL)
{
fprintf( stderr, "the LibreOffice version in '%s' does not support passing a user profile to the hook function\n",
imp_lib );
lok_dlclose( dlhandle );
free( imp_lib ); return NULL;
}
pSym = (LokHookFunction *) lok_dlsym( dlhandle, "libreofficekit_hook" ); if (!pSym)
{
fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib );
lok_dlclose( dlhandle );
free( imp_lib ); return NULL;
}
free( imp_lib ); // dlhandle is "leaked" // coverity[leaked_storage] - on purpose return pSym( install_path );
}
if (user_profile_url != NULL && user_profile_url[0] == '/')
{ // It should be either a file: URL or a vnd.sun.star.pathname: URL.
fprintf( stderr, "second parameter to lok_init_2 '%s' should be a URL, not a pathname\n", user_profile_url );
lok_dlclose( dlhandle );
free( imp_lib ); return NULL;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.