Code Monkey home page Code Monkey logo

Comments (6)

paultcochrane avatar paultcochrane commented on June 29, 2024

I believe you're correct: the algo = SvIV( ST( i + 1 ) ); line seems to be missing from the Chromaprint.xs file.

Incidentally, I think the current code (in the POD):

// we only store unless it's the algorithm
// then we simply override the value and store it later
if ( strcmp( SvPV_nolen( ST(i) ), "algorithm" ) == 0 ) {
    const char *algo_v = SvPV_nolen(value);
    // check algorithm options
    if (!strcmp( algo_v, "test1")) {
        algo = CHROMAPRINT_ALGORITHM_TEST1;
    } else if (!strcmp(algo_v, "test2")) {
        algo = CHROMAPRINT_ALGORITHM_TEST2;
    } else if (!strcmp(algo_v, "test3")) {
        algo = CHROMAPRINT_ALGORITHM_TEST3;
    } else if (!strcmp(algo_v, "test4")) {
        algo = CHROMAPRINT_ALGORITHM_TEST4;
    } else {
        warn("WARNING: unknown algorithm, using the default");
    }
    algo = SvIV( ST( i + 1 ) );
}

should be changed to this:

// we only store unless it's the algorithm
// then we simply override the value and store it later
if ( strcmp( SvPV_nolen( ST(i) ), "algorithm" ) == 0 ) {
    const char *algo_v = SvPV_nolen(value);
    // check algorithm options
    if (!strcmp( algo_v, "test1")) {
        algo = CHROMAPRINT_ALGORITHM_TEST1;
    } else if (!strcmp(algo_v, "test2")) {
        algo = CHROMAPRINT_ALGORITHM_TEST2;
    } else if (!strcmp(algo_v, "test3")) {
        algo = CHROMAPRINT_ALGORITHM_TEST3;
    } else if (!strcmp(algo_v, "test4")) {
        algo = CHROMAPRINT_ALGORITHM_TEST4;
    } else {
        warn("WARNING: unknown algorithm, using the default");
        algo = SvIV( ST( i + 1 ) );
    }
}

and that the code in Chromaprint.xs should be updated to match.

@xsawyerx: does that look right to you?

from xs-fun.

xsawyerx avatar xsawyerx commented on June 29, 2024

@ivanych You're right. That line should not be in there. It was used originally to set the value of the algorithm before I wrote the code that validates what the algorithm is. It should be removed.

@paultcochrane The change you suggest keeps that line, which we agree should be removed, and removes another line, the else clause that stores whatever else the parameter and its value is, which I think is by mistake. Is it by mistake?

from xs-fun.

xsawyerx avatar xsawyerx commented on June 29, 2024

I created the following Pull Request for it: #30.

from xs-fun.

paultcochrane avatar paultcochrane commented on June 29, 2024

@xsawyerx It seems I misunderstood @ivanych's comment: I thought it was meant that the line was missing from the code and that the text was correct. My apologies for getting it around the wrong way!

@xsawyerx my proposed change only moved the algo line into the else clause of the inner if statement. It doesn't remove the following else clause; I merely didn't mention the second else clause in my quoted text above. That certainly could have been clearer, I admit... Also: thanks for the clarification in the PR!

@ivanych: does the change in #30 fix the issue for you?

from xs-fun.

xsawyerx avatar xsawyerx commented on June 29, 2024

I consider this resolved. If not, please reopen.

from xs-fun.

ivanych avatar ivanych commented on June 29, 2024

Yes, now everything is ok. Thank you!

from xs-fun.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.