Skip to content

(minor) Warnings for lrint when compiling in Xcode for iOS #212

@KoenT-SS

Description

@KoenT-SS

First: thanks to Erik and everyone else here for making and maintaining libsamplerate!

This is just a minor issue (I think):

I'm seeing several warnings in Xcode when compiling for iOS arm64 in Xcode (15.3):

Compiling src_sinc.c
/Users/.....snip...../libsamplerate/src/common.h:221:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrintf (x) ;
/Users/.....snip...../libsamplerate/src/common.h:226:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrint (x) ;

Compiling src_zoh.c
/Users/.....snip...../libsamplerate/src/common.h:221:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrintf (x) ;
/Users/.....snip...../libsamplerate/src/common.h:226:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrint (x) ;

Compiling samplerate.c
/Users/.....snip...../libsamplerate/src/common.h:221:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrintf (x) ;
/Users/.....snip...../libsamplerate/src/common.h:226:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrint (x) ;

Compiling src_linear.c
/Users/.....snip...../libsamplerate/src/common.h:221:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrintf (x) ;
/Users/.....snip...../libsamplerate/src/common.h:226:9: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return lrint (x) ;

I'm building after generating Xcode build files (including the config.h file) using cmake like this:

cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS

I'm attaching the config.h file here for completeness sake. Since I couldn't attach a .h file, I had to rename it to config.h.txt.
config.h.txt

I think the warnings can probably be safely ignored in this case, but it's a bit annoying to see them each time for an otherwise flawless build. So, if there is an easy fix, that might clean it up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions