When you use MIT-licensed code in a non-MIT-licensed project, simply marking the MIT-licensed parts of the source code is not a good strategy. The license allows you to do just about anything with the code – including sublicensing the code –, under this one restriction:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Note that the MIT license should also be displayed to the end user of your software. Where you display your copyright to the user, you should also add something like
This program includes code from the FooBar library, used under the following license:
The "FooBar" library
Copyright (c) <year> <copyright holders>
<license body>
In addition, you might want to explicitly mark the sections in the code that were taken from an MIT-licensed source. From my understanding, this is not required, but it would be ethical.
When you modify an MIT-licensed source, you should not mark your contributions with a separate license, because this requires an user of the source to follow both the original license and your license. Instead, choose one of the following options:
- License your contributions under the same license as the rest of the code. You can edit the copyright notice to reflect that you contributed to the source, without marking what exactly you changed.
- Re-license the MIT-licensed source under your license, in a manner permitted by the MIT license. See above.
Notes:
- I'm a programmer, not a lawyer.
- The term “MIT license” is fairly ambiguous. This answer assumes the Expat License, but is also applicable to the X11 License.