agfline / LibAAF

Library for Advanced Authoring Format (AAF) file reading.
GNU General Public License v2.0
25 stars 5 forks source link

common named symbols in global namespace #10

Closed x42 closed 9 months ago

x42 commented 10 months ago

utils.c and debug.c have some methods that may conflict with symbols provided by the app (or in Ardour's case plugins)

notably dump_hex, snprintf_realloc, clean_filename It is good practice for a library to either hide local functions (static) and/or prefix them with the library's name e.g aaf_dump_hex.

agfline commented 10 months ago

Ok thanks, working on it.

agfline commented 10 months ago

Do you think __attribute__((visibility, ("hidden"))) could be enough ? Most of those functions are for internal use only

x42 commented 10 months ago

yeah that can work, except it's not portable.

x42 commented 10 months ago

... unless if there was already a function with the same name, before libaaf is loaded. In which case that will be used (even if libaaf hides the symbol). debug_callback might be a contender there.

here's an example of this happening with a function called hanning: https://github.com/lucianodato/noise-repellent/issues/63#issuecomment-533112975

agfline commented 10 months ago

Done.

0000000000009ae0 T aaf_alloc
000000000000f000 T aafclass_classExists
000000000000f060 T aafclass_defineNewClass
000000000000f190 T aafclass_getClassByID
000000000000f1e0 T aafclass_getPropertyDefinitionByID
000000000000f210 T aafclass_setDefaultClasses
0000000000035a50 T aaf_dump_Classes
0000000000035260 T aaf_dump_Header
0000000000035390 T aaf_dump_Identification
00000000000358b0 T aaf_dump_MetaDictionary
0000000000035870 T aaf_dump_nodeStreamProperties
0000000000035610 T aaf_dump_ObjectProperties
0000000000035560 T aaf_dump_ObjectProperty
0000000000035650 T aaf_dump_rawProperties
000000000000bc30 T _aaf_foreach_ObjectInSet
000000000000eca0 T aaf_get_indirectValue
000000000000eb90 T aaf_get_MobByID
000000000000ec30 T aaf_get_MobSlotBySlotID
000000000000bca0 T aaf_get_ObjectByWeakRef
0000000000009d20 T aaf_get_ObjectPath
000000000000bef0 T aaf_get_property
000000000000be90 T aaf_get_PropertyIDByName
000000000000c290 T aaf_get_propertyValue
0000000000035bc0 T aafi_alloc
00000000000381e0 T aafi_dump_obj
0000000000039340 T aafi_dump_obj_no_support
0000000000035ce0 T aafi_enable_windows_VT100_output
0000000000040080 T aafi_extract_audio_essence
0000000000036500 T aafi_freeAudioClip
0000000000036d90 T aafi_freeAudioEssences
00000000000364b0 T aafi_freeAudioGain
00000000000364f0 T aafi_freeAudioPan
0000000000036a00 T aafi_freeAudioTracks
0000000000036060 T aafi_freeMarkers
0000000000036720 T aafi_freeTimelineItem
0000000000036840 T aafi_freeTimelineItems
00000000000366d0 T aafi_freeTransition
0000000000036660 T aafi_freeUserComments
0000000000036f70 T aafi_freeVideoEssences
0000000000036be0 T aafi_freeVideoTracks
0000000000035f00 T aafi_get_fadein
0000000000035f30 T aafi_get_fadeout
0000000000035f60 T aafi_get_xfade
0000000000035dc0 T aafi_load_file
000000000003f6e0 T aafi_locate_external_essence_file
0000000000036c50 T aafi_newAudioEssence
0000000000036890 T aafi_newAudioTrack
0000000000035f90 T aafi_newMarker
00000000000360d0 T aafi_newTimelineItem
0000000000036530 T aafi_newUserComment
0000000000036e40 T aafi_newVideoEssence
0000000000036a80 T aafi_newVideoTrack
0000000000040d80 T aafi_parse_audio_summary
000000000003b1d0 T aafi_parse_Segment
0000000000037020 T aafi_release
00000000000367d0 T aafi_removeTimelineItem
000000000003eaa0 T aafi_retrieveData
0000000000035cf0 T aafi_set_debug
0000000000035d10 T aafi_set_media_location
0000000000035d50 T aafi_set_trace_class
000000000000d4a0 T aaf_load_file
0000000000009b60 T aaf_release
000000000002bb20 T aaft_AlphaTransparencyToText
000000000002bd90 T aaft_BoolToText
000000000002bfb0 T aaft_ByteOrderToText
0000000000032550 T aaft_ClassIDToText
0000000000030a90 T aaft_CodingEquationsToText
0000000000030b60 T aaft_ColorPrimariesToText
000000000002bbc0 T aaft_ColorSitingToText
0000000000034de0 T aaft_CompressionToText
0000000000033b10 T aaft_ContainerToText
000000000002e910 T aaft_DataDefToText
000000000002c000 T aaft_ElectroSpatialToText
000000000002bd60 T aaft_FadeTypeToText
000000000002baf0 T aaft_FieldNumberToText
000000000002b580 T aaft_FileKindToText
000000000002b9f0 T aaft_FilmTypeToText
000000000002bb50 T aaft_FrameLayoutToText
000000000002f640 T aaft_InterpolationToText
000000000002b390 T aaft_MobIDToText
000000000002c1c0 T aaft_OPDefToText
000000000002bdc0 T aaft_OperationCategoryToText
000000000002ed40 T aaft_OperationDefToText
000000000002f7f0 T aaft_ParameterToText
0000000000030d60 T aaft_PIDToText
000000000002be40 T aaft_PluginCategoryToText
000000000002bc60 T aaft_ProductReleaseTypeToText
000000000002bce0 T aaft_ProductVersionToText
000000000002bf10 T aaft_ScanningDirectionToText
000000000002ba60 T aaft_SignalStandardToText
000000000002c0c0 T aaft_StoredFormToText
000000000002b870 T aaft_TapeCaseTypeToText
000000000002b960 T aaft_TapeFormatTypeToText
000000000002b4b0 T aaft_TimestampToText
0000000000030930 T aaft_TransferCharacteristicToText
000000000002c260 T aaft_TypeIDToText
0000000000030c30 T aaft_UsageCodeToText
000000000002b520 T aaft_VersionToText
000000000002b910 T aaft_VideoSignalTypeToText
                 U access@GLIBC_2.2.5
                 U calloc@GLIBC_2.2.5
0000000000004c40 T cfb_alloc
0000000000004bc0 T cfb_CLSIDToText
00000000000095a0 T cfb_dump_DiFAT
0000000000009280 T cfb_dump_FAT
0000000000009000 T cfb_dump_header
0000000000009400 T cfb_dump_MiniFAT
00000000000087f0 T cfb_dump_node
0000000000008b10 T cfb_dump_nodePath
0000000000008da0 T cfb_dump_nodePaths
0000000000008c50 T cfb_dump_nodePathStream
0000000000008790 T cfb_dump_nodeStream
00000000000080e0 T cfb__foreachSectorInStream
00000000000085b0 T cfb_getChildNode
0000000000007b60 T cfb_getMiniSector
0000000000008360 T cfb_getNodeByPath
0000000000005000 T cfb_getSector
0000000000007e30 T cfb_getStream
0000000000005270 T cfb_load_file
0000000000004e60 T cfb_new_file
0000000000004c70 T cfb_release
00000000000081e0 T cfb_w16towchar
                 U __ctype_b_loc@GLIBC_2.3
                 U __ctype_tolower_loc@GLIBC_2.3
                 w __cxa_finalize@GLIBC_2.2.5
                 U __errno_location@GLIBC_2.2.5
                 U fclose@GLIBC_2.2.5
                 U fopen@GLIBC_2.2.5
                 U fprintf@GLIBC_2.2.5
                 U fread@GLIBC_2.2.5
                 U free@GLIBC_2.2.5
                 U fseek@GLIBC_2.2.5
                 U ftell@GLIBC_2.2.5
                 U fwrite@GLIBC_2.2.5
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000045870 T laaf_debug_callback
00000000000459a0 T laaf_free_debug
0000000000045970 T laaf_new_debug
0000000000044fb0 T laaf_util_build_path
00000000000453f0 T laaf_util_c99strdup
0000000000044ec0 T laaf_util_clean_filename
0000000000045470 T laaf_util_dump_hex
0000000000044f60 T laaf_util_fop_get_file
00000000000451d0 T laaf_util_snprintf_realloc
0000000000045350 T laaf_util_vsnprintf_realloc
0000000000044e80 T laaf_util_wstr_contains_nonlatin
                 U log10
                 U malloc@GLIBC_2.2.5
                 U memcmp@GLIBC_2.2.5
                 U memcpy@GLIBC_2.14
0000000000044240 T protools_AAF
0000000000044280 T protools_post_processing
                 U realloc@GLIBC_2.2.5
0000000000044750 T resolve_AAF
0000000000044bc0 T resolve_parse_aafObject_DescriptiveMarker
00000000000447f0 T resolve_parse_aafObject_Selector
0000000000041640 T riff_parseAudioFile
00000000000414c0 T riff_writeWavFileHeader
                 U snprintf@GLIBC_2.2.5
                 U stdout@GLIBC_2.2.5
                 U strcmp@GLIBC_2.2.5
                 U strerror@GLIBC_2.2.5
                 U strlen@GLIBC_2.2.5
                 U strtol@GLIBC_2.2.5
                 U swprintf@GLIBC_2.2.5
0000000000041e30 T uriDecodeString
0000000000041f80 T uriFree
0000000000042020 T uriIsIPv4
0000000000042250 T uriIsIPv6
0000000000042860 T uriParse
                 U vsnprintf@GLIBC_2.2.5
                 U wcscmp@GLIBC_2.2.5
                 U wcslen@GLIBC_2.2.5
                 U wcsncmp@GLIBC_2.2.5
x42 commented 9 months ago

For future reference a single unique prefix for all functions is preferable.

Compare to libsndfile where all exposed methods are prefixed with sndfile_ or GTK, where all functions begin with gtk_ etc.

libAAF has still 6 different prefixes, and one would never expect riff_ or cfb_ there.