Exception.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
  2. /*
  3. * Exception.cpp
  4. * ZXing
  5. *
  6. * Created by Christian Brunschen on 03/06/2008.
  7. * Copyright 2008-2011 ZXing authors All rights reserved.
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License");
  10. * you may not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS,
  17. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. */
  21. #include <zxing/ZXing.h>
  22. #include <zxing/Exception.h>
  23. #include <string.h>
  24. using zxing::Exception;
  25. void Exception::deleteMessage() {
  26. delete [] message;
  27. }
  28. char const* Exception::copy(char const* msg) {
  29. char* message = 0;
  30. if (msg) {
  31. int l = strlen(msg)+1;
  32. if (l) {
  33. message = new char[l];
  34. strcpy(message, msg);
  35. }
  36. }
  37. return message;
  38. }