Question

I'm using a library that is licensed under a BSD-2 like license and I am wanting to override one of the methods they use and modify it slightly.

My question is, when I copy the code from the method what do I need to include in the comments for said method? Do I have to go all out and include the whole license there or can I input something more simple?

This is the license they have at the top of all the library files:

//  Copyright (c) 2008-9, the Phantom Inker.  All rights reserved.
//
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions
//  are met:
//
//    * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//
//    * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in
//       the documentation and/or other materials provided with the
//       distribution.
//
//  THIS SOFTWARE IS PROVIDED BY THE PHANTOM INKER "AS IS" AND ANY EXPRESS
//  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
//  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
//  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
//  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
//  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
//  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
//  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
//  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Was it helpful?

Solution

Short answer: Yes. You do need to include the entire BSD "license comment" in any and all of your source distributions which contain Mr. Phantom Inker's code or modified versions thereof. This is one of the very few conditions the license imposes on you:

//    * Redistributions of source code must retain the above copyright  
//       notice, this list of conditions and the following disclaimer.

The comment as you've pasted it appears to consist of a copyright notice, a list of conditions and then a disclaimer, so all of that must be "retained" in your version.

Also, when you modify someone else's code it's best to add an additional comment saying that you modified it and the original version had so-and-so license, not because any license requires you to, but simply because it makes it clear what's going on. So you should actually have a longer comment block than the original code did.

The good news--if you were worried about this wall of text being an eyesore in your code--is that you do not necessarily have to include this comment block right on top of or in the middle of that particular method, as long as you make it sufficiently obvious what it is referring to. I would personally put all this licensing stuff at the top of the file, make sure your additional comment says something like "The code for method foo() was taken from Phantom Maker's FooLib v1.2 and modified by Brett. The FooLib v1.2 copyright notice is as follows: ", then on the actual method in question have a single line comment saying something like "For licensing information pertaining to this method, see the comments at the top of this file."

Licensed under: CC-BY-SA with attribution
scroll top