Skip to content
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

Use const pointer in write functions #94

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vincent-d
Copy link

The buffer passed to the write function should be const.

@pellepl
Copy link
Owner

pellepl commented Jul 13, 2016

Thanks! Will run it thru the tests next week, currently in vacation mode 😉

@pellepl
Copy link
Owner

pellepl commented Jul 19, 2016

Hi again,

building it (gcc 4.8.4) yields warnings:

src/spiffs_hydrogen.c: In function ‘spiffs_hydro_write’:
src/spiffs_hydrogen.c:420:44: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
     res = spiffs_object_modify(fd, offset, (u8_t *)buf, m_len);
                                            ^
src/spiffs_hydrogen.c:423:19: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
     u8_t *buf_8 = (u8_t *)buf;
                   ^
src/spiffs_hydrogen.c:429:44: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
     res = spiffs_object_append(fd, offset, (u8_t *)buf, remaining);
                                            ^

Would you please fix these before I merge it in?

HAL API has been updated to use const pointer when writing
@vincent-d
Copy link
Author

@pellepl Sorry I forgot to do it until now.

Const pointer are used in more write functions, the warning should disappear.

Only drawback is that the HAL write function prototype has been updated.

@pellepl
Copy link
Owner

pellepl commented Sep 18, 2016

Hi,
Sorry for belated answer. Busy times for me now. Thanks for your work! Ah yes, suspected the callbacks would have to change. I am planning a major rewrite of spiffs which will change some other API stuff also. Instead of pushing two different patches with API changes in both, I think the best way is to incorporate yours in the major change. Meaning this request will be put on ice for some time, if that's ok with you.

Cheers / Peter

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.

2 participants