Skip to content

Conversation

@MatejMecka
Copy link
Contributor

Please prefix your pull request with one of the following: [FEATURE] [FIX] [IMPROVEMENT].

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

{pull request content here}

@ccextractor-bot
Copy link
Collaborator

ccextractor-bot commented Dec 2, 2018

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results:

Report Name Tests Passed
Broken 12/13
DVB 4/7
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Teletext 14/21
WTV 13/13
XDS 34/34
CEA-708 14/14
DVD 3/3
Options 81/86

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Your PR breaks these cases:


Check the result page for more info.

strncpy(path_of_ccextractor, path_of_executable, strlen(path_of_executable));
path_of_ccextractor[strlen(path_of_ccextractor)-20]='\0'; // Fails without null pointer
media.icons.home = icon_load(concat(path_of_ccextractor,"icon/home.png"));
media.icons.directory = icon_load(concat(path_of_ccextractor, "icon/directory.png"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is leaking memory - concat is doing a malloc() but there's no free() anywhere, and you're not holding a reference.
A simple solution would be to write a function called cc_icon_load (or a better name you come up with) that just takes the name of the icon ("home") for example and adds everything else (path_of_executable) + ".png", then frees everything, and just returns the same same as icon_load().
A much better solution would be to write a simple program that takes all the icons and generates a .h file that contains the icons themselves (not the filenames; the binary data) in an array so we can generate a binary and contains the icons completely - so we don't have to have any additional file.

Copy link
Contributor Author

@MatejMecka MatejMecka Dec 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While working on the better solution stbi uses fopen to read the file so unless we rewrite the library for the stbi_load function The better method won't work in the situation

// nk_draw_text(canvas, space, "Hardsubs Extraction: Yes", 24, &font->handle, nk_rgb(88, 81, 96), nk_rgb(0, 0, 0));
//}

char* get_executable_path(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem really portable... what about Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a Windows Machine to test it on :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a Method for windows too: https://docs.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-getmodulefilenamea but i don't have a machine to test it :) If someone volunteers i'll gladly implement it

nk_label(ctx, "Hardsubtitles extraction: Yes", NK_TEXT_LEFT);
else
nk_label(ctx, "Hardsubtitles extraction: No", NK_TEXT_LEFT);
nk_label(ctx, concat("Input type: ", input.type[input.type_select]), NK_TEXT_LEFT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaks here...
Maybe write a printf() function that works on labels - check the source code of mprintf for example.
You could do a nk_label_printf (ctx, NK_TEXT_LEFT, "Input type: %s%s", input.type[input.type_select]);
which would be a lot neater.
That function in fact could be contributed to nuklear, since it would be quite useful for everybody.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do anything here other than convert the mixed identation from spaces and tabs to tabs only. I'll try my best to fix this

char buf[256];
uint32_t size = sizeof(buf);
if (_NSGetExecutablePath(buf, &size) == 0){
return buf;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't return this buf, it's an stack variable.

@cfsmp3 cfsmp3 closed this Dec 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants