New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] #995 for Linux and Mac #1049

Open
wants to merge 6 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@MatejMecka
Contributor

MatejMecka commented Dec 2, 2018

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}

MatejMecka added some commits Oct 29, 2018

@ccextractor-bot

This comment has been minimized.

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"));

This comment has been minimized.

@cfsmp3

cfsmp3 Dec 2, 2018

Contributor

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.

This comment has been minimized.

@MatejMecka

MatejMecka Dec 2, 2018

Contributor

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

@@ -165,6 +166,24 @@ void drop_callback(GLFWwindow* window, int count, const char **paths)
// 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(){

This comment has been minimized.

@cfsmp3

cfsmp3 Dec 2, 2018

Contributor

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

This comment has been minimized.

@MatejMecka

MatejMecka Dec 2, 2018

Contributor

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

This comment has been minimized.

@MatejMecka

MatejMecka Dec 2, 2018

Contributor

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);

This comment has been minimized.

@cfsmp3

cfsmp3 Dec 2, 2018

Contributor

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.

This comment has been minimized.

@MatejMecka

MatejMecka Dec 2, 2018

Contributor

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;

This comment has been minimized.

@cfsmp3

cfsmp3 Dec 3, 2018

Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment