[Libreoffice] [PATCH] SAL_N_ELEMENTS for writer, impress and calc

Norbert Thiebaud nthiebaud at gmail.com
Sat Oct 9 12:03:51 PDT 2010


On Sat, Oct 9, 2010 at 12:08 PM, Kayo Hamid <revol.code at yahoo.com> wrote:
>
>
> Hi Norbert, thank you. Can you explain for me where is this definition (SAL_N_ELEMENTS) that all theses sources share in common? My knowledge in C++ are few.
> New patchs attached.

Thanks. looks good.
I just removed a chunk in calc:
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -228,7 +228,7 @@ void dbg_call_generateMappingODFF()
     }
     fprintf( stdout, "addinfuncdata___:%s", "};\n");
     fprintf( stdout, "%s", "\n// static\nconst ScCompiler::AddInMap*
ScCompiler::GetAddInMap()\n{\n    return maAddInMap;\n}\n");
-    fprintf( stdout, "%s", "\n// static\nsize_t
ScCompiler::GetAddInMapCount()\n{\n    return
sizeof(maAddInMap)/sizeof(maAddInMap[0]);\n}\n");
+    fprintf( stdout, "%s", "\n// static\nsize_t
ScCompiler::GetAddInMapCount()\n{\n    return
SAL_N_ELEMENTS(maAddInMap);\n}\n");
     fflush( stdout);
 }
 #endif  // erGENERATEMAPPING

since it is not clear if the recipient of that generated piece of code
will now about SAL_N_ELEMENTS

Commited.

Thanks again.

Norbert


>
> Hi revol_
>
> Thanks for the patch.
>
> One remark. You want to use the macro SAL_N_ELEMENTS, not define your own ELEMENTS_OF_ARRAY in every sources.
>
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>


More information about the LibreOffice mailing list