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

add option to directly support narrow strings on win32 #1199

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

Conversation

jason-ha
Copy link
Contributor

@jason-ha jason-ha commented Jul 19, 2019

partial support for feature request #72
add option to directly support narrow strings on win32
independent of UNICODE vs MBCS setting
Set CPPREST_FORCE_NARROW_STRINGS=ON to enable.

Simplistic cleanup throughout project is not possible as some Windows APIs require utf16 such as HTTPSPolicyCallbackData in http_client_winhttp.cpp.
HTTP related code is not completely updated so a full package may not be produced, though settings exist to have a clean build. Use:
-DCPPREST_FORCE_NARROW_STRING=ON -DCPPREST_EXCLUDE_WEBSOCKETS=ON -DCPPREST_HTTP_LISTENER_IMPL=none -DBUILD_SAMPLES=OFF

jason-ha added 7 commits July 19, 2019 11:15
 independent of UNICODE vs MBCS setting
Set CPPREST_FORCE_NARROW_STRINGS=ON to enable.

Simplistic cleanup throughout project is not possible as some Windows APIs require utf16 such as HTTPSPolicyCallbackData in http_client_winhttp.cpp.
HTTP related code is not completely updated so a full package may not be produced, though settings exist to have a clean build. Use:
 -DCPPREST_FORCE_NARROW_STRING=ON -DCPPREST_EXCLUDE_WEBSOCKETS=ON -DCPPREST_HTTP_LISTENER_IMPL=none -DBUILD_SAMPLES=OFF
…omponents like just json support

extractions from asyncrt_utils.h:
  base64_utils.h (to/form base64)
  memory_utils.h (details::make_unique)
  string_utils.cpp (string utils)

asyncrt_utils retains error, date-time, and nounce utils
@BillyONeal
Copy link
Member

Look like legitimate build/test failures that need to be fixed.

@jason-ha
Copy link
Contributor Author

jason-ha commented Jul 23, 2019 via email

@BillyONeal
Copy link
Member

Unfortunately I don't think it is appropriate to merge this work with this still disabled, as merging this to master is making a statement that it's an officially supported part of the product. However, I acknowledge trying to make changes of this scale is difficult to do as a complete fully formed change if it were to be squashed as a single commit, and doing it as separate reviews certainly makes it easier to review. Are you OK with retargeting this change to a semi-supported branch for this, which we will merge with a non-squash commit later?

I reviewed this and agree with all the changes herein (other than the above concern).

@jason-ha
Copy link
Contributor Author

I wouldn't say it is disabled as it is an option for Win32. Most Win32 users will not want to enable it.
But option enable does not allow fully codebase use - I don't know from issue thread #72 whether anyone is asking for narrow strings for the other components.
Given that I see a few options:

  1. as is, but add yaml step to ensure it builds - maybe that doesn't qualify as sufficiently supported
  2. refactor some more to have this option specifically for json portion - probably json will have its own basic types
  3. split off the sub libs that are independently useful - at least json and pplx. see also the isolate components PR that I built after this (which is why it is draft PR)
  4. remove the option for the moment, but keep most of the #if corrections. Then go to one of the earlier options and/or put the remaining changes in a semi-supported branch for now.

I do not think squashing is good way to go for this PR. Merge is good as (1) isolated component branch is derived from this and (2) I made targeted commits for preserving history in split files.

@jason-ha
Copy link
Contributor Author

I prepped PR #1230 if option 4 is desired. It is exactly this branch plus one change to remove CMakeLists.txt related changes and the basic_types.h use of the option.

@BillyONeal
Copy link
Member

refactor some more to have this option specifically for json portion

A change like that, as well as the 'isolated components' change, is moving the project in a direction where the json component would be usable on its own, without any HTTP support. For us that is an explicit non-goal. cpprestsdk is an HTTP client, and a not really being maintained much one at that.

Extracting the json components into their own project/repo which doesn't build any HTTP components sounds like it might be an interesting project, but isn't a scenario we are interested in supporting at this time.

Let me ask bosses et al. if there's a path forward for us here.

@jason-ha
Copy link
Contributor Author

FWIW I have now worked on several projects that reference pplx portion of cpprestsdk without using HTTP client portion. The JSON parsing is also on Microsoft's approved list of deserializers. So maybe not for your team directly, but there is value to the parts of cpprestsdk independently. If the maintenance is low, then perhaps it makes more sense to split out the most used/valuable parts.
I can talk with my management about co-maintenance or maybe full maintenance of non-HTTP client portions if that is helpful.

@BillyONeal
Copy link
Member

Right, this is an instance where what's probably the right technical decision might be counter to the current owner's strategic goals. (Namely, this project is no part of the team that currently owns it's charter)

That might change.... soon which is why I'm asking around

@garethsb garethsb mentioned this pull request Oct 24, 2019
@jason-ha
Copy link
Contributor Author

@BillyONeal been a while, but this json library is still our best option. Any changes such that we might be able to get this merged?
Note: the failures since merging master into branch are all pre-existing/unrelated to these changes. Doesn't appear to be worth requeuing.

@jason-ha jason-ha requested a review from BillyONeal February 14, 2020 23:46
@jason-ha
Copy link
Contributor Author

Didn't mean to request review for this one. Meant for the alternate that just handles better ifdef'ing. Per previous discussion this form would be for the semi-supported branch.

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